Changeset f14291b in mainline for uspace/lib/net/include


Ignore:
Timestamp:
2010-10-19T20:55:53Z (16 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/fix-logger-deadlock, topic/msim-upgrade, topic/simplify-dev-export
Children:
a93d79a
Parents:
1882525 (diff), a7a85d16 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

Location:
uspace/lib/net/include
Files:
2 added
19 edited
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/lib/net/include/adt/module_map.h

    r1882525 rf14291b  
    2727 */
    2828
    29 /** @addtogroup net
    30  *  @{
     29/** @addtogroup libnet
     30 * @{
    3131 */
    3232
    3333/** @file
    34  *  Character string to module map.
     34 * Character string to module map.
    3535 */
    3636
    37 #ifndef __NET_MODULES_MAP_H__
    38 #define __NET_MODULES_MAP_H__
     37#ifndef LIBNET_MODULES_MAP_H_
     38#define LIBNET_MODULES_MAP_H_
    3939
    4040#include <task.h>
    41 
    4241#include <ipc/services.h>
    43 
    44 #include <net_modules.h>
    45 
     42#include <net/modules.h>
    4643#include <adt/generic_char_map.h>
    4744
    4845/** Type definition of the module structure.
    49  *  @see module_struct
     46 * @see module_struct
    5047 */
    51 typedef struct module_struct    module_t;
     48typedef struct module_struct module_t;
    5249
    5350/** Type definition of the module structure pointer.
    54  *  @see module_struct
     51 * @see module_struct
    5552 */
    56 typedef module_t *                              module_ref;
     53typedef module_t *module_ref;
    5754
    5855/** Module map.
    59  *  Sorted by module names.
    60  *  @see generic_char_map.h
     56 * Sorted by module names.
     57 * @see generic_char_map.h
    6158 */
    6259GENERIC_CHAR_MAP_DECLARE(modules, module_t)
    6360
    64 /** Module structure.
    65  */
    66 struct  module_struct{
    67         /** Module task identifier if running.
    68          */
     61/** Module structure. */
     62struct module_struct {
     63        /** Module task identifier if running. */
    6964        task_id_t task_id;
    70         /** Module service identifier.
    71          */
     65        /** Module service identifier. */
    7266        services_t service;
    73         /** Module phone if running and connected.
    74          */
     67        /** Module phone if running and connected. */
    7568        int phone;
    76         /** Usage counter.
    77          */
     69        /** Usage counter. */
    7870        int usage;
    79         /** Module name.
    80          */
    81         const char * name;
    82         /** Module full path filename.
    83          */
    84         const char * filename;
    85         /** Connecting function.
    86          */
    87         connect_module_t * connect_module;
     71        /** Module name. */
     72        const char *name;
     73        /** Module full path filename. */
     74        const char *filename;
     75        /** Connecting function. */
     76        connect_module_t *connect_module;
    8877};
    8978
    90 /** Adds module to the module map.
    91  *  @param[out] module The module structure added.
    92  *  @param[in] modules The module map.
    93  *  @param[in] name The module name.
    94  *  @param[in] filename The full path filename.
    95  *  @param[in] service The module service.
    96  *  @param[in] task_id The module current task identifier. Zero (0) means not running.
    97  *  @param[in] connect_module The module connecting function.
    98  *  @returns EOK on success.
    99  *  @returns ENOMEM if there is not enough memory left.
    100  */
    101 int add_module(module_ref * module, modules_ref modules, const char * name, const char * filename, services_t service, task_id_t task_id, connect_module_t * connect_module);
    102 
    103 /** Searches and returns the specified module.
    104  *  If the module is not running, the module filaname is spawned.
    105  *  If the module is not connected, the connect_function is called.
    106  *  @param[in] modules The module map.
    107  *  @param[in] name The module name.
    108  *  @returns The running module found. It does not have to be connected.
    109  *  @returns NULL if there is no such module.
    110  */
    111 module_ref get_running_module(modules_ref modules, char * name);
    112 
    113 /** Starts the given module.
    114  *  @param[in] fname The module full or relative path filename.
    115  *  @returns The new module task identifier on success.
    116  *  @returns 0 if there is no such module.
    117  */
    118 task_id_t spawn(const char * fname);
     79extern int add_module(module_ref *, modules_ref, const char *, const char *,
     80    services_t, task_id_t, connect_module_t *);
     81extern module_ref get_running_module(modules_ref, char *);
     82extern task_id_t spawn(const char *);
    11983
    12084#endif
  • uspace/lib/net/include/arp_interface.h

    r1882525 rf14291b  
    2727 */
    2828
    29 /** @addtogroup arp
    30  *  @{
     29/** @addtogroup libnet
     30 * @{
    3131 */
    3232
    33 #ifndef __NET_ARP_INTERFACE_H__
    34 #define __NET_ARP_INTERFACE_H__
     33#ifndef LIBNET_ARP_INTERFACE_H_
     34#define LIBNET_ARP_INTERFACE_H_
    3535
    3636#include <adt/measured_strings.h>
    37 #include <net_device.h>
     37#include <task.h>
     38
     39#include <ipc/services.h>
     40
     41#include <net/device.h>
     42#include <net/socket.h>
    3843
    3944/** @name ARP module interface
    40  *  This interface is used by other modules.
     45 * This interface is used by other modules.
    4146 */
    4247/*@{*/
    4348
    44 /** Registers the new device and the requesting protocol service.
    45  *  Connects to the network interface layer service.
    46  *  Determines the device broadcast address, its address lengths and packet size.
    47  *  @param[in] arp_phone The ARP module phone used for (semi)remote calls.
    48  *  @param[in] device_id The new device identifier.
    49  *  @param[in] protocol The requesting protocol service.
    50  *  @param[in] netif The underlying device network interface layer service.
    51  *  @param[in] address The local requesting protocol address of the device.
    52  *  @returns EOK on success.
    53  *  @returns EEXIST if the device is already used.
    54  *  @returns ENOMEM if there is not enough memory left.
    55  *  @returns ENOENT if the network interface service is not known.
    56  *  @returns EREFUSED if the network interface service is not responding.
    57  *  @returns Other error codes as defined for the nil_packet_get_size() function.
    58  *  @returns Other error codes as defined for the nil_get_addr() function.
    59  *  @returns Other error codes as defined for the nil_get_broadcast_addr() function.
    60  */
    61 extern int arp_device_req(int arp_phone, device_id_t device_id, services_t protocol, services_t netif, measured_string_ref address);
    62 
    63 /** Translates the given protocol address to the network interface address.
    64  *  Broadcasts the ARP request if the mapping is not found.
    65  *  Allocates and returns the needed memory block as the data parameter.
    66  *  @param[in] arp_phone The ARP module phone used for (semi)remote calls.
    67  *  @param[in] device_id The device identifier.
    68  *  @param[in] protocol The requesting protocol service.
    69  *  @param[in] address The local requesting protocol address.
    70  *  @param[out] translation The translation of the local protocol address.
    71  *  @param[out] data The allocated raw translation data container.
    72  *  @returns EOK on success.
    73  *  @returns EINVAL if the address parameter is NULL.
    74  *  @returns EBADMEM if the translation or the data parameters are NULL.
    75  *  @returns ENOENT if the mapping is not found.
    76  */
    77 extern int arp_translate_req(int arp_phone, device_id_t device_id, services_t protocol, measured_string_ref address, measured_string_ref * translation, char ** data);
    78 
    79 /** Clears the device cache.
    80  *  @param[in] arp_phone The ARP module phone used for (semi)remote calls.
    81  *  @param[in] device_id The device identifier.
    82  *  @returns EOK on success.
    83  *  @returns ENOENT if the device is not found.
    84  */
    85 extern int arp_clear_device_req(int arp_phone, device_id_t device_id);
    86 
    87 /** Clears the given protocol address from the cache.
    88  *  @param[in] arp_phone The ARP module phone used for (semi)remote calls.
    89  *  @param[in] device_id The device identifier.
    90  *  @param[in] protocol The requesting protocol service.
    91  *  @param[in] address The protocol address to be cleared.
    92  *  @returns EOK on success.
    93  *  @returns ENOENT if the mapping is not found.
    94  */
    95 extern int arp_clear_address_req(int arp_phone, device_id_t device_id, services_t protocol, measured_string_ref address);
    96 
    97 /** Cleans the cache.
    98  *  @param[in] arp_phone The ARP module phone used for (semi)remote calls.
    99  *  @returns EOK on success.
    100  */
    101 extern int arp_clean_cache_req(int arp_phone);
    102 
    103 /** Connects to the ARP module.
    104  *  @param service The ARP module service. Ignored parameter.
    105  *  @returns The ARP module phone on success.
    106  *  @returns 0 if called by the bundle module.
    107  */
    108 extern int arp_connect_module(services_t service);
    109 
    110 /** Returns the ARP task identifier.
    111  *  @returns The current task identifier if called by the bundle module.
    112  *  @returns 0 if called by the remote module.
    113  */
    114 extern task_id_t arp_task_get_id(void);
     49extern int arp_device_req(int, device_id_t, services_t, services_t,
     50    measured_string_ref);
     51extern int arp_translate_req(int, device_id_t, services_t, measured_string_ref,
     52    measured_string_ref *, char **);
     53extern int arp_clear_device_req(int, device_id_t);
     54extern int arp_clear_address_req(int, device_id_t, services_t,
     55    measured_string_ref);
     56extern int arp_clean_cache_req(int);
     57extern int arp_connect_module(services_t);
    11558
    11659/*@}*/
  • uspace/lib/net/include/generic.h

    r1882525 rf14291b  
    2727 */
    2828
    29 /** @addtogroup icmp
    30  *  @{
     29/** @addtogroup libnet
     30 * @{
    3131 */
    3232
    3333/** @file
    34  *  ICMP application interface implementation.
    35  *  @see icmp_api.h
     34 * Generic communication interfaces for networking.
    3635 */
    3736
     37#ifndef LIBNET_GENERIC_H_
     38#define LIBNET_GENERIC_H_
     39
    3840#include <async.h>
    39 
    4041#include <ipc/ipc.h>
    4142#include <ipc/services.h>
    4243
    43 #include <sys/types.h>
     44#include <net/device.h>
     45#include <adt/measured_strings.h>
     46#include <net/packet.h>
    4447
    45 #include <net_modules.h>
    46 #include <icmp_api.h>
    47 #include <inet.h>
    48 #include <ip_codes.h>
    49 #include <socket_codes.h>
    50 #include <icmp_messages.h>
     48extern int generic_device_state_msg_remote(int, int, device_id_t, int,
     49    services_t);
     50extern int generic_device_req_remote(int, int, device_id_t, int, services_t);
     51extern int generic_get_addr_req(int, int, device_id_t, measured_string_ref *,
     52    char **);
     53extern int generic_packet_size_req_remote(int, int, device_id_t,
     54    packet_dimension_ref);
     55extern int generic_received_msg_remote(int, int, device_id_t, packet_id_t,
     56    services_t, services_t);
     57extern int generic_send_msg_remote(int, int, device_id_t, packet_id_t,
     58    services_t, services_t);
     59extern int generic_translate_req(int, int, device_id_t, services_t,
     60    measured_string_ref, size_t, measured_string_ref *, char **);
    5161
    52 int icmp_echo_msg(int icmp_phone, size_t size, mseconds_t timeout, ip_ttl_t ttl, ip_tos_t tos, int dont_fragment, const struct sockaddr * addr, socklen_t addrlen){
    53         aid_t message_id;
    54         ipcarg_t result;
    55 
    56         if(addrlen <= 0){
    57                 return EINVAL;
    58         }
    59         message_id = async_send_5(icmp_phone, NET_ICMP_ECHO, size, timeout, ttl, tos, (ipcarg_t) dont_fragment, NULL);
    60         // send the address
    61         async_data_write_start(icmp_phone, addr, (size_t) addrlen);
    62         // timeout version may cause inconsistency - there is also an inner timer
    63         // return async_wait_timeout(message_id, &result, timeout);
    64         async_wait_for(message_id, &result);
    65         return (int) result;
    66 }
     62#endif
    6763
    6864/** @}
  • uspace/lib/net/include/icmp_client.h

    r1882525 rf14291b  
    3838#define __NET_ICMP_CLIENT_H__
    3939
    40 #include <icmp_codes.h>
    41 #include <packet/packet.h>
     40#include <net/icmp_codes.h>
     41#include <net/packet.h>
    4242
    4343/** Processes the received packet prefixed with an ICMP header.
  • uspace/lib/net/include/icmp_header.h

    r1882525 rf14291b  
    4141#include <sys/types.h>
    4242
    43 #include <in.h>
    44 #include <icmp_codes.h>
     43#include <net/in.h>
     44#include <net/icmp_codes.h>
    4545
    4646/** ICMP header size in bytes.
  • uspace/lib/net/include/icmp_interface.h

    r1882525 rf14291b  
    3434#define __NET_ICMP_INTERFACE_H__
    3535
     36#include <net/socket_codes.h>
    3637#include <sys/types.h>
    3738
    38 #include <net_device.h>
     39#include <net/device.h>
    3940#include <adt/measured_strings.h>
    40 #include <packet/packet.h>
    41 #include <inet.h>
    42 #include <ip_codes.h>
    43 #include <socket_codes.h>
    44 #include <icmp_codes.h>
    45 #include <icmp_common.h>
     41#include <net/packet.h>
     42#include <net/inet.h>
     43#include <net/ip_codes.h>
     44#include <net/icmp_codes.h>
     45#include <net/icmp_common.h>
    4646
    4747/** @name ICMP module interface
  • uspace/lib/net/include/il_interface.h

    r1882525 rf14291b  
    3939#define __NET_IL_INTERFACE_H__
    4040
    41 #include <async.h>
     41#include <generic.h>
    4242
    4343#include <ipc/services.h>
     44#include <ipc/il.h>
    4445
    45 #include <net_messages.h>
    46 #include <net_device.h>
    47 #include <packet/packet.h>
    48 #include <packet/packet_client.h>
    49 #include <il_messages.h>
     46#include <net/device.h>
     47#include <net/packet.h>
     48
     49#include <packet_client.h>
    5050
    5151/** @name Internetwork layer module interface
  • uspace/lib/net/include/ip_client.h

    r1882525 rf14291b  
    2727 */
    2828
    29 /** @addtogroup ip
    30  *  @{
     29/** @addtogroup libnet
     30 * @{
    3131 */
    3232
    3333/** @file
    34  *  IP client interface.
     34 * IP client interface.
    3535 */
    3636
    37 #ifndef __NET_IP_CLIENT_H__
    38 #define __NET_IP_CLIENT_H__
     37#ifndef LIBNET_IP_CLIENT_H_
     38#define LIBNET_IP_CLIENT_H_
    3939
     40#include <net/socket_codes.h>
    4041#include <sys/types.h>
    4142
    42 #include <packet/packet.h>
    43 #include <ip_codes.h>
     43#include <net/packet.h>
     44#include <net/ip_codes.h>
    4445#include <ip_interface.h>
    45 #include <socket_codes.h>
    4646
    47 /** Prepares the packet to be transfered via IP.
    48  *  The IP header is prefixed.
    49  *  @param[in,out] packet The packet to be prepared.
    50  *  @param[in] protocol The transport protocol.
    51  *  @param[in] ttl The time to live counter. The IPDEFTTL is set if zero (0).
    52  *  @param[in] tos The type of service.
    53  *  @param[in] dont_fragment The value indicating whether fragmentation is disabled.
    54  *  @param[in] ipopt_length The prefixed IP options length in bytes.
    55  *  @returns EOK on success.
    56  *  @returns ENOMEM if there is not enough memory left in the packet.
    57  */
    58 extern int ip_client_prepare_packet(packet_t packet, ip_protocol_t protocol, ip_ttl_t ttl, ip_tos_t tos, int dont_fragment, size_t ipopt_length);
    59 
    60 /** Processes the received IP packet.
    61  *  Fills set header fields.
    62  *  Returns the prefixed IP header length.
    63  *  @param[in] packet The received packet.
    64  *  @param[out] protocol The transport protocol. May be NULL if not desired.
    65  *  @param[out] ttl The time to live counter. May be NULL if not desired.
    66  *  @param[out] tos The type of service. May be NULL if not desired.
    67  *  @param[out] dont_fragment The value indicating whether the fragmentation is disabled. May be NULL if not desired.
    68  *  @param[out] ipopt_length The IP options length in bytes. May be NULL if not desired.
    69  *  @returns The prefixed IP header length in bytes on success.
    70  *  @returns ENOMEM if the packet is too short to contain the IP header.
    71  */
    72 extern int ip_client_process_packet(packet_t packet, ip_protocol_t * protocol, ip_ttl_t * ttl, ip_tos_t * tos, int * dont_fragment, size_t * ipopt_length);
    73 
    74 /** Returns the IP header length.
    75  *  @param[in] packet The packet.
    76  *  @returns The IP header length in bytes.
    77  *  @returns Zero (0) if there is no IP header.
    78  */
    79 extern size_t ip_client_header_length(packet_t packet);
    80 
    81 /** Updates the IPv4 pseudo header data length field.
    82  *  @param[in,out] header The IPv4 pseudo header to be updated.
    83  *  @param[in] headerlen The length of the IP pseudo header in bytes.
    84  *  @param[in] data_length The data length to be set.
    85  *  @returns EOK on success.
    86  *  @returns EBADMEM if the header parameter is NULL.
    87  *  @returns EINVAL if the headerlen parameter is not IPv4 pseudo header length.
    88  */
    89 extern int ip_client_set_pseudo_header_data_length(void *header, size_t headerlen, size_t data_length);
    90 
    91 /** Constructs the IPv4 pseudo header.
    92  *  @param[in] protocol The transport protocol.
    93  *  @param[in] src The source address.
    94  *  @param[in] srclen The source address length.
    95  *  @param[in] dest The destination address.
    96  *  @param[in] destlen The destination address length.
    97  *  @param[in] data_length The data length to be set.
    98  *  @param[out] header The constructed IPv4 pseudo header.
    99  *  @param[out] headerlen The length of the IP pseudo header in bytes.
    100  *  @returns EOK on success.
    101  *  @returns EBADMEM if the header and/or the headerlen parameter is NULL.
    102  *  @returns EINVAL if the source address and/or the destination address parameter is NULL.
    103  *  @returns EINVAL if the source address length is less than struct sockaddr length.
    104  *  @returns EINVAL if the source address length differs from the destination address length.
    105  *  @returns EINVAL if the source address family differs from the destination family.
    106  *  @returns EAFNOSUPPORT if the address family is not supported.
    107  *  @returns ENOMEM if there is not enough memory left.
    108  */
    109 extern int ip_client_get_pseudo_header(ip_protocol_t protocol, struct sockaddr * src, socklen_t srclen, struct sockaddr * dest, socklen_t destlen, size_t data_length, void **header, size_t * headerlen);
     47extern int ip_client_prepare_packet(packet_t, ip_protocol_t, ip_ttl_t, ip_tos_t,
     48    int, size_t);
     49extern int ip_client_process_packet(packet_t, ip_protocol_t *, ip_ttl_t *,
     50    ip_tos_t *, int *, size_t *);
     51extern size_t ip_client_header_length(packet_t);
     52extern int ip_client_set_pseudo_header_data_length(void *, size_t, size_t);
     53extern int ip_client_get_pseudo_header(ip_protocol_t, struct sockaddr *,
     54    socklen_t, struct sockaddr *, socklen_t, size_t, void **, size_t *);
    11055
    11156// TODO ipopt manipulation
  • uspace/lib/net/include/ip_interface.h

    r1882525 rf14291b  
    3434#define __NET_IP_INTERFACE_H__
    3535
     36#include <net/socket_codes.h>
    3637#include <async.h>
    3738#include <ipc/services.h>
    3839
    39 #include <net_device.h>
    40 #include <packet/packet.h>
     40#include <net/device.h>
     41#include <net/packet.h>
    4142
    42 #include <in.h>
    43 #include <ip_codes.h>
    44 #include <socket_codes.h>
    45 
    46 #ifdef CONFIG_IL_TL_BUNDLE
    47 
    48 #include <ip_local.h>
    49 
    50 #define ip_received_error_msg  ip_received_error_msg_local
    51 #define ip_set_gateway_req     ip_set_gateway_req_local
    52 #define ip_packet_size_req     ip_packet_size_req_local
    53 #define ip_device_req          ip_device_req_local
    54 #define ip_add_route_req       ip_add_route_req_local
    55 #define ip_send_msg            ip_send_msg_local
    56 #define ip_get_route_req       ip_get_route_req_local
    57 
    58 #else
     43#include <net/in.h>
     44#include <net/ip_codes.h>
    5945
    6046#include <ip_remote.h>
     
    6753#define ip_send_msg            ip_send_msg_remote
    6854#define ip_get_route_req       ip_get_route_req_remote
    69 
    70 #endif
    7155
    7256/** @name IP module interface
     
    9074 *  @param[in] me The requesting module service.
    9175 *  @param[in] receiver The message receiver. Used for remote connection.
    92  *  @param[in] tl_received_msg The message processing function. Used if bundled together.
    9376 *  @returns The phone of the needed service.
    9477 *  @returns EOK on success.
    9578 *  @returns Other error codes as defined for the bind_service() function.
    9679 */
    97 extern int ip_bind_service(services_t service, int protocol, services_t me, async_client_conn_t receiver, tl_received_msg_t tl_received_msg);
     80extern int ip_bind_service(services_t service, int protocol, services_t me, async_client_conn_t receiver);
    9881
    9982/** Connects to the IP module.
    10083 *  @param service The IP module service. Ignored parameter.
    10184 *  @returns The IP module phone on success.
    102  *  @returns 0 if called by the bundle module.
    10385 */
    10486extern int ip_connect_module(services_t service);
  • uspace/lib/net/include/ip_remote.h

    r1882525 rf14291b  
    3434#define __NET_IP_REMOTE_H__
    3535
    36 #include <async.h>
    3736#include <ipc/services.h>
    3837
    39 #include <ip_codes.h>
    40 #include <inet.h>
    41 #include <in.h>
    42 #include <socket.h>
     38#include <net/ip_codes.h>
     39#include <net/inet.h>
     40#include <net/in.h>
     41#include <net/packet.h>
     42#include <net/device.h>
     43#include <net/socket.h>
    4344
    4445extern int ip_set_gateway_req_remote(int, device_id_t, in_addr_t);
  • uspace/lib/net/include/net_checksum.h

    r1882525 rf14291b  
    2727 */
    2828
    29 /** @addtogroup net
    30  *  @{
     29/** @addtogroup libnet
     30 * @{
    3131 */
    3232
    3333/** @file
    34  *  General CRC and checksum computation.
     34 * General CRC and checksum computation.
    3535 */
    3636
    37 #ifndef __NET_CHECKSUM_H__
    38 #define __NET_CHECKSUM_H__
     37#ifndef LIBNET_CHECKSUM_H_
     38#define LIBNET_CHECKSUM_H_
    3939
    4040#include <byteorder.h>
    41 
    4241#include <sys/types.h>
    4342
    4443/** IP checksum value for computed zero checksum.
    45  *  Zero is returned as 0xFFFF (not flipped)
     44 * Zero is returned as 0xFFFF (not flipped)
    4645 */
    47 #define IP_CHECKSUM_ZERO                        0xFFFFu
     46#define IP_CHECKSUM_ZERO        0xffffU
    4847
    49 /**     Computes CRC32 value.
    50  *  @param[in] seed Initial value. Often used as 0 or ~0.
    51  *  @param[in] data Pointer to the beginning of data to process.
    52  *  @param[in] length Length of the data in bits.
    53  *  @returns The computed CRC32 of the length bits of the data.
    54  */
    5548#ifdef ARCH_IS_BIG_ENDIAN
    56         #define compute_crc32(seed, data, length)       compute_crc32_be(seed, (uint8_t *) data, length)
     49#define compute_crc32(seed, data, length) \
     50        compute_crc32_be(seed, (uint8_t *) data, length)
    5751#else
    58         #define compute_crc32(seed, data, length)       compute_crc32_le(seed, (uint8_t *) data, length)
     52#define compute_crc32(seed, data, length) \
     53        compute_crc32_le(seed, (uint8_t *) data, length)
    5954#endif
    6055
    61 /**     Computes CRC32 value in the little-endian environment.
    62  *  @param[in] seed Initial value. Often used as 0 or ~0.
    63  *  @param[in] data Pointer to the beginning of data to process.
    64  *  @param[in] length Length of the data in bits.
    65  *  @returns The computed CRC32 of the length bits of the data.
    66  */
    67 extern uint32_t compute_crc32_le(uint32_t seed, uint8_t * data, size_t length);
    68 
    69 /**     Computes CRC32 value in the big-endian environment.
    70  *  @param[in] seed Initial value. Often used as 0 or ~0.
    71  *  @param[in] data Pointer to the beginning of data to process.
    72  *  @param[in] length Length of the data in bits.
    73  *  @returns The computed CRC32 of the length bits of the data.
    74  */
    75 extern uint32_t compute_crc32_be(uint32_t seed, uint8_t * data, size_t length);
    76 
    77 /** Computes sum of the 2 byte fields.
    78  *  Padds one zero (0) byte if odd.
    79  *  @param[in] seed Initial value. Often used as 0 or ~0.
    80  *  @param[in] data Pointer to the beginning of data to process.
    81  *  @param[in] length Length of the data in bytes.
    82  *  @returns The computed checksum of the length bytes of the data.
    83  */
    84 extern uint32_t compute_checksum(uint32_t seed, uint8_t * data, size_t length);
    85 
    86 /** Compacts the computed checksum to the 16 bit number adding the carries.
    87  *  @param[in] sum Computed checksum.
    88  *  @returns Compacted computed checksum to the 16 bits.
    89  */
    90 extern uint16_t compact_checksum(uint32_t sum);
    91 
    92 /** Returns or flips the checksum if zero.
    93  *  @param[in] checksum The computed checksum.
    94  *  @returns The internet protocol header checksum.
    95  *  @returns 0xFFFF if the computed checksum is zero.
    96  */
    97 extern uint16_t flip_checksum(uint16_t checksum);
    98 
    99 /** Computes the ip header checksum.
    100  *  To compute the checksum of a new packet, the checksum header field must be zero.
    101  *  To check the checksum of a received packet, the checksum may be left set.
    102  *  The zero (0) value will be returned in this case if valid.
    103  *  @param[in] data The header data.
    104  *  @param[in] length The header length in bytes.
    105  *  @returns The internet protocol header checksum.
    106  *  @returns 0xFFFF if the computed checksum is zero.
    107  */
    108 extern uint16_t ip_checksum(uint8_t * data, size_t length);
     56extern uint32_t compute_crc32_le(uint32_t, uint8_t *, size_t);
     57extern uint32_t compute_crc32_be(uint32_t, uint8_t *, size_t);
     58extern uint32_t compute_checksum(uint32_t, uint8_t *, size_t);
     59extern uint16_t compact_checksum(uint32_t);
     60extern uint16_t flip_checksum(uint16_t);
     61extern uint16_t ip_checksum(uint8_t *, size_t);
    10962
    11063#endif
  • uspace/lib/net/include/net_interface.h

    r1882525 rf14291b  
    2727 */
    2828
    29 /** @addtogroup net
     29/** @addtogroup libnet
    3030 *  @{
    3131 */
    3232
    33 #ifndef __NET_NET_INTERFACE_H__
    34 #define __NET_NET_INTERFACE_H__
     33#ifndef LIBNET_NET_INTERFACE_H_
     34#define LIBNET_NET_INTERFACE_H_
    3535
    3636#include <ipc/services.h>
    3737
    38 #include <net_device.h>
     38#include <net/device.h>
    3939#include <adt/measured_strings.h>
    4040
    4141/** @name Networking module interface
    42  *  This interface is used by other modules.
     42 * This interface is used by other modules.
    4343 */
    4444/*@{*/
    4545
    46 /** Returns the device specific configuration.
    47  *  Returns the global configuration if the device specific is not found.
    48  *  The configuration names are read and the appropriate settings are set instead.
    49  *  Call net_free_settings() function to release the returned configuration.
    50  *  @param[in] net_phone The networking module phone.
    51  *  @param[in] device_id The device identifier.
    52  *  @param[in,out] configuration The requested device configuration. The names are read and the appropriate settings are set instead.
    53  *  @param[in] count The configuration entries count.
    54  *  @param[in,out] data The configuration and settings data.
    55  *  @returns EOK on success.
    56  *  @returns EINVAL if the configuration is NULL.
    57  *  @returns EINVAL if the count is zero (0).
    58  *  @returns Other error codes as defined for the generic_translate_req() function.
    59  */
    60 extern int net_get_device_conf_req(int net_phone, device_id_t device_id, measured_string_ref * configuration, size_t count, char ** data);
    61 
    62 /** Returns the global configuration.
    63  *  The configuration names are read and the appropriate settings are set instead.
    64  *  Call net_free_settings() function to release the returned configuration.
    65  *  @param[in] net_phone The networking module phone.
    66  *  @param[in,out] configuration The requested configuration. The names are read and the appropriate settings are set instead.
    67  *  @param[in] count The configuration entries count.
    68  *  @param[in,out] data The configuration and settings data.
    69  *  @returns EOK on success.
    70  *  @returns EINVAL if the configuration is NULL.
    71  *  @returns EINVAL if the count is zero (0).
    72  *  @returns Other error codes as defined for the generic_translate_req() function.
    73  */
    74 extern int net_get_conf_req(int net_phone, measured_string_ref * configuration, size_t count, char ** data);
    75 
    76 /** Frees the received settings.
    77  *  @param[in] settings The received settings.
    78  *  @param[in] data The received settings data.
    79  *  @see net_get_device_conf_req()
    80  *  @see net_get_conf_req()
    81  */
    82 extern void net_free_settings(measured_string_ref settings, char * data);
    83 
    84 /** Connects to the networking module.
    85  *  @param service The networking module service. Ignored parameter.
    86  *  @returns The networking module phone on success.
    87  *  @returns 0 if called by the bundle module.
    88  */
    89 extern int net_connect_module(services_t service);
     46extern int net_get_device_conf_req(int, device_id_t, measured_string_ref *,
     47    size_t, char **);
     48extern int net_get_conf_req(int, measured_string_ref *, size_t, char **);
     49extern void net_free_settings(measured_string_ref, char *);
     50extern int net_connect_module(void);
    9051
    9152/*@}*/
  • uspace/lib/net/include/netif_interface.h

    r1882525 rf14291b  
    3434#define __NET_NETIF_INTERFACE_H__
    3535
    36 #ifdef CONFIG_NETIF_NIL_BUNDLE
    37 
    38 #include <netif_local.h>
    39 #include <netif_nil_bundle.h>
    40 #include <packet/packet_server.h>
    41 
    42 #define netif_module_message    netif_nil_module_message
    43 #define netif_module_start      netif_nil_module_start
    44 #define netif_get_addr_req      netif_get_addr_req_local
    45 #define netif_probe_req         netif_probe_req_local
    46 #define netif_send_msg          netif_send_msg_local
    47 #define netif_start_req         netif_start_req_local
    48 #define netif_stop_req          netif_stop_req_local
    49 #define netif_stats_req         netif_stats_req_local
    50 #define netif_bind_service      netif_bind_service_local
    51 
    52 #else /* CONFIG_NETIF_NIL_BUNDLE */
    53 
    5436#include <netif_remote.h>
    55 #include <packet/packet_client.h>
     37#include <packet_client.h>
    5638
    5739#define netif_module_message    netif_module_message_standalone
     
    6547#define netif_bind_service      netif_bind_service_remote
    6648
    67 #endif /* CONFIG_NETIF_NIL_BUNDLE */
    68 
    6949#endif
    7050
  • uspace/lib/net/include/netif_local.h

    r1882525 rf14291b  
    3434 * Network interface module skeleton.
    3535 * The skeleton has to be part of each network interface module.
    36  * The skeleton can be also part of the module bundled with the network interface layer.
    3736 */
    3837
     
    4443#include <ipc/ipc.h>
    4544#include <ipc/services.h>
     45#include <err.h>
    4646
    4747#include <adt/measured_strings.h>
    48 #include <net_err.h>
    49 #include <net_device.h>
    50 #include <packet/packet.h>
     48#include <net/device.h>
     49#include <net/packet.h>
    5150
    5251/** Network interface device specific data.
  • uspace/lib/net/include/netif_remote.h

    r1882525 rf14291b  
    3434#define __NET_NETIF_REMOTE_H__
    3535
    36 #include <async.h>
    37 #include <fibril_synch.h>
    38 #include <ipc/ipc.h>
     36#include <ipc/services.h>
     37#include <adt/measured_strings.h>
     38#include <net/device.h>
    3939
    4040extern int netif_get_addr_req_remote(int, device_id_t, measured_string_ref *,
  • uspace/lib/net/include/nil_interface.h

    r1882525 rf14291b  
    3838
    3939#include <ipc/ipc.h>
     40#include <ipc/nil.h>
    4041
    41 #include <net_messages.h>
    42 #include <adt/measured_strings.h>
    43 #include <packet/packet.h>
    44 #include <nil_messages.h>
    45 #include <net_device.h>
     42#include <generic.h>
     43#include <nil_remote.h>
    4644
    4745#define nil_bind_service(service, device_id, me, receiver) \
     
    6765            netif_service)
    6866
    69 
    70 #ifdef CONFIG_NETIF_NIL_BUNDLE
    71 
    72 #include <nil_local.h>
    73 #include <packet/packet_server.h>
    74 
    75 #define nil_device_state_msg  nil_device_state_msg_local
    76 #define nil_received_msg      nil_received_msg_local
    77 
    78 #else /* CONFIG_NETIF_NIL_BUNDLE */
    79 
    80 #include <nil_remote.h>
    81 #include <packet/packet_server.h>
    82 
    8367#define nil_device_state_msg  nil_device_state_msg_remote
    8468#define nil_received_msg      nil_received_msg_remote
    85 
    86 #endif /* CONFIG_NETIF_NIL_BUNDLE */
    8769
    8870#endif
  • uspace/lib/net/include/nil_remote.h

    r1882525 rf14291b  
    3434#define __NET_NIL_REMOTE_H__
    3535
    36 #include <async.h>
    37 #include <fibril_synch.h>
    38 #include <ipc/ipc.h>
     36#include <ipc/services.h>
     37#include <net/device.h>
     38#include <net/packet.h>
    3939
    4040extern int nil_device_state_msg_remote(int, device_id_t, int);
  • uspace/lib/net/include/packet_remote.h

    r1882525 rf14291b  
    2727 */
    2828
    29 /** @addtogroup packet
     29/** @addtogroup libnet
    3030 * @{
    3131 */
    3232
    33 #ifndef __NET_PACKET_REMOTE_H__
    34 #define __NET_PACKET_REMOTE_H__
     33#ifndef LIBNET_PACKET_REMOTE_H_
     34#define LIBNET_PACKET_REMOTE_H_
    3535
    36 #include <packet/packet.h>
     36#include <net/packet.h>
     37#include <sys/types.h>
    3738
    3839extern int packet_translate_remote(int, packet_ref, packet_id_t);
  • uspace/lib/net/include/tl_common.h

    r1882525 rf14291b  
    3838#define __NET_TL_COMMON_H__
    3939
    40 #include <packet/packet.h>
    41 #include <net_device.h>
    42 #include <inet.h>
    43 #include <socket_codes.h>
     40#include <net/socket_codes.h>
     41#include <net/packet.h>
     42#include <net/device.h>
     43#include <net/inet.h>
    4444
    4545/** Device packet dimensions.
  • uspace/lib/net/include/tl_interface.h

    r1882525 rf14291b  
    4040#include <async.h>
    4141#include <ipc/services.h>
     42#include <ipc/tl.h>
    4243
    43 #include <net_messages.h>
    44 #include <net_device.h>
    45 #include <packet/packet.h>
    46 #include <packet/packet_client.h>
    47 #include <tl_messages.h>
     44#include <generic.h>
     45#include <net/device.h>
     46#include <net/packet.h>
     47#include <packet_client.h>
    4848
    4949/** @name Transport layer module interface
Note: See TracChangeset for help on using the changeset viewer.