Changeset 14f1db0 in mainline for uspace/lib/net/include


Ignore:
Timestamp:
2010-04-09T12:54:57Z (15 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a1caa3c2
Parents:
24ab58b3
Message:

networking overhaul:

  • separation of conserns
  • removal of (almost all) overlaping symbols, libnetif is not needed anymore
  • again, it is possible to build the networking in multiple architecture configurations (however, currently only the bundling netif and nil layers is supported, more to come)
  • code style updates and fixes (still a huge amount of work to do)
Location:
uspace/lib/net/include
Files:
4 added
2 deleted
13 edited
5 moved

Legend:

Unmodified
Added
Removed
  • uspace/lib/net/include/arp_interface.h

    r24ab58b3 r14f1db0  
    2929/** @addtogroup arp
    3030 *  @{
    31  */
    32 
    33 /** @file
    34  *  ARP module interface.
    35  *  The same interface is used for standalone remote modules as well as for bundle modules.
    36  *  The standalone remote modules have to be compiled with the arp_remote.c source file.
    37  *  The bundle modules with the arp.c source file.
    3831 */
    3932
  • uspace/lib/net/include/icmp_interface.h

    r24ab58b3 r14f1db0  
    2929/** @addtogroup icmp
    3030 *  @{
    31  */
    32 
    33 /** @file
    34  *  ICMP module interface.
    35  *  The same interface is used for standalone remote modules as well as for bundle modules.
    36  *  The standalone remote modules have to be compiled with the icmp_remote.c source file.
    37  *  The bundle modules with the icmp.c source file.
    3831 */
    3932
  • uspace/lib/net/include/il_interface.h

    r24ab58b3 r14f1db0  
    3232
    3333/** @file
    34  *  Internetwork layer module interface for the underlying network interface layer.
    35  *  This interface is always called by the standalone remote modules.
     34 * Internetwork layer module interface for the underlying network interface layer.
     35 * This interface is always called by the remote modules.
    3636 */
    3737
     
    5050
    5151/** @name Internetwork layer module interface
    52  *  This interface is used by other modules.
     52 * This interface is used by other modules.
    5353 */
    5454/*@{*/
    5555
    56 /** Notifies the internetwork layer modules about the device state change.
    57  *  @param[in] il_phone The internetwork layer module phone used for (semi)remote calls.
    58  *  @param[in] device_id The device identifier.
    59  *  @param[in] state The new device state.
    60  *  @param[in] target The target internetwork module service to be delivered to.
    61  *  @returns EOK on success.
     56/** Notify the internetwork layer modules about the device state change.
     57 *
     58 * @param[in] il_phone  The internetwork layer module phone used for
     59 *                      (semi)remote calls.
     60 * @param[in] device_id The device identifier.
     61 * @param[in] state     The new device state.
     62 * @param[in] target    The target internetwork module service to be
     63 *                      delivered to.
     64 *
     65 * @return EOK on success.
     66 *
    6267 */
    63 static inline int il_device_state_msg(int il_phone, device_id_t device_id, device_state_t state, services_t target){
    64         return generic_device_state_msg(il_phone, NET_IL_DEVICE_STATE, device_id, state, target);
     68static inline int il_device_state_msg(int il_phone, device_id_t device_id,
     69    device_state_t state, services_t target)
     70{
     71        return generic_device_state_msg_remote(il_phone, NET_IL_DEVICE_STATE,
     72            device_id, state, target);
    6573}
    6674
    67 /** Notifies the internetwork layer modules about the received packet/s.
    68  *  @param[in] il_phone The internetwork layer module phone used for (semi)remote calls.
    69  *  @param[in] device_id The device identifier.
    70  *  @param[in] packet The received packet or the received packet queue.
    71  *  @param[in] target The target internetwork module service to be delivered to.
    72  *  @returns EOK on success.
     75/** Notify the internetwork layer modules about the received packet/s.
     76 *
     77 * @param[in] il_phone  The internetwork layer module phone used for
     78 *                      (semi)remote calls.
     79 * @param[in] device_id The device identifier.
     80 * @param[in] packet    The received packet or the received packet queue.
     81 * @param[in] target    The target internetwork module service to be
     82 *                      delivered to.
     83 *
     84 * @return EOK on success.
     85 *
    7386 */
    74 inline static int il_received_msg(int il_phone, device_id_t device_id, packet_t packet, services_t target){
    75         return generic_received_msg(il_phone, NET_IL_RECEIVED, device_id, packet_get_id(packet), target, 0);
     87inline static int il_received_msg(int il_phone, device_id_t device_id,
     88    packet_t packet, services_t target)
     89{
     90        return generic_received_msg_remote(il_phone, NET_IL_RECEIVED, device_id,
     91            packet_get_id(packet), target, 0);
    7692}
    7793
    78 /** Notifies the internetwork layer modules about the mtu change.
    79  *  @param[in] il_phone The internetwork layer module phone used for (semi)remote calls.
    80  *  @param[in] device_id The device identifier.
    81  *  @param[in] mtu The new mtu value.
    82  *  @param[in] target The target internetwork module service to be delivered to.
    83  *  @returns EOK on success.
     94/** Notify the internetwork layer modules about the mtu change.
     95 *
     96 * @param[in] il_phone  The internetwork layer module phone used for
     97 *                      (semi)remote calls.
     98 * @param[in] device_id The device identifier.
     99 * @param[in] mtu       The new mtu value.
     100 * @param[in] target    The target internetwork module service to be
     101 *                      delivered to.
     102 *
     103 * @return EOK on success.
     104 *
    84105 */
    85 inline static int il_mtu_changed_msg(int il_phone, device_id_t device_id, size_t mtu, services_t target){
    86         return generic_device_state_msg(il_phone, NET_IL_MTU_CHANGED, device_id, (int) mtu, target);
     106inline static int il_mtu_changed_msg(int il_phone, device_id_t device_id,
     107    size_t mtu, services_t target)
     108{
     109        return generic_device_state_msg_remote(il_phone, NET_IL_MTU_CHANGED,
     110            device_id, (int) mtu, target);
    87111}
    88112
  • uspace/lib/net/include/il_local.h

    r24ab58b3 r14f1db0  
    2727 */
    2828
    29 /** @addtogroup il_standalone
     29/** @addtogroup il_local
    3030 *  @{
    3131 */
    3232
    33 #ifndef __IL_STANDALONE_H__
    34 #define __IL_STANDALONE_H__
     33#ifndef __IL_LOCAL_H__
     34#define __IL_LOCAL_H__
    3535
    3636#include <ipc/ipc.h>
    3737#include <async.h>
    3838
    39 extern int il_module_message(ipc_callid_t callid, ipc_call_t *call,
     39extern int il_module_message_standalone(ipc_callid_t callid, ipc_call_t *call,
    4040    ipc_call_t *answer, int *answer_count);
    41 extern int il_module_start(async_client_conn_t client_connection);
     41extern int il_module_start_standalone(async_client_conn_t client_connection);
    4242
    4343#endif
  • uspace/lib/net/include/il_messages.h

    r24ab58b3 r14f1db0  
    2828
    2929/** @addtogroup net_il
    30  *  @{
     30 * @{
    3131 */
    3232
    3333/** @file
    34  *  Internetwork layer modules messages.
    35  *  @see il_interface.h
    36  *  @see ip_interface.h
     34 * Internetwork layer modules messages.
     35 * @see il_interface.h
     36 * @see ip_interface.h
    3737 */
    3838
     
    7272
    7373/** @name Internetwork layer specific message parameters definitions
     74 *
    7475 */
    7576/*@{*/
    7677
    77 /** Returns the protocol number message parameter.
    78  *  @param[in] call The message call structure.
     78/** Return the protocol number message parameter.
     79 * @param[in] call The message call structure.
     80 *
    7981 */
    80 #define IL_GET_PROTO(call)              (int) IPC_GET_ARG1(*call)
     82#define IL_GET_PROTO(call)  (int) IPC_GET_ARG1(*call)
    8183
    82 /** Returns the registering service message parameter.
    83  *  @param[in] call The message call structure.
     84/** Return the registering service message parameter.
     85 * @param[in] call The message call structure.
     86 *
    8487 */
    85 #define IL_GET_SERVICE(call)    (services_t) IPC_GET_ARG2(*call)
     88#define IL_GET_SERVICE(call)  (services_t) IPC_GET_ARG2(*call)
    8689
    8790/*@}*/
  • uspace/lib/net/include/ip_client.h

    r24ab58b3 r14f1db0  
    8787 *  @returns EINVAL if the headerlen parameter is not IPv4 pseudo header length.
    8888 */
    89 extern int ip_client_set_pseudo_header_data_length(ip_pseudo_header_ref header, size_t headerlen, size_t data_length);
     89extern int ip_client_set_pseudo_header_data_length(void *header, size_t headerlen, size_t data_length);
    9090
    9191/** Constructs the IPv4 pseudo header.
     
    107107 *  @returns ENOMEM if there is not enough memory left.
    108108 */
    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, ip_pseudo_header_ref * header, size_t * headerlen);
     109extern 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);
    110110
    111111// TODO ipopt manipulation
  • uspace/lib/net/include/ip_interface.h

    r24ab58b3 r14f1db0  
    3131 */
    3232
    33 /** @file
    34  *  IP module interface.
    35  *  The same interface is used for standalone remote modules as well as for bundle modules.
    36  *  The standalone remote modules have to be compiled with the ip_remote.c source file.
    37  *  The bundle modules with the ip.c source file.
    38  */
    39 
    4033#ifndef __NET_IP_INTERFACE_H__
    4134#define __NET_IP_INTERFACE_H__
     
    5144#include <socket_codes.h>
    5245
     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
     59
     60#include <ip_remote.h>
     61
     62#define ip_received_error_msg  ip_received_error_msg_remote
     63#define ip_set_gateway_req     ip_set_gateway_req_remote
     64#define ip_packet_size_req     ip_packet_size_req_remote
     65#define ip_device_req          ip_device_req_remote
     66#define ip_add_route_req       ip_add_route_req_remote
     67#define ip_send_msg            ip_send_msg_remote
     68#define ip_get_route_req       ip_get_route_req_remote
     69
     70#endif
     71
    5372/** @name IP module interface
    5473 *  This interface is used by other modules.
    5574 */
    5675/*@{*/
    57 
    58 /** Type definition of the internet pseudo header pointer.
    59  */
    60 typedef void *          ip_pseudo_header_ref;
    6176
    6277/** The transport layer notification function type definition.
     
    8297extern int ip_bind_service(services_t service, int protocol, services_t me, async_client_conn_t receiver, tl_received_msg_t tl_received_msg);
    8398
    84 /** Registers the new device.
    85  *  Registers itself as the ip packet receiver.
    86  *  If the device uses ARP registers also the new ARP device.
    87  *  @param[in] ip_phone The IP module phone used for (semi)remote calls.
    88  *  @param[in] device_id The new device identifier.
    89  *  @param[in] netif The underlying device network interface layer service.
    90  *  @returns EOK on success.
    91  *  @returns ENOMEM if there is not enough memory left.
    92  *  @returns EINVAL if the device configuration is invalid.
    93  *  @returns ENOTSUP if the device uses IPv6.
    94  *  @returns ENOTSUP if the device uses DHCP.
    95  *  @returns Other error codes as defined for the net_get_device_conf_req() function.
    96  *  @returns Other error codes as defined for the arp_device_req() function.
    97  */
    98 extern int ip_device_req(int, device_id_t, services_t);
    99 
    100 /** Sends the packet queue.
    101  *  The packets may get fragmented if needed.
    102  *  @param[in] ip_phone The IP module phone used for (semi)remote calls.
    103  *  @param[in] device_id The device identifier.
    104  *  @param[in] packet The packet fragments as a~packet queue. All the packets have to have the same destination address.
    105  *  @param[in] sender The sending module service.
    106  *  @param[in] error The packet error reporting service. Prefixes the received packet.
    107  *  @returns EOK on success.
    108  *  @returns Other error codes as defined for the generic_send_msg() function.
    109  */
    110 extern int ip_send_msg(int ip_phone, device_id_t device_id, packet_t packet, services_t sender, services_t error);
    111 
    11299/** Connects to the IP module.
    113100 *  @param service The IP module service. Ignored parameter.
     
    117104extern int ip_connect_module(services_t service);
    118105
    119 /** Adds a route to the device routing table.
    120  *  The target network is routed using this device.
    121  *  @param[in] ip_phone The IP module phone used for (semi)remote calls.
    122  *  @param[in] device_id The device identifier.
    123  *  @param[in] address The target network address.
    124  *  @param[in] netmask The target network mask.
    125  *  @param[in] gateway The target network gateway. Not used if zero.
    126  */
    127 extern int ip_add_route_req(int ip_phone, device_id_t device_id, in_addr_t address, in_addr_t netmask, in_addr_t gateway);
    128 
    129 /** Sets the default gateway.
    130  *  This gateway is used if no other route is found.
    131  *  @param[in] ip_phone The IP module phone used for (semi)remote calls.
    132  *  @param[in] device_id The device identifier.
    133  *  @param[in] gateway The default gateway.
    134  */
    135 extern int ip_set_gateway_req(int ip_phone, device_id_t device_id, in_addr_t gateway);
    136 
    137 /** Returns the device packet dimension for sending.
    138  *  @param[in] ip_phone The IP module phone used for (semi)remote calls.
    139  *  @param[in] device_id The device identifier.
    140  *  @param[out] packet_dimension The packet dimension.
    141  *  @returns EOK on success.
    142  *  @returns ENOENT if there is no such device.
    143  *  @returns Other error codes as defined for the generic_packet_size_req() function.
    144  */
    145 extern int ip_packet_size_req(int ip_phone, device_id_t device_id, packet_dimension_ref packet_dimension);
    146 
    147 /** Notifies the IP module about the received error notification packet.
    148  *  @param[in] ip_phone The IP module phone used for (semi)remote calls.
    149  *  @param[in] device_id The device identifier.
    150  *  @param[in] packet The received packet or the received packet queue.
    151  *  @param[in] target The target internetwork module service to be delivered to.
    152  *  @param[in] error The packet error reporting service. Prefixes the received packet.
    153  *  @returns EOK on success.
    154  */
    155 extern int ip_received_error_msg(int ip_phone, device_id_t device_id, packet_t packet, services_t target, services_t error);
    156 
    157 /** Returns the device identifier and the IP pseudo header based on the destination address.
    158  *  @param[in] ip_phone The IP module phone used for (semi)remote calls.
    159  *  @param[in] protocol The transport protocol.
    160  *  @param[in] destination The destination address.
    161  *  @param[in] addrlen The destination address length.
    162  *  @param[out] device_id The device identifier.
    163  *  @param[out] header The constructed IP pseudo header.
    164  *  @param[out] headerlen The IP pseudo header length.
    165  */
    166 extern int ip_get_route_req(int ip_phone, ip_protocol_t protocol, const struct sockaddr * destination, socklen_t addrlen, device_id_t * device_id, ip_pseudo_header_ref * header, size_t * headerlen);
    167 
    168106/*@}*/
    169107
  • uspace/lib/net/include/net_interface.h

    r24ab58b3 r14f1db0  
    2929/** @addtogroup net
    3030 *  @{
    31  */
    32 
    33 /** @file
    34  *  Networking module interface.
    35  *  The same interface is used for standalone remote modules as well as for bundle modules.
    36  *  The standalone remote modules have to be compiled with the net_remote.c source file.
    37  *  The bundle networking module is compiled with the net_bundle.c source file and the choosen bundle module implementation source files.
    3831 */
    3932
  • uspace/lib/net/include/netif_interface.h

    r24ab58b3 r14f1db0  
    2828
    2929/** @addtogroup netif
    30  *  @{
    31  */
    32 
    33 /** @file
    34  *  Network interface module interface.
    35  *  The same interface is used for standalone remote modules as well as for bundle network interface layer modules.
    36  *  The standalone remote modules have to be compiled with the netif_remote.c source file.
    37  *  The bundle network interface layer modules are compiled with the netif_nil_bundle.c source file and the choosen network interface layer implementation source file.
     30 * @{
    3831 */
    3932
     
    4134#define __NET_NETIF_INTERFACE_H__
    4235
    43 #include <ipc/services.h>
     36#ifdef CONFIG_NETIF_NIL_BUNDLE
    4437
    45 #include <net_messages.h>
    46 #include <adt/measured_strings.h>
    47 #include <packet/packet.h>
    48 #include <net_device.h>
     38#include <netif_local.h>
     39#include <netif_nil_bundle.h>
     40#include <packet/packet_server.h>
    4941
    50 /** @name Network interface module interface
    51  *  This interface is used by other modules.
    52  */
    53 /*@{*/
     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
    5451
    55 /** Returns the device local hardware address.
    56  *  @param[in] netif_phone The network interface phone.
    57  *  @param[in] device_id The device identifier.
    58  *  @param[out] address The device local hardware address.
    59  *  @param[out] data The address data.
    60  *  @returns EOK on success.
    61  *  @returns EBADMEM if the address parameter is NULL.
    62  *  @returns ENOENT if there no such device.
    63  *  @returns Other error codes as defined for the netif_get_addr_message() function.
    64  */
    65 extern int netif_get_addr_req(int netif_phone, device_id_t device_id, measured_string_ref * address, char ** data);
     52#else /* CONFIG_NETIF_NIL_BUNDLE */
    6653
    67 /** Probes the existence of the device.
    68  *  @param[in] netif_phone The network interface phone.
    69  *  @param[in] device_id The device identifier.
    70  *  @param[in] irq The device interrupt number.
    71  *  @param[in] io The device input/output address.
    72  *  @returns EOK on success.
    73  *  @returns Other errro codes as defined for the netif_probe_message().
    74  */
    75 extern int netif_probe_req(int netif_phone, device_id_t device_id, int irq, int io);
     54#include <netif_remote.h>
     55#include <packet/packet_client.h>
    7656
    77 /** Sends the packet queue.
    78  *  @param[in] netif_phone The network interface phone.
    79  *  @param[in] device_id The device identifier.
    80  *  @param[in] packet The packet queue.
    81  *  @param[in] sender The sending module service.
    82  *  @returns EOK on success.
    83  *  @returns Other error codes as defined for the generic_send_msg() function.
    84  */
    85 extern int netif_send_msg(int netif_phone, device_id_t device_id, packet_t packet, services_t sender);
     57#define netif_module_message    netif_module_message_standalone
     58#define netif_module_start      netif_module_start_standalone
     59#define netif_get_addr_req      netif_get_addr_req_remote
     60#define netif_probe_req         netif_probe_req_remote
     61#define netif_send_msg          netif_send_msg_remote
     62#define netif_start_req         netif_start_req_remote
     63#define netif_stop_req          netif_stop_req_remote
     64#define netif_stats_req         netif_stats_req_remote
     65#define netif_bind_service      netif_bind_service_remote
    8666
    87 /** Starts the device.
    88  *  @param[in] netif_phone The network interface phone.
    89  *  @param[in] device_id The device identifier.
    90  *  @returns EOK on success.
    91  *  @returns Other error codes as defined for the find_device() function.
    92  *  @returns Other error codes as defined for the netif_start_message() function.
    93  */
    94 extern int netif_start_req(int netif_phone, device_id_t device_id);
    95 
    96 /** Stops the device.
    97  *  @param[in] netif_phone The network interface phone.
    98  *  @param[in] device_id The device identifier.
    99  *  @returns EOK on success.
    100  *  @returns Other error codes as defined for the find_device() function.
    101  *  @returns Other error codes as defined for the netif_stop_message() function.
    102  */
    103 extern int netif_stop_req(int netif_phone, device_id_t device_id);
    104 
    105 /** Returns the device usage statistics.
    106  *  @param[in] netif_phone The network interface phone.
    107  *  @param[in] device_id The device identifier.
    108  *  @param[out] stats The device usage statistics.
    109  *  @returns EOK on success.
    110  */
    111 extern int netif_stats_req(int netif_phone, device_id_t device_id, device_stats_ref stats);
    112 
    113 /** Creates bidirectional connection with the network interface module and registers the message receiver.
    114  *  @param[in] service The network interface module service.
    115  *  @param[in] device_id The device identifier.
    116  *  @param[in] me The requesting module service.
    117  *  @param[in] receiver The message receiver.
    118  *  @returns The phone of the needed service.
    119  *  @returns EOK on success.
    120  *  @returns Other error codes as defined for the bind_service() function.
    121  */
    122 extern int netif_bind_service(services_t service, device_id_t device_id, services_t me, async_client_conn_t receiver);
    123 
    124 /*@}*/
     67#endif /* CONFIG_NETIF_NIL_BUNDLE */
    12568
    12669#endif
  • uspace/lib/net/include/netif_messages.h

    r24ab58b3 r14f1db0  
    2828
    2929/** @addtogroup netif
    30  *  @{
     30 * @{
    3131 */
    3232
    3333/** @file
    34  *  Network interface common module messages.
    35  *  @see netif_interface.h
     34 * Network interface common module messages.
    3635 */
    3736
     
    7675/*@{*/
    7776
    78 /** Returns the interrupt number message parameter.
    79  *  @param[in] call The message call structure.
     77/** Return the interrupt number message parameter.
     78 * @param[in] call The message call structure.
    8079 */
    8180#define NETIF_GET_IRQ(call) \
    8281        ({int irq = (int) IPC_GET_ARG2(*call); irq;})
    8382
    84 /** Returns the input/output address message parameter.
    85  *  @param[in] call The message call structure.
     83/** Return the input/output address message parameter.
     84 * @param[in] call The message call structure.
    8685 */
    8786#define NETIF_GET_IO(call) \
  • uspace/lib/net/include/nil_interface.h

    r24ab58b3 r14f1db0  
    3131 */
    3232
    33 /** @file
    34  *  Network interface layer module interface.
    35  *  The same interface is used for standalone remote device modules as well as for bundle device modules.
    36  *  The standalone remote device modules have to be compiled with the nil_remote.c source file.
    37  *  The bundle device modules with the appropriate network interface layer source file (eth.c etc.).
    38  *  The upper layers cannot be bundled with the network interface layer.
    39  */
    40 
    4133#ifndef __NET_NIL_INTERFACE_H__
    4234#define __NET_NIL_INTERFACE_H__
     
    5345#include <net_device.h>
    5446
    55 /** @name Network interface layer module interface
    56  *  This interface is used by other modules.
    57  */
    58 /*@{*/
     47#define nil_bind_service(service, device_id, me, receiver) \
     48        bind_service(service, device_id, me, 0, receiver)
    5949
    60 /** Returns the device local hardware address.
    61  *  @param[in] nil_phone The network interface layer phone.
    62  *  @param[in] device_id The device identifier.
    63  *  @param[out] address The device local hardware address.
    64  *  @param[out] data The address data.
    65  *  @returns EOK on success.
    66  *  @returns EBADMEM if the address parameter and/or the data parameter is NULL.
    67  *  @returns ENOENT if there no such device.
    68  *  @returns Other error codes as defined for the generic_get_addr_req() function.
    69  */
    70 #define nil_get_addr_req(nil_phone, device_id, address, data)   \
     50#define nil_packet_size_req(nil_phone, device_id, packet_dimension) \
     51        generic_packet_size_req_remote(nil_phone, NET_NIL_PACKET_SPACE, device_id, \
     52            packet_dimension)
     53
     54#define nil_get_addr_req(nil_phone, device_id, address, data) \
    7155        generic_get_addr_req(nil_phone, NET_NIL_ADDR, device_id, address, data)
    7256
    73 /** Returns the device broadcast hardware address.
    74  *  @param[in] nil_phone The network interface layer phone.
    75  *  @param[in] device_id The device identifier.
    76  *  @param[out] address The device broadcast hardware address.
    77  *  @param[out] data The address data.
    78  *  @returns EOK on success.
    79  *  @returns EBADMEM if the address parameter is NULL.
    80  *  @returns ENOENT if there no such device.
    81  *  @returns Other error codes as defined for the generic_get_addr_req() function.
    82  */
    83 #define nil_get_broadcast_addr_req(nil_phone, device_id, address, data) \
    84         generic_get_addr_req(nil_phone, NET_NIL_BROADCAST_ADDR, device_id, address, data)
     57#define nil_get_broadcast_addr_req(nil_phone, device_id, address, data) \
     58        generic_get_addr_req(nil_phone, NET_NIL_BROADCAST_ADDR, device_id, \
     59            address, data)
    8560
    86 /** Sends the packet queue.
    87  *  @param[in] nil_phone The network interface layer phone.
    88  *  @param[in] device_id The device identifier.
    89  *  @param[in] packet The packet queue.
    90  *  @param[in] sender The sending module service.
    91  *  @returns EOK on success.
    92  *  @returns Other error codes as defined for the generic_send_msg() function.
    93  */
    94 #define nil_send_msg(nil_phone, device_id, packet, sender)      \
    95         generic_send_msg(nil_phone, NET_NIL_SEND, device_id, packet_get_id(packet), sender, 0)
     61#define nil_send_msg(nil_phone, device_id, packet, sender) \
     62        generic_send_msg_remote(nil_phone, NET_NIL_SEND, device_id, \
     63            packet_get_id(packet), sender, 0)
    9664
    97 /** Returns the device packet dimension for sending.
    98  *  @param[in] nil_phone The network interface layer phone.
    99  *  @param[in] device_id The device identifier.
    100  *  @param[out] packet_dimension The packet dimensions.
    101  *  @returns EOK on success.
    102  *  @returns ENOENT if there is no such device.
    103  *  @returns Other error codes as defined for the generic_packet_size_req() function.
    104  */
    105 #define nil_packet_size_req(nil_phone, device_id, packet_dimension)     \
    106         generic_packet_size_req(nil_phone, NET_NIL_PACKET_SPACE, device_id, packet_dimension)
     65#define nil_device_req(nil_phone, device_id, mtu, netif_service) \
     66        generic_device_req_remote(nil_phone, NET_NIL_DEVICE, device_id, mtu, \
     67            netif_service)
    10768
    108 /** Registers new device or updates the MTU of an existing one.
    109  *  @param[in] nil_phone The network interface layer phone.
    110  *  @param[in] device_id The new device identifier.
    111  *  @param[in] mtu The device maximum transmission unit.
    112  *  @param[in] netif_service The device driver service.
    113  *  @returns EOK on success.
    114  *  @returns EEXIST if the device with the different service exists.
    115  *  @returns ENOMEM if there is not enough memory left.
    116  *  @returns Other error codes as defined for the generic_device_req() function.
    117  */
    118 #define nil_device_req(nil_phone, device_id, mtu, netif_service)        \
    119         generic_device_req(nil_phone, NET_NIL_DEVICE, device_id, mtu, netif_service)
    12069
    121 /** Notifies the network interface layer about the device state change.
    122  *  @param[in] nil_phone The network interface layer phone.
    123  *  @param[in] device_id The device identifier.
    124  *  @param[in] state The new device state.
    125  *  @returns EOK on success.
    126  *  @returns Other error codes as defined for each specific module device state function.
    127  */
    128 extern int nil_device_state_msg(int nil_phone, device_id_t device_id, int state);
     70#ifdef CONFIG_NETIF_NIL_BUNDLE
    12971
    130 /** Passes the packet queue to the network interface layer.
    131  *  Processes and redistributes the received packet queue to the registered upper layers.
    132  *  @param[in] nil_phone The network interface layer phone.
    133  *  @param[in] device_id The source device identifier.
    134  *  @param[in] packet The received packet or the received packet queue.
    135  *  @param target The target service. Ignored parameter.
    136  *  @returns EOK on success.
    137  *  @returns Other error codes as defined for each specific module received function.
    138  */
    139 extern int nil_received_msg(int nil_phone, device_id_t device_id, packet_t packet, services_t target);
     72#include <nil_local.h>
     73#include <packet/packet_server.h>
    14074
    141 /** Creates bidirectional connection with the network interface layer module and registers the message receiver.
    142  *  @param[in] service The network interface layer module service.
    143  *  @param[in] device_id The device identifier.
    144  *  @param[in] me The requesting module service.
    145  *  @param[in] receiver The message receiver.
    146  *  @returns The phone of the needed service.
    147  *  @returns EOK on success.
    148  *  @returns Other error codes as defined for the bind_service() function.
    149  */
    150 #define nil_bind_service(service, device_id, me, receiver)      \
    151         bind_service(service, device_id, me, 0, receiver);
    152 /*@}*/
     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
     83#define nil_device_state_msg  nil_device_state_msg_remote
     84#define nil_received_msg      nil_received_msg_remote
     85
     86#endif /* CONFIG_NETIF_NIL_BUNDLE */
    15387
    15488#endif
  • uspace/lib/net/include/nil_local.h

    r24ab58b3 r14f1db0  
    3232
    3333/** @file
    34  *  Network interface layer modules common skeleton.
    35  *  All network interface layer modules have to implement this interface.
     34 * Network interface layer modules common skeleton.
     35 * All network interface layer modules have to implement this interface.
    3636 */
    3737
    38 #ifndef __NET_NIL_MODULE_H__
    39 #define __NET_NIL_MODULE_H__
     38#ifndef __NET_NIL_LOCAL_H__
     39#define __NET_NIL_LOCAL_H__
    4040
    4141#include <ipc/ipc.h>
     
    5252 */
    5353extern int nil_initialize(int);
     54
     55extern int nil_device_state_msg_local(int, device_id_t, int);
     56extern int nil_received_msg_local(int, device_id_t, packet_t, services_t);
    5457
    5558/** Message processing function.
     
    7174 *
    7275 */
    73 extern int nil_message(const char *, ipc_callid_t, ipc_call_t *, ipc_call_t *,
     76extern int nil_message_standalone(const char *, ipc_callid_t, ipc_call_t *, ipc_call_t *,
    7477    int *);
     78
     79extern int nil_module_message_standalone(const char *, ipc_callid_t,
     80    ipc_call_t *, ipc_call_t *, int *);
     81extern int nil_module_start_standalone(async_client_conn_t);
    7582
    7683#endif
  • uspace/lib/net/include/nil_messages.h

    r24ab58b3 r14f1db0  
    2828
    2929/** @addtogroup net_nil
    30  *  @{
     30 * @{
    3131 */
    3232
    3333/** @file
    34  *  Network interface layer module messages.
    35  *  @see nil_interface.h
     34 * Network interface layer module messages.
    3635 */
    3736
     
    4342#include <net_messages.h>
    4443
    45 /**  Network interface layer module messages.
     44/** Network interface layer module messages.
    4645 */
    4746typedef enum {
     
    8079/*@{*/
    8180
    82 /** Returns the protocol service message parameter.
     81/** Return the protocol service message parameter.
    8382 */
    8483#define NIL_GET_PROTO(call) \
  • uspace/lib/net/include/nil_remote.h

    r24ab58b3 r14f1db0  
    11/*
    2  * Copyright (c) 2010 Martin Decky
     2 * Copyright (c) 2009 Lukas Mejdrech
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup netif_standalone
    30  *  @{
     29/** @addtogroup netif
     30 * @{
    3131 */
    3232
    33 #ifndef __NETIF_STANDALONE_H__
    34 #define __NETIF_STANDALONE_H__
     33#ifndef __NET_NIL_REMOTE_H__
     34#define __NET_NIL_REMOTE_H__
    3535
     36#include <async.h>
     37#include <fibril_synch.h>
    3638#include <ipc/ipc.h>
    37 #include <async.h>
    3839
    39 extern int netif_module_message(const char *, ipc_callid_t, ipc_call_t *,
    40     ipc_call_t *, int *);
    41 extern int netif_module_start(async_client_conn_t);
     40extern int nil_device_state_msg_remote(int, device_id_t, int);
     41extern int nil_received_msg_remote(int, device_id_t, packet_t, services_t);
    4242
    4343#endif
  • uspace/lib/net/include/packet_remote.h

    r24ab58b3 r14f1db0  
    11/*
    2  * Copyright (c) 2010 Martin Decky
     2 * Copyright (c) 2009 Lukas Mejdrech
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup tl_standalone
    30  *  @{
     29/** @addtogroup packet
     30 * @{
    3131 */
    3232
    33 #ifndef __TL_STANDALONE_H__
    34 #define __TL_STANDALONE_H__
     33#ifndef __NET_PACKET_REMOTE_H__
     34#define __NET_PACKET_REMOTE_H__
    3535
    36 #include <ipc/ipc.h>
    37 #include <async.h>
     36#include <packet/packet.h>
    3837
    39 extern int tl_module_message(ipc_callid_t callid, ipc_call_t *call,
    40     ipc_call_t *answer, int *answer_count);
    41 extern int tl_module_start(async_client_conn_t client_connection);
     38extern int packet_translate_remote(int, packet_ref, packet_id_t);
     39extern packet_t packet_get_4_remote(int, size_t, size_t, size_t, size_t);
     40extern packet_t packet_get_1_remote(int, size_t);
     41extern void pq_release_remote(int, packet_id_t);
    4242
    4343#endif
  • uspace/lib/net/include/tl_common.h

    r24ab58b3 r14f1db0  
    4949DEVICE_MAP_DECLARE(packet_dimensions, packet_dimension_t);
    5050
     51extern int tl_get_ip_packet_dimension(int, packet_dimensions_ref,
     52    device_id_t, packet_dimension_ref *);
     53
    5154/** Gets the address port.
    5255 *  Supports AF_INET and AF_INET6 address families.
     
    5962 */
    6063extern int tl_get_address_port(const struct sockaddr * addr, int addrlen, uint16_t * port);
    61 
    62 /** Gets IP packet dimensions.
    63  *  Tries to search a cache and queries the IP module if not found.
    64  *  The reply is cached then.
    65  *  @param[in] ip_phone The IP moduel phone for (semi)remote calls.
    66  *  @param[in] packet_dimensions The packet dimensions cache.
    67  *  @param[in] device_id The device identifier.
    68  *  @param[out] packet_dimension The IP packet dimensions.
    69  *  @returns EOK on success.
    70  *  @returns EBADMEM if the packet_dimension parameter is NULL.
    71  *  @return ENOMEM if there is not enough memory left.
    72  *  @returns EINVAL if the packet_dimensions cache is not valid.
    73  *  @returns Other codes as defined for the ip_packet_size_req() function.
    74  */
    75 extern int tl_get_ip_packet_dimension(int ip_phone, packet_dimensions_ref packet_dimensions, device_id_t device_id, packet_dimension_ref * packet_dimension);
    7664
    7765/** Updates IP device packet dimensions cache.
  • uspace/lib/net/include/tl_interface.h

    r24ab58b3 r14f1db0  
    3232
    3333/** @file
    34  *  Transport layer module interface for the underlying internetwork layer.
     34 * Transport layer module interface for the underlying internetwork layer.
    3535 */
    3636
     
    4848
    4949/** @name Transport layer module interface
    50  *  This interface is used by other modules.
     50 * This interface is used by other modules.
    5151 */
    5252/*@{*/
    5353
    54 /** Notifies the remote transport layer modules about the received packet/s.
    55  *  @param[in] tl_phone The transport layer module phone used for remote calls.
    56  *  @param[in] device_id The device identifier.
    57  *  @param[in] packet The received packet or the received packet queue. The packet queue is used to carry a~fragmented datagram. The first packet contains the headers, the others contain only data.
    58  *  @param[in] target The target transport layer module service to be delivered to.
    59  *  @param[in] error The packet error reporting service. Prefixes the received packet.
    60  *  @returns EOK on success.
     54/** Notify the remote transport layer modules about the received packet/s.
     55 *
     56 * @param[in] tl_phone  The transport layer module phone used for remote calls.
     57 * @param[in] device_id The device identifier.
     58 * @param[in] packet    The received packet or the received packet queue.
     59 *                      The packet queue is used to carry a fragmented
     60 *                      datagram. The first packet contains the headers,
     61 *                      the others contain only data.
     62 * @param[in] target    The target transport layer module service to be
     63 *                      delivered to.
     64 * @param[in] error     The packet error reporting service. Prefixes the
     65 *                      received packet.
     66 *
     67 * @return EOK on success.
     68 *
    6169 */
    62 inline static int tl_received_msg(int tl_phone, device_id_t device_id, packet_t packet, services_t target, services_t error){
    63         return generic_received_msg(tl_phone, NET_TL_RECEIVED, device_id, packet_get_id(packet), target, error);
     70inline static int tl_received_msg(int tl_phone, device_id_t device_id,
     71    packet_t packet, services_t target, services_t error)
     72{
     73        return generic_received_msg_remote(tl_phone, NET_TL_RECEIVED, device_id,
     74            packet_get_id(packet), target, error);
    6475}
    6576
  • uspace/lib/net/include/tl_local.h

    r24ab58b3 r14f1db0  
    2727 */
    2828
    29 /** @addtogroup nil_standalone
     29/** @addtogroup tl_local
    3030 *  @{
    3131 */
    3232
    33 #ifndef __NIL_STANDALONE_H__
    34 #define __NIL_STANDALONE_H__
     33#ifndef __TL_LOCAL_H__
     34#define __TL_LOCAL_H__
    3535
    3636#include <ipc/ipc.h>
    3737#include <async.h>
    3838
    39 extern int nil_module_message(const char *, ipc_callid_t, ipc_call_t *,
     39extern int tl_module_message_standalone(ipc_callid_t, ipc_call_t *,
    4040    ipc_call_t *, int *);
    41 extern int nil_module_start(async_client_conn_t);
     41extern int tl_module_start_standalone(async_client_conn_t);
    4242
    4343#endif
Note: See TracChangeset for help on using the changeset viewer.