Changeset 774e6d1a in mainline


Ignore:
Timestamp:
2011-01-09T23:24:53Z (13 years ago)
Author:
martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
4b86dac
Parents:
3c106e88
Message:

partial networking stack overhaul

  • a lot of coding style changes (comments, indentation, etc.)
  • convert several ints to unsigned ints or size_t values
  • streamline many of the IPC-related macros (they no longer dereference the call structure by themselves)
  • get rid of netif_interface.h (containing only aliases for remote functions and not serving any purpose)
  • rename netif_local.{c|h} to netif_skel.{c|h} (it is really just a skeleton)
  • drop the "_remote" and "_standalone" suffixes from most of the netif_ functions (they do not serve any purpose anymore)
  • implement netif_client_connection() as a common framework function for all netif modules
    • update the lo module accordingly
  • ip module now reports the default gateway to the user whenever it is being set
Location:
uspace
Files:
1 deleted
44 edited
2 moved

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/net/modules.c

    r3c106e88 r774e6d1a  
    3232
    3333/** @file
    34  * Generic module functions implementation. 
     34 * Generic module functions implementation.
    3535 *
    3636 * @todo MAKE IT POSSIBLE TO REMOVE THIS FILE VIA EITHER REPLACING PART OF ITS
     
    5252#define MODULE_WAIT_TIME        (10 * 1000)
    5353
    54 /** Answers the call.
    55  *
    56  * @param[in] callid    The call identifier.
    57  * @param[in] result    The message processing result.
    58  * @param[in] answer    The message processing answer.
    59  * @param[in] answer_count The number of answer parameters.
    60  */
    61 void
    62 answer_call(ipc_callid_t callid, int result, ipc_call_t *answer,
    63     int answer_count)
    64 {
    65         /* Choose the most efficient answer function */
    66         if (answer || (!answer_count)) {
    67                 switch (answer_count) {
     54/** Answer a call.
     55 *
     56 * @param[in] callid Call identifier.
     57 * @param[in] result Message processing result.
     58 * @param[in] answer Message processing answer.
     59 * @param[in] count  Number of answer parameters.
     60 *
     61 */
     62void answer_call(ipc_callid_t callid, int result, ipc_call_t *answer,
     63    size_t count)
     64{
     65        /* Choose the most efficient function */
     66        if ((answer != NULL) || (count == 0)) {
     67                switch (count) {
    6868                case 0:
    6969                        ipc_answer_0(callid, (sysarg_t) result);
     
    228228}
    229229
    230 /** Refreshes answer structure and parameters count.
    231  *
    232  * Erases all attributes.
    233  *
    234  * @param[in,out] answer The message processing answer structure.
    235  * @param[in,out] answer_count The number of answer parameters.
    236  */
    237 void refresh_answer(ipc_call_t *answer, int *answer_count)
    238 {
    239         if (answer_count)
    240                 *answer_count = 0;
    241 
    242         if (answer) {
     230/** Refresh answer structure and argument count.
     231 *
     232 * Erase all arguments.
     233 *
     234 * @param[in,out] answer Message processing answer structure.
     235 * @param[in,out] count  Number of answer arguments.
     236 *
     237 */
     238void refresh_answer(ipc_call_t *answer, size_t *count)
     239{
     240        if (count != NULL)
     241                *count = 0;
     242       
     243        if (answer != NULL) {
    243244                IPC_SET_RETVAL(*answer, 0);
    244                 /* Just to be precise */
    245245                IPC_SET_IMETHOD(*answer, 0);
    246246                IPC_SET_ARG1(*answer, 0);
  • uspace/lib/c/include/ipc/arp.h

    r3c106e88 r774e6d1a  
    6969/*@{*/
    7070
    71 /** Returns the protocol service message parameter.
    72  * @param[in] call The message call structure.
     71/** Return the protocol service message parameter.
     72 *
     73 * @param[in] call Message call structure.
     74 *
    7375 */
    74 #define ARP_GET_NETIF(call) \
    75         ({ \
    76                 services_t service = (services_t) IPC_GET_ARG2(*call); \
    77                 service; \
    78         })
     76#define ARP_GET_NETIF(call) ((services_t) IPC_GET_ARG2(call))
    7977
    8078/*@}*/
  • uspace/lib/c/include/ipc/icmp.h

    r3c106e88 r774e6d1a  
    8282/*@{*/
    8383
    84 /** Returns the ICMP code message parameter.
     84/** Return the ICMP code message parameter.
    8585 *
    86  * @param[in] call      The message call structure.
     86 * @param[in] call Message call structure.
     87 *
    8788 */
    88 #define ICMP_GET_CODE(call) \
    89         ({ \
    90                 icmp_code_t code = (icmp_code_t) IPC_GET_ARG1(*call); \
    91                 code; \
    92         })
     89#define ICMP_GET_CODE(call)  ((icmp_code_t) IPC_GET_ARG1(call))
    9390
    94 /** Returns the ICMP link MTU message parameter.
     91/** Return the ICMP link MTU message parameter.
    9592 *
    96  * @param[in] call      The message call structure.
     93 * @param[in] call Message call structure.
     94 *
    9795 */
    98 #define ICMP_GET_MTU(call) \
    99         ({ \
    100                 icmp_param_t mtu = (icmp_param_t) IPC_GET_ARG3(*call); \
    101                 mtu; \
    102         })
     96#define ICMP_GET_MTU(call)  ((icmp_param_t) IPC_GET_ARG3(call))
    10397
    104 /** Returns the pointer message parameter.
     98/** Return the pointer message parameter.
    10599 *
    106  * @param[in] call      The message call structure.
     100 * @param[in] call Message call structure.
     101 *
    107102 */
    108 #define ICMP_GET_POINTER(call) \
    109         ({ \
    110                 icmp_param_t pointer = (icmp_param_t) IPC_GET_ARG3(*call); \
    111                 pointer; \
    112         })
     103#define ICMP_GET_POINTER(call)  ((icmp_param_t) IPC_GET_ARG3(call))
    113104
    114 /** Returns the size message parameter.
     105/** Return the size message parameter.
    115106 *
    116  * @param[in] call      The message call structure.
     107 * @param[in] call Message call structure.
     108 *
    117109 */
    118 #define ICMP_GET_SIZE(call) \
    119         ({ \
    120                 size_t size = (size_t) IPC_GET_ARG1(call); \
    121                 size; \
    122         })
     110#define ICMP_GET_SIZE(call)  ((size_t) IPC_GET_ARG1(call))
    123111
    124 /** Returns the timeout message parameter.
     112/** Return the timeout message parameter.
    125113 *
    126  * @param[in] call      The message call structure.
     114 * @param[in] call Message call structure.
     115 *
    127116 */
    128 #define ICMP_GET_TIMEOUT(call) \
    129         ({ \
    130                 suseconds_t timeout = (suseconds_t) IPC_GET_ARG2(call); \
    131                 timeout; \
    132         })
     117#define ICMP_GET_TIMEOUT(call)  ((suseconds_t) IPC_GET_ARG2(call))
    133118
    134 /** Returns the time to live message parameter.
     119/** Return the time to live message parameter.
    135120 *
    136  * @param[in] call      The message call structure.
     121 * @param[in] call Message call structure.
     122 *
    137123 */
    138 #define ICMP_GET_TTL(call) \
    139         ({ \
    140                 ip_ttl_t ttl = (ip_ttl_t) IPC_GET_ARG3(call); \
    141                 ttl; \
    142         })
     124#define ICMP_GET_TTL(call)  ((ip_ttl_t) IPC_GET_ARG3(call))
    143125
    144 /** Returns the type of service message parameter.
     126/** Return the type of service message parameter.
    145127 *
    146  * @param[in] call      The message call structure.
     128 * @param[in] call Message call structure.
     129 *
    147130 */
    148 #define ICMP_GET_TOS(call) \
    149         ({ \
    150                 ip_tos_t tos = (ip_tos_t) IPC_GET_ARG4(call); \
    151                 tos; \
    152         })
     131#define ICMP_GET_TOS(call)  ((ip_tos_t) IPC_GET_ARG4(call))
    153132
    154 /** Returns the dont fragment message parameter.
     133/** Return the dont fragment message parameter.
    155134 *
    156  * @param[in] call      The message call structure.
     135 * @param[in] call Message call structure.
    157136 */
    158 #define ICMP_GET_DONT_FRAGMENT(call) \
    159         ({ \
    160                 int dont_fragment = (int) IPC_GET_ARG5(call); \
    161                 dont_fragment; \
    162         })
     137#define ICMP_GET_DONT_FRAGMENT(call)  ((int) IPC_GET_ARG5(call))
    163138
    164139/*@}*/
  • uspace/lib/c/include/ipc/il.h

    r3c106e88 r774e6d1a  
    7575
    7676/** Return the protocol number message parameter.
    77  * @param[in] call The message call structure.
     77 *
     78 * @param[in] call Message call structure.
     79 *
    7880 */
    79 #define IL_GET_PROTO(call)      (int) IPC_GET_ARG1(*call)
     81#define IL_GET_PROTO(call)  ((int) IPC_GET_ARG1(call))
    8082
    8183/** Return the registering service message parameter.
    82  * @param[in] call The message call structure.
     84 *
     85 * @param[in] call Message call structure.
     86 *
    8387 */
    84 #define IL_GET_SERVICE(call)    (services_t) IPC_GET_ARG2(*call)
     88#define IL_GET_SERVICE(call)  ((services_t) IPC_GET_ARG2(call))
    8589
    8690/*@}*/
  • uspace/lib/c/include/ipc/ip.h

    r3c106e88 r774e6d1a  
    5151         */
    5252        NET_IP_ADD_ROUTE = NET_IP_FIRST,
     53       
    5354        /** Gets the actual route information.
    5455         * @see ip_get_route()
    5556         */
    5657        NET_IP_GET_ROUTE,
     58       
    5759        /** Processes the received error notification.
    5860         * @see ip_received_error_msg()
    5961         */
    6062        NET_IP_RECEIVED_ERROR,
     63       
    6164        /** Sets the default gateway.
    6265         * @see ip_set_default_gateway()
     
    6871/*@{*/
    6972
    70 /** Returns the address message parameter.
    71  * @param[in] call The message call structure.
     73/** Return the address message parameter.
     74 *
     75 * @param[in] call Message call structure.
     76 *
    7277 */
    7378#define IP_GET_ADDRESS(call) \
    7479        ({ \
    7580                in_addr_t addr; \
    76                 addr.s_addr = IPC_GET_ARG3(*call); \
     81                addr.s_addr = IPC_GET_ARG3(call); \
    7782                addr; \
    7883        })
    7984
    80 /** Returns the gateway message parameter.
    81  * @param[in] call The message call structure.
     85/** Return the gateway message parameter.
     86 *
     87 * @param[in] call Message call structure.
     88 *
    8289 */
    8390#define IP_GET_GATEWAY(call) \
    8491        ({ \
    8592                in_addr_t addr; \
    86                 addr.s_addr = IPC_GET_ARG2(*call); \
     93                addr.s_addr = IPC_GET_ARG2(call); \
    8794                addr; \
    8895        })
    8996
    90 /** Sets the header length in the message answer.
    91  * @param[out] answer The message answer structure.
     97/** Set the header length in the message answer.
     98 *
     99 * @param[out] answer Message answer structure.
     100 *
    92101 */
    93 #define IP_SET_HEADERLEN(answer, value) \
    94         do { \
    95                 sysarg_t argument = (sysarg_t) (value); \
    96                 IPC_SET_ARG2(*answer, argument); \
    97         } while (0)
     102#define IP_SET_HEADERLEN(answer, value)  IPC_SET_ARG2(answer, (sysarg_t) (value))
    98103
    99 /** Returns the network mask message parameter.
    100  * @param[in] call The message call structure.
     104/** Return the network mask message parameter.
     105 *
     106 * @param[in] call Message call structure.
     107 *
    101108 */
    102109#define IP_GET_NETMASK(call) \
    103110        ({ \
    104111                in_addr_t addr; \
    105                 addr.s_addr = IPC_GET_ARG4(*call); \
     112                addr.s_addr = IPC_GET_ARG4(call); \
    106113                addr; \
    107114        })
    108115
    109 /** Returns the protocol message parameter.
    110  * @param[in] call The message call structure.
     116/** Return the protocol message parameter.
     117 *
     118 * @param[in] call Message call structure.
     119 *
    111120 */
    112 #define IP_GET_PROTOCOL(call) \
    113         ({ \
    114                 ip_protocol_t protocol = (ip_protocol_t) IPC_GET_ARG1(*call); \
    115                 protocol; \
    116         })
     121#define IP_GET_PROTOCOL(call)  ((ip_protocol_t) IPC_GET_ARG1(call))
    117122
    118123/*@}*/
  • uspace/lib/c/include/ipc/net.h

    r3c106e88 r774e6d1a  
    4444#include <net/packet.h>
    4545
    46 /** Returns a value indicating whether the value is in the interval.
    47  * @param[in] item      The value to be checked.
    48  * @param[in] first_inclusive The first value in the interval inclusive.
    49  * @param[in] last_exclusive The first value after the interval.
     46/** Return a value indicating whether the value is in the interval.
     47 *
     48 * @param[in] item            Value to be checked.
     49 * @param[in] first_inclusive First value in the interval inclusive.
     50 * @param[in] last_exclusive  First value after the interval.
     51 *
    5052 */
    5153#define IS_IN_INTERVAL(item, first_inclusive, last_exclusive) \
     
    5557/*@{*/
    5658
    57 /** The number of ARP messages. */
    58 #define NET_ARP_COUNT           5
    59 
    60 /** The number of Ethernet messages. */
    61 #define NET_ETH_COUNT           0
    62 
    63 /** The number of ICMP messages. */
    64 #define NET_ICMP_COUNT          6
    65 
    66 /** The number of inter-network messages. */
    67 #define NET_IL_COUNT            6
    68 
    69 /** The number of IP messages. */
    70 #define NET_IP_COUNT            4
    71 
    72 /** The number of general networking messages. */
    73 #define NET_NET_COUNT           3
    74 
    75 /** The number of network interface driver messages. */
    76 #define NET_NETIF_COUNT         6
    77 
    78 /** The number of network interface layer messages. */
    79 #define NET_NIL_COUNT           7
    80 
    81 /** The number of packet management system messages. */
    82 #define NET_PACKET_COUNT        5
    83 
    84 /** The number of socket messages. */
    85 #define NET_SOCKET_COUNT        14
    86 
    87 /** The number of TCP messages. */
    88 #define NET_TCP_COUNT           0
    89 
    90 /** The number of transport layer messages. */
    91 #define NET_TL_COUNT            1
    92 
    93 /** The number of UDP messages. */
    94 #define NET_UDP_COUNT           0
     59#define NET_ARP_COUNT     5   /**< Number of ARP messages. */
     60#define NET_ETH_COUNT     0   /**< Number of Ethernet messages. */
     61#define NET_ICMP_COUNT    6   /**< Number of ICMP messages. */
     62#define NET_IL_COUNT      6   /**< Number of inter-network messages. */
     63#define NET_IP_COUNT      4   /**< Number of IP messages. */
     64#define NET_NET_COUNT     3   /**< Number of general networking messages. */
     65#define NET_NETIF_COUNT   6   /**< Number of network interface driver messages. */
     66#define NET_NIL_COUNT     7   /**< Number of network interface layer messages. */
     67#define NET_PACKET_COUNT  5   /**< Number of packet management system messages. */
     68#define NET_SOCKET_COUNT  14  /**< Number of socket messages. */
     69#define NET_TCP_COUNT     0   /**< Number of TCP messages. */
     70#define NET_TL_COUNT      1   /**< Number of transport layer messages. */
     71#define NET_UDP_COUNT     0   /**< Number of UDP messages. */
    9572
    9673/*@}*/
     
    10077/*@{*/
    10178
    102 /** The first networking message. */
    103 #define NET_FIRST               2000
    104 
    105 /** The first network interface layer message. */
    106 #define NET_NETIF_FIRST         NET_FIRST
    107 
    108 /** The last network interface layer message. */
    109 #define NET_NETIF_LAST          (NET_NETIF_FIRST + NET_NETIF_COUNT)
    110 
    111 /** The first general networking message. */
    112 #define NET_NET_FIRST           (NET_NETIF_LAST + 0)
    113 
    114 /** The last general networking message. */
    115 #define NET_NET_LAST            (NET_NET_FIRST + NET_NET_COUNT)
    116 
    117 /** The first network interface layer message. */
    118 #define NET_NIL_FIRST           (NET_NET_LAST + 0)
    119 
    120 /** The last network interface layer message. */
    121 #define NET_NIL_LAST            (NET_NIL_FIRST + NET_NIL_COUNT)
    122 
    123 /** The first Ethernet message. */
    124 #define NET_ETH_FIRST           (NET_NIL_LAST + 0)
    125 
    126 /** The last Ethernet message. */
    127 #define NET_ETH_LAST            (NET_ETH_FIRST + NET_ETH_COUNT)
    128 
    129 /** The first inter-network message. */
    130 #define NET_IL_FIRST            (NET_ETH_LAST + 0)
    131 
    132 /** The last inter-network message. */
    133 #define NET_IL_LAST             (NET_IL_FIRST + NET_IL_COUNT)
    134 
    135 /** The first IP message. */
    136 #define NET_IP_FIRST            (NET_IL_LAST + 0)
    137 
    138 /** The last IP message. */
    139 #define NET_IP_LAST             (NET_IP_FIRST + NET_IP_COUNT)
    140 
    141 /** The first ARP message. */
    142 #define NET_ARP_FIRST           (NET_IP_LAST + 0)
    143 
    144 /** The last ARP message. */
    145 #define NET_ARP_LAST            (NET_ARP_FIRST + NET_ARP_COUNT)
    146 
    147 /** The first ICMP message. */
    148 #define NET_ICMP_FIRST          (NET_ARP_LAST + 0)
    149 
    150 /** The last ICMP message. */
    151 #define NET_ICMP_LAST           (NET_ICMP_FIRST + NET_ICMP_COUNT)
    152 
    153 /** The first ICMP message. */
    154 #define NET_TL_FIRST            (NET_ICMP_LAST + 0)
    155 
    156 /** The last ICMP message. */
    157 #define NET_TL_LAST             (NET_TL_FIRST + NET_TL_COUNT)
    158 
    159 /** The first UDP message. */
    160 #define NET_UDP_FIRST           (NET_TL_LAST + 0)
    161 
    162 /** The last UDP message. */
    163 #define NET_UDP_LAST            (NET_UDP_FIRST + NET_UDP_COUNT)
    164 
    165 /** The first TCP message. */
    166 #define NET_TCP_FIRST           (NET_UDP_LAST + 0)
    167 
    168 /** The last TCP message. */
    169 #define NET_TCP_LAST            (NET_TCP_FIRST + NET_TCP_COUNT)
    170 
    171 /** The first socket message. */
    172 #define NET_SOCKET_FIRST        (NET_TCP_LAST + 0)
    173 
    174 /** The last socket message. */
    175 #define NET_SOCKET_LAST         (NET_SOCKET_FIRST + NET_SOCKET_COUNT)
    176 
    177 /** The first packet management system message. */
    178 #define NET_PACKET_FIRST        (NET_SOCKET_LAST + 0)
    179 
    180 /** The last packet management system message. */
    181 #define NET_PACKET_LAST         (NET_PACKET_FIRST + NET_PACKET_COUNT)
    182 
    183 /** The last networking message. */
    184 #define NET_LAST                NET_PACKET_LAST
    185 
    186 /** The number of networking messages. */
    187 #define NET_COUNT               (NET_LAST - NET_FIRST)
    188 
    189 /** Returns a value indicating whether the IPC call is a generic networking
    190  * message.
    191  * @param[in] call The IPC call to be checked.
     79
     80/** First networking message. */
     81#define NET_FIRST  2000
     82
     83/** First network interface layer message. */
     84#define NET_NETIF_FIRST  NET_FIRST
     85
     86/** Last network interface layer message. */
     87#define NET_NETIF_LAST  (NET_NETIF_FIRST + NET_NETIF_COUNT)
     88
     89/** First general networking message. */
     90#define NET_NET_FIRST  (NET_NETIF_LAST + 0)
     91
     92/** Last general networking message. */
     93#define NET_NET_LAST  (NET_NET_FIRST + NET_NET_COUNT)
     94
     95/** First network interface layer message. */
     96#define NET_NIL_FIRST  (NET_NET_LAST + 0)
     97
     98/** Last network interface layer message. */
     99#define NET_NIL_LAST  (NET_NIL_FIRST + NET_NIL_COUNT)
     100
     101/** First Ethernet message. */
     102#define NET_ETH_FIRST  (NET_NIL_LAST + 0)
     103
     104/** Last Ethernet message. */
     105#define NET_ETH_LAST  (NET_ETH_FIRST + NET_ETH_COUNT)
     106
     107/** First inter-network message. */
     108#define NET_IL_FIRST  (NET_ETH_LAST + 0)
     109
     110/** Last inter-network message. */
     111#define NET_IL_LAST  (NET_IL_FIRST + NET_IL_COUNT)
     112
     113/** First IP message. */
     114#define NET_IP_FIRST  (NET_IL_LAST + 0)
     115
     116/** Last IP message. */
     117#define NET_IP_LAST  (NET_IP_FIRST + NET_IP_COUNT)
     118
     119/** First ARP message. */
     120#define NET_ARP_FIRST  (NET_IP_LAST + 0)
     121
     122/** Last ARP message. */
     123#define NET_ARP_LAST  (NET_ARP_FIRST + NET_ARP_COUNT)
     124
     125/** First ICMP message. */
     126#define NET_ICMP_FIRST  (NET_ARP_LAST + 0)
     127
     128/** Last ICMP message. */
     129#define NET_ICMP_LAST  (NET_ICMP_FIRST + NET_ICMP_COUNT)
     130
     131/** First ICMP message. */
     132#define NET_TL_FIRST  (NET_ICMP_LAST + 0)
     133
     134/** Last ICMP message. */
     135#define NET_TL_LAST  (NET_TL_FIRST + NET_TL_COUNT)
     136
     137/** First UDP message. */
     138#define NET_UDP_FIRST  (NET_TL_LAST + 0)
     139
     140/** Last UDP message. */
     141#define NET_UDP_LAST  (NET_UDP_FIRST + NET_UDP_COUNT)
     142
     143/** First TCP message. */
     144#define NET_TCP_FIRST  (NET_UDP_LAST + 0)
     145
     146/** Last TCP message. */
     147#define NET_TCP_LAST  (NET_TCP_FIRST + NET_TCP_COUNT)
     148
     149/** First socket message. */
     150#define NET_SOCKET_FIRST  (NET_TCP_LAST + 0)
     151
     152/** Last socket message. */
     153#define NET_SOCKET_LAST  (NET_SOCKET_FIRST + NET_SOCKET_COUNT)
     154
     155/** First packet management system message. */
     156#define NET_PACKET_FIRST  (NET_SOCKET_LAST + 0)
     157
     158/** Last packet management system message. */
     159#define NET_PACKET_LAST  (NET_PACKET_FIRST + NET_PACKET_COUNT)
     160
     161/** Last networking message. */
     162#define NET_LAST  NET_PACKET_LAST
     163
     164/** Number of networking messages. */
     165#define NET_COUNT  (NET_LAST - NET_FIRST)
     166
     167/** Check if the IPC call is a generic networking message.
     168 *
     169 * @param[in] call IPC call to be checked.
     170 *
    192171 */
    193172#define IS_NET_MESSAGE(call) \
    194         IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_FIRST, NET_LAST)
    195 
    196 /** Returns a value indicating whether the IPC call is an ARP message.
    197  * @param[in] call The IPC call to be checked.
     173        IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_FIRST, NET_LAST)
     174
     175/** Check if the IPC call is an ARP message.
     176 *
     177 * @param[in] call IPC call to be checked.
     178 *
    198179 */
    199180#define IS_NET_ARP_MESSAGE(call) \
    200         IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_ARP_FIRST, NET_ARP_LAST)
    201 
    202 /** Returns a value indicating whether the IPC call is an Ethernet message.
    203  * @param[in] call The IPC call to be checked.
     181        IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_ARP_FIRST, NET_ARP_LAST)
     182
     183/** Check if the IPC call is an Ethernet message.
     184 *
     185 * @param[in] call IPC call to be checked.
     186 *
    204187 */
    205188#define IS_NET_ETH_MESSAGE(call) \
    206         IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_ETH_FIRST, NET_ETH_LAST)
    207 
    208 /** Returns a value indicating whether the IPC call is an ICMP message.
    209  * @param[in] call The IPC call to be checked.
     189        IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_ETH_FIRST, NET_ETH_LAST)
     190
     191/** Check if the IPC call is an ICMP message.
     192 *
     193 * @param[in] call IPC call to be checked.
     194 *
    210195 */
    211196#define IS_NET_ICMP_MESSAGE(call) \
    212         IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_ICMP_FIRST, NET_ICMP_LAST)
    213 
    214 /** Returns a value indicating whether the IPC call is an inter-network layer
    215  * message.
    216  * @param[in] call The IPC call to be checked.
     197        IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_ICMP_FIRST, NET_ICMP_LAST)
     198
     199/** Check if the IPC call is an inter-network layer message.
     200 *
     201 * @param[in] call IPC call to be checked.
     202 *
    217203 */
    218204#define IS_NET_IL_MESSAGE(call) \
    219         IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_IL_FIRST, NET_IL_LAST)
    220 
    221 /** Returns a value indicating whether the IPC call is an IP message.
    222  * @param[in] call The IPC call to be checked.
     205        IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_IL_FIRST, NET_IL_LAST)
     206
     207/** Check if the IPC call is an IP message.
     208 *
     209 * @param[in] call IPC call to be checked.
     210 *
    223211 */
    224212#define IS_NET_IP_MESSAGE(call) \
    225         IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_IP_FIRST, NET_IP_LAST)
    226 
    227 /** Returns a value indicating whether the IPC call is a generic networking
    228  * message.
    229  * @param[in] call The IPC call to be checked.
     213        IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_IP_FIRST, NET_IP_LAST)
     214
     215/** Check if the IPC call is a generic networking message.
     216 *
     217 * @param[in] call IPC call to be checked.
     218 *
    230219 */
    231220#define IS_NET_NET_MESSAGE(call) \
    232         IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_NET_FIRST, NET_NET_LAST)
    233 
    234 /** Returns a value indicating whether the IPC call is a network interface layer
    235  * message.
    236  * @param[in] call The IPC call to be checked.
     221        IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_NET_FIRST, NET_NET_LAST)
     222
     223/** Check if the IPC call is a network interface layer message.
     224 *
     225 * @param[in] call IPC call to be checked.
     226 *
    237227 */
    238228#define IS_NET_NIL_MESSAGE(call) \
    239         IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_NIL_FIRST, NET_NIL_LAST)
    240 
    241 /** Returns a value indicating whether the IPC call is a packet manaagement
    242  * system message.
    243  * @param[in] call The IPC call to be checked.
     229        IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_NIL_FIRST, NET_NIL_LAST)
     230
     231/** Check if the IPC call is a packet manaagement system message.
     232 *
     233 * @param[in] call IPC call to be checked.
     234 *
    244235 */
    245236#define IS_NET_PACKET_MESSAGE(call) \
    246         IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_PACKET_FIRST, NET_PACKET_LAST)
    247 
    248 /** Returns a value indicating whether the IPC call is a socket message.
    249  * @param[in] call The IPC call to be checked.
     237        IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_PACKET_FIRST, NET_PACKET_LAST)
     238
     239/** Check if the IPC call is a socket message.
     240 *
     241 * @param[in] call IPC call to be checked.
     242 *
    250243 */
    251244#define IS_NET_SOCKET_MESSAGE(call) \
    252         IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_SOCKET_FIRST, NET_SOCKET_LAST)
    253 
    254 /** Returns a value indicating whether the IPC call is a TCP message.
    255  * @param[in] call The IPC call to be checked.
     245        IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_SOCKET_FIRST, NET_SOCKET_LAST)
     246
     247/** Check if the IPC call is a TCP message.
     248 *
     249 * @param[in] call IPC call to be checked.
     250 *
    256251 */
    257252#define IS_NET_TCP_MESSAGE(call) \
    258         IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_TCP_FIRST, NET_TCP_LAST)
    259 
    260 /** Returns a value indicating whether the IPC call is a transport layer message.
    261  * @param[in] call The IPC call to be checked.
     253        IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_TCP_FIRST, NET_TCP_LAST)
     254
     255/** Check if the IPC call is a transport layer message.
     256 *
     257 * @param[in] call IPC call to be checked.
     258 *
    262259 */
    263260#define IS_NET_TL_MESSAGE(call) \
    264         IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_TL_FIRST, NET_TL_LAST)
    265 
    266 /** Returns a value indicating whether the IPC call is a UDP message.
    267  * @param[in] call The IPC call to be checked.
     261        IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_TL_FIRST, NET_TL_LAST)
     262
     263/** Check if the IPC call is a UDP message.
     264 *
     265 * @param[in] call IPC call to be checked.
     266 *
    268267 */
    269268#define IS_NET_UDP_MESSAGE(call) \
    270         IS_IN_INTERVAL(IPC_GET_IMETHOD(*call), NET_UDP_FIRST, NET_UDP_LAST)
     269        IS_IN_INTERVAL(IPC_GET_IMETHOD(call), NET_UDP_FIRST, NET_UDP_LAST)
    271270
    272271/*@}*/
     
    275274/*@{*/
    276275
    277 /** Returns the device identifier message argument.
    278  * @param[in] call The message call structure.
    279  */
    280 #define IPC_GET_DEVICE(call) \
    281         ({ \
    282                 device_id_t device_id = (device_id_t) IPC_GET_ARG1(*call); \
    283                 device_id; \
    284         })
    285 
    286 /** Returns the packet identifier message argument.
    287  * @param[in] call The message call structure.
    288  */
    289 #define IPC_GET_PACKET(call) \
    290         ({ \
    291                 packet_id_t packet_id = (packet_id_t) IPC_GET_ARG2(*call); \
    292                 packet_id; \
    293         })
    294 
    295 /** Returns the count message argument.
    296  * @param[in] call The message call structure.
    297  */
    298 #define IPC_GET_COUNT(call) \
    299         ({ \
    300                 size_t size = (size_t) IPC_GET_ARG2(*call); \
    301                 size; \
    302         })
    303 
    304 /** Returns the device state message argument.
    305  * @param[in] call The message call structure.
    306  */
    307 #define IPC_GET_STATE(call) \
    308         ({ \
    309                 device_state_t state = (device_state_t) IPC_GET_ARG2(*call); \
    310                 state; \
    311         })
    312 
    313 /** Returns the maximum transmission unit message argument.
    314  * @param[in] call The message call structure.
    315  */
    316 #define IPC_GET_MTU(call) \
    317         ({ \
    318                 size_t size = (size_t) IPC_GET_ARG2(*call); \
    319                 size; \
    320         })
    321 
    322 /** Returns the device driver service message argument.
    323  * @param[in] call The message call structure.
    324  */
    325 #define IPC_GET_SERVICE(call) \
    326         ({ \
    327                 services_t service = (services_t) IPC_GET_ARG3(*call); \
    328                 service; \
    329         })
    330 
    331 /** Returns the target service message argument.
    332  * @param[in] call The message call structure.
    333  */
    334 #define IPC_GET_TARGET(call) \
    335         ({ \
    336                 services_t service = (services_t) IPC_GET_ARG3(*call); \
    337                 service; \
    338         })
    339 
    340 /** Returns the sender service message argument.
    341  * @param[in] call The message call structure.
    342  */
    343 #define IPC_GET_SENDER(call) \
    344         ({ \
    345                 services_t service = (services_t) IPC_GET_ARG3(*call); \
    346                 service; \
    347         })
    348 
    349 /** Returns the error service message argument.
    350  * @param[in] call The message call structure.
    351  */
    352 #define IPC_GET_ERROR(call) \
    353         ({ \
    354                 services_t service = (services_t) IPC_GET_ARG4(*call); \
    355                 service; \
    356         })
    357 
    358 /** Returns the phone message argument.
    359  * @param[in] call The message call structure.
    360  */
    361 #define IPC_GET_PHONE(call) \
    362         ({ \
    363                 int phone = (int) IPC_GET_ARG5(*call); \
    364                 phone; \
    365         })
    366 
    367 /** Sets the device identifier in the message answer.
    368  * @param[out] answer The message answer structure.
    369  */
    370 #define IPC_SET_DEVICE(answer, value) \
    371         do { \
    372                 sysarg_t argument = (sysarg_t) (value); \
    373                 IPC_SET_ARG1(*answer, argument); \
    374         } while (0)
    375 
    376 /** Sets the minimum address length in the message answer.
    377  * @param[out] answer The message answer structure.
    378  */
    379 #define IPC_SET_ADDR(answer, value) \
    380         do { \
    381                 sysarg_t argument = (sysarg_t) (value); \
    382                 IPC_SET_ARG1(*answer, argument); \
    383         } while (0)
    384 
    385 /** Sets the minimum prefix size in the message answer.
    386  * @param[out] answer The message answer structure.
    387  */
    388 #define IPC_SET_PREFIX(answer, value) \
    389         do { \
    390                 sysarg_t argument = (sysarg_t) (value); \
    391                 IPC_SET_ARG2(*answer, argument); \
    392         } while (0)
    393 
    394 /** Sets the maximum content size in the message answer.
    395  * @param[out] answer The message answer structure.
    396  */
    397 #define IPC_SET_CONTENT(answer, value) \
    398         do { \
    399                 sysarg_t argument = (sysarg_t) (value); \
    400                 IPC_SET_ARG3(*answer, argument); \
    401         } while (0)
    402 
    403 /** Sets the minimum suffix size in the message answer.
    404  * @param[out] answer The message answer structure.
    405  */
    406 #define IPC_SET_SUFFIX(answer, value) \
    407         do { \
    408                 sysarg_t argument = (sysarg_t) (value); \
    409                 IPC_SET_ARG4(*answer, argument); \
    410         } while (0)
     276/** Return the device identifier message argument.
     277 *
     278 * @param[in] call Message call structure.
     279 *
     280 */
     281#define IPC_GET_DEVICE(call)  ((device_id_t) IPC_GET_ARG1(call))
     282
     283/** Return the packet identifier message argument.
     284 *
     285 * @param[in] call Message call structure.
     286 *
     287 */
     288#define IPC_GET_PACKET(call)  ((packet_id_t) IPC_GET_ARG2(call))
     289
     290/** Return the count message argument.
     291 *
     292 * @param[in] call Message call structure.
     293 *
     294 */
     295#define IPC_GET_COUNT(call)  ((size_t) IPC_GET_ARG2(call))
     296
     297/** Return the device state message argument.
     298 *
     299 * @param[in] call Message call structure.
     300 *
     301 */
     302#define IPC_GET_STATE(call)  ((device_state_t) IPC_GET_ARG2(call))
     303
     304/** Return the maximum transmission unit message argument.
     305 *
     306 * @param[in] call Message call structure.
     307 *
     308 */
     309#define IPC_GET_MTU(call)  ((size_t) IPC_GET_ARG2(call))
     310
     311/** Return the device driver service message argument.
     312 *
     313 * @param[in] call Message call structure.
     314 *
     315 */
     316#define IPC_GET_SERVICE(call)  ((services_t) IPC_GET_ARG3(call))
     317
     318/** Return the target service message argument.
     319 *
     320 * @param[in] call Message call structure.
     321 *
     322 */
     323#define IPC_GET_TARGET(call)  ((services_t) IPC_GET_ARG3(call))
     324
     325/** Return the sender service message argument.
     326 *
     327 * @param[in] call Message call structure.
     328 *
     329 */
     330#define IPC_GET_SENDER(call)  ((services_t) IPC_GET_ARG3(call))
     331
     332/** Return the error service message argument.
     333 &
     334 * @param[in] call Message call structure.
     335 *
     336 */
     337#define IPC_GET_ERROR(call)  ((services_t) IPC_GET_ARG4(call))
     338
     339/** Return the phone message argument.
     340 *
     341 * @param[in] call Message call structure.
     342 *
     343 */
     344#define IPC_GET_PHONE(call)  ((int) IPC_GET_ARG5(call))
     345
     346/** Set the device identifier in the message answer.
     347 *
     348 * @param[out] answer Message answer structure.
     349 * @param[in]  value  Value to set.
     350 *
     351 */
     352#define IPC_SET_DEVICE(answer, value)  IPC_SET_ARG1(answer, (sysarg_t) (value))
     353
     354/** Set the minimum address length in the message answer.
     355 *
     356 * @param[out] answer Message answer structure.
     357 * @param[in]  value  Value to set.
     358 *
     359 */
     360#define IPC_SET_ADDR(answer, value)  IPC_SET_ARG1(answer, (sysarg_t) (value))
     361
     362/** Set the minimum prefix size in the message answer.
     363 *
     364 * @param[out] answer Message answer structure.
     365 * @param[in]  value  Value to set.
     366 *
     367 */
     368#define IPC_SET_PREFIX(answer, value)  IPC_SET_ARG2(answer, (sysarg_t) (value))
     369
     370/** Set the maximum content size in the message answer.
     371 *
     372 * @param[out] answer Message answer structure.
     373 * @param[in]  value  Value to set.
     374 *
     375 */
     376#define IPC_SET_CONTENT(answer, value)  IPC_SET_ARG3(answer, (sysarg_t) (value))
     377
     378/** Set the minimum suffix size in the message answer.
     379 *
     380 * @param[out] answer Message answer structure.
     381 * @param[in]  value  Value to set.
     382 *
     383 */
     384#define IPC_SET_SUFFIX(answer, value)  IPC_SET_ARG4(answer, (sysarg_t) (value))
    411385
    412386/*@}*/
  • uspace/lib/c/include/ipc/netif.h

    r3c106e88 r774e6d1a  
    4747         */
    4848        NET_NETIF_PROBE = NET_NETIF_FIRST,
     49       
    4950        /** Send packet message.
    5051         * @see netif_send_msg()
    5152         */
    5253        NET_NETIF_SEND,
     54       
    5355        /** Start device message.
    5456         * @see netif_start_req()
    5557         */
    5658        NET_NETIF_START,
     59       
    5760        /** Get device usage statistics message.
    5861         * @see netif_stats_req()
    5962         */
    6063        NET_NETIF_STATS,
     64       
    6165        /** Stop device message.
    6266         * @see netif_stop_req()
    6367         */
    6468        NET_NETIF_STOP,
     69       
    6570        /** Get device address message.
    6671         * @see netif_get_addr_req()
     
    7378
    7479/** Return the interrupt number message parameter.
    75  * @param[in] call The message call structure.
     80 *
     81 * @param[in] call Mmessage call structure.
     82 *
    7683 */
    77 #define NETIF_GET_IRQ(call) \
    78         ({ \
    79                 int irq = (int) IPC_GET_ARG2(*call); \
    80                 irq; \
    81         })
     84#define NETIF_GET_IRQ(call) ((int) IPC_GET_ARG2(call))
    8285
    8386/** Return the input/output address message parameter.
    84  * @param[in] call The message call structure.
     87 *
     88 * @param[in] call Message call structure.
     89 *
    8590 */
    86 #define NETIF_GET_IO(call) \
    87         ({ \
    88                 int io = (int) IPC_GET_ARG3(*call); \
    89                 io; \
    90         })
     91#define NETIF_GET_IO(call) ((void *) IPC_GET_ARG3(call))
    9192
    9293/*@}*/
  • uspace/lib/c/include/ipc/nil.h

    r3c106e88 r774e6d1a  
    7777
    7878/** Return the protocol service message parameter. */
    79 #define NIL_GET_PROTO(call) \
    80         ({ \
    81                 services_t service = (services_t) IPC_GET_ARG2(*call); \
    82                 service; \
    83         })
     79#define NIL_GET_PROTO(call)  ((services_t) IPC_GET_ARG2(call))
    8480
    8581/*@}*/
  • uspace/lib/c/include/ipc/packet.h

    r3c106e88 r774e6d1a  
    7070} packet_messages;
    7171
    72 /** Returns the protocol service message parameter. */
    73 #define ARP_GET_PROTO(call)     (services_t) IPC_GET_ARG2(*call)
     72/** Return the protocol service message parameter. */
     73#define ARP_GET_PROTO(call)  ((services_t) IPC_GET_ARG2(call))
    7474
    75 /** Returns the packet identifier message parameter. */
    76 #define IPC_GET_ID(call)        (packet_id_t) IPC_GET_ARG1(*call)
     75/** Return the packet identifier message parameter. */
     76#define IPC_GET_ID(call)  ((packet_id_t) IPC_GET_ARG1(call))
    7777
    78 /** Returns the maximal content length message parameter. */
    79 #define IPC_GET_CONTENT(call)   (size_t) IPC_GET_ARG1(*call)
     78/** Return the maximal content length message parameter. */
     79#define IPC_GET_CONTENT(call)  ((size_t) IPC_GET_ARG1(call))
    8080
    81 /** Returns the maximal address length message parameter. */
    82 #define IPC_GET_ADDR_LEN(call)  (size_t) IPC_GET_ARG2(*call)
     81/** Return the maximal address length message parameter. */
     82#define IPC_GET_ADDR_LEN(call)  ((size_t) IPC_GET_ARG2(call))
    8383
    84 /** Returns the maximal prefix length message parameter. */
    85 #define IPC_GET_PREFIX(call)    (size_t) IPC_GET_ARG3(*call)
     84/** Return the maximal prefix length message parameter. */
     85#define IPC_GET_PREFIX(call)  ((size_t) IPC_GET_ARG3(call))
    8686
    87 /** Returns the maximal suffix length message parameter. */
    88 #define IPC_GET_SUFFIX(call)    (size_t) IPC_GET_ARG4(*call)
     87/** Return the maximal suffix length message parameter. */
     88#define IPC_GET_SUFFIX(call)  ((size_t) IPC_GET_ARG4(call))
    8989
    9090#endif
  • uspace/lib/c/include/net/in.h

    r3c106e88 r774e6d1a  
    4343
    4444/** INET string address maximum length. */
    45 #define INET_ADDRSTRLEN         (4 * 3 + 3 + 1)
     45#define INET_ADDRSTRLEN  (4 * 3 + 3 + 1)
    4646
    4747/** Type definition of the INET address.
    4848 * @see in_addr
    4949 */
    50 typedef struct in_addr          in_addr_t;
     50typedef struct in_addr in_addr_t;
    5151
    5252/** Type definition of the INET socket address.
  • uspace/lib/c/include/net/modules.h

    r3c106e88 r774e6d1a  
    5151/** Connect to the needed module function type definition.
    5252 *
    53  * @param[in] need      The needed module service.
    54  * @return              The phone of the needed service.
     53 * @param[in] need The needed module service.
     54 *
     55 * @return The phone of the needed service.
     56 *
    5557 */
    5658typedef int connect_module_t(services_t need);
    5759
    58 extern void answer_call(ipc_callid_t, int, ipc_call_t *, int);
     60extern void answer_call(ipc_callid_t, int, ipc_call_t *, size_t);
    5961extern int bind_service(services_t, sysarg_t, sysarg_t, sysarg_t,
    6062    async_client_conn_t);
     
    6466extern int connect_to_service_timeout(services_t, suseconds_t);
    6567extern int data_reply(void *, size_t);
    66 extern void refresh_answer(ipc_call_t *, int *);
     68extern void refresh_answer(ipc_call_t *, size_t *);
    6769
    6870#endif
  • uspace/lib/net/Makefile

    r3c106e88 r774e6d1a  
    4040        generic/protocol_map.c \
    4141        adt/module_map.c \
    42         netif/netif_local.c \
    4342        netif/netif_remote.c \
     43        netif/netif_skel.c \
    4444        nil/nil_remote.c \
    4545        il/il_interface.c \
  • uspace/lib/net/il/ip_remote.c

    r3c106e88 r774e6d1a  
    170170                free(*header);
    171171        else
    172                 *device_id = IPC_GET_DEVICE(&answer);
     172                *device_id = IPC_GET_DEVICE(answer);
    173173       
    174174        return (int) result;
  • uspace/lib/net/include/il_local.h

    r3c106e88 r774e6d1a  
    4949 */
    5050extern int il_module_message_standalone(ipc_callid_t callid, ipc_call_t *call,
    51     ipc_call_t *answer, int *answer_count);
     51    ipc_call_t *answer, size_t *answer_count);
    5252
    5353/** Starts the Internet layer module.
  • uspace/lib/net/include/netif_remote.h

    r3c106e88 r774e6d1a  
    4141#include <net/packet.h>
    4242
    43 extern int netif_get_addr_req_remote(int, device_id_t, measured_string_t **,
     43extern int netif_get_addr_req(int, device_id_t, measured_string_t **,
    4444    uint8_t **);
    45 extern int netif_probe_req_remote(int, device_id_t, int, int);
    46 extern int netif_send_msg_remote(int, device_id_t, packet_t *, services_t);
    47 extern int netif_start_req_remote(int, device_id_t);
    48 extern int netif_stop_req_remote(int, device_id_t);
    49 extern int netif_stats_req_remote(int, device_id_t, device_stats_t *);
    50 extern int netif_bind_service_remote(services_t, device_id_t, services_t,
     45extern int netif_probe_req(int, device_id_t, int, void *);
     46extern int netif_send_msg(int, device_id_t, packet_t *, services_t);
     47extern int netif_start_req(int, device_id_t);
     48extern int netif_stop_req(int, device_id_t);
     49extern int netif_stats_req(int, device_id_t, device_stats_t *);
     50extern int netif_bind_service(services_t, device_id_t, services_t,
    5151    async_client_conn_t);
    5252
  • uspace/lib/net/include/netif_skel.h

    r3c106e88 r774e6d1a  
    3636 */
    3737
    38 #ifndef NET_NETIF_LOCAL_H_
    39 #define NET_NETIF_LOCAL_H_
     38#ifndef NET_NETIF_SKEL_H_
     39#define NET_NETIF_SKEL_H_
    4040
    4141#include <async.h>
     
    7676 *
    7777 * This function has to be implemented in user code.
     78 *
    7879 */
    7980extern int netif_initialize(void);
     
    8384 * This has to be implemented in user code.
    8485 *
    85  * @param[in] device_id The device identifier.
    86  * @param[in] irq       The device interrupt number.
    87  * @param[in] io        The device input/output address.
    88  *
    89  * @return              EOK on success.
    90  * @return              Other error codes as defined for the find_device()
    91  *                      function.
    92  * @return              Other error codes as defined for the specific module
    93  *                      message implementation.
    94  */
    95 extern int netif_probe_message(device_id_t device_id, int irq, uintptr_t io);
     86 * @param[in] device_id Device identifier.
     87 * @param[in] irq       Device interrupt number.
     88 * @param[in] io        Device input/output address.
     89 *
     90 * @return EOK on success.
     91 * @return Other error codes as defined for the find_device()
     92 *         function.
     93 * @return Other error codes as defined for the specific module
     94 *         message implementation.
     95 *
     96 */
     97extern int netif_probe_message(device_id_t device_id, int irq, void *io);
    9698
    9799/** Send the packet queue.
     
    99101 * This has to be implemented in user code.
    100102 *
    101  * @param[in] device_id The device identifier.
    102  * @param[in] packet    The packet queue.
    103  * @param[in] sender    The sending module service.
    104  *
    105  * @return              EOK on success.
    106  * @return              EFORWARD if the device is not active (in the
    107  *                      NETIF_ACTIVE state).
    108  * @return              Other error codes as defined for the find_device()
    109  *                      function.
    110  * @return              Other error codes as defined for the specific module
    111  *                      message implementation.
     103 * @param[in] device_id Device identifier.
     104 * @param[in] packet    Packet queue.
     105 * @param[in] sender    Sending module service.
     106 *
     107 * @return EOK on success.
     108 * @return EFORWARD if the device is not active (in the
     109 *         NETIF_ACTIVE state).
     110 * @return Other error codes as defined for the find_device()
     111 *         function.
     112 * @return Other error codes as defined for the specific module
     113 *         message implementation.
     114 *
    112115 */
    113116extern int netif_send_message(device_id_t device_id, packet_t *packet,
     
    118121 * This has to be implemented in user code.
    119122 *
    120  * @param[in] device    The device structure.
    121  *
    122  * @return              EOK on success.
    123  * @return              Other error codes as defined for the find_device()
    124  *                      function.
    125  * @return              Other error codes as defined for the specific module
    126  *                      message implementation.
     123 * @param[in] device Device structure.
     124 *
     125 * @return New network interface state (non-negative values).
     126 * @return Other error codes as defined for the find_device()
     127 *         function.
     128 * @return Other error codes as defined for the specific module
     129 *         message implementation.
     130 
     131 *
    127132 */
    128133extern int netif_start_message(netif_device_t *device);
     
    132137 * This has to be implemented in user code.
    133138 *
    134  * @param[in] device    The device structure.
    135  *
    136  * @return              EOK on success.
    137  * @return              Other error codes as defined for the find_device()
    138  *                      function.
    139  * @return              Other error codes as defined for the specific module
    140  *                      message implementation.
     139 * @param[in] device Device structure.
     140 *
     141 * @return EOK on success.
     142 * @return Other error codes as defined for the find_device()
     143 *         function.
     144 * @return Other error codes as defined for the specific module
     145 *         message implementation.
     146 *
    141147 */
    142148extern int netif_stop_message(netif_device_t *device);
     
    146152 * This has to be implemented in user code.
    147153 *
    148  * @param[in] device_id The device identifier.
    149  * @param[out] address  The device local hardware address.
    150  *
    151  * @return              EOK on success.
    152  * @return              EBADMEM if the address parameter is NULL.
    153  * @return              ENOENT if there no such device.
    154  * @return              Other error codes as defined for the find_device()
    155  *                      function.
    156  * @return              Other error codes as defined for the specific module
    157  *                      message implementation.
     154 * @param[in] device_id Device identifier.
     155 * @param[out] address  Device local hardware address.
     156 *
     157 * @return EOK on success.
     158 * @return EBADMEM if the address parameter is NULL.
     159 * @return ENOENT if there no such device.
     160 * @return Other error codes as defined for the find_device()
     161 *         function.
     162 * @return Other error codes as defined for the specific module
     163 *         message implementation.
     164 *
    158165 */
    159166extern int netif_get_addr_message(device_id_t device_id,
     
    165172 * skeleton. This has to be implemented in user code.
    166173 *
    167  * @param[in] callid    The message identifier.
    168  * @param[in] call      The message parameters.
    169  * @param[out] answer   The message answer parameters.
    170  * @param[out] answer_count The last parameter for the actual answer in
    171  *                      the answer parameter.
    172  *
    173  * @return              EOK on success.
    174  * @return              ENOTSUP if the message is not known.
    175  * @return              Other error codes as defined for the specific module
    176  *                      message implementation.
     174 * @param[in]  callid Message identifier.
     175 * @param[in]  call   Message.
     176 * @param[out] answer Answer.
     177 * @param[out] count  Number of answer arguments.
     178 *
     179 * @return EOK on success.
     180 * @return ENOTSUP if the message is not known.
     181 * @return Other error codes as defined for the specific module
     182 *         message implementation.
     183 *
    177184 */
    178185extern int netif_specific_message(ipc_callid_t callid, ipc_call_t *call,
    179     ipc_call_t *answer, int *answer_count);
     186    ipc_call_t *answer, size_t *count);
    180187
    181188/** Return the device usage statistics.
     
    183190 * This has to be implemented in user code.
    184191 *
    185  * @param[in] device_id The device identifier.
    186  * @param[out] stats    The device usage statistics.
    187  *
    188  * @return              EOK on success.
    189  * @return              Other error codes as defined for the find_device()
    190  *                      function.
    191  * @return              Other error codes as defined for the specific module
    192  *                      message implementation.
     192 * @param[in]  device_id Device identifier.
     193 * @param[out] stats     Device usage statistics.
     194 *
     195 * @return EOK on success.
     196 * @return Other error codes as defined for the find_device()
     197 *         function.
     198 * @return Other error codes as defined for the specific module
     199 *         message implementation.
     200 *
    193201 */
    194202extern int netif_get_device_stats(device_id_t device_id,
    195203    device_stats_t *stats);
    196 
    197 extern int netif_get_addr_req_local(int, device_id_t, measured_string_t **,
    198     uint8_t **);
    199 extern int netif_probe_req_local(int, device_id_t, int, int);
    200 extern int netif_send_msg_local(int, device_id_t, packet_t *, services_t);
    201 extern int netif_start_req_local(int, device_id_t);
    202 extern int netif_stop_req_local(int, device_id_t);
    203 extern int netif_stats_req_local(int, device_id_t, device_stats_t *);
    204 extern int netif_bind_service_local(services_t, device_id_t, services_t,
    205     async_client_conn_t);
    206204
    207205extern int find_device(device_id_t, netif_device_t **);
     
    209207extern void netif_pq_release(packet_id_t);
    210208extern packet_t *netif_packet_get_1(size_t);
    211 extern int netif_init_module(async_client_conn_t);
    212 
    213 extern int netif_module_message_standalone(const char *, ipc_callid_t,
    214     ipc_call_t *, ipc_call_t *, int *);
    215 extern int netif_module_start_standalone(async_client_conn_t);
     209
     210extern int netif_module_start(void);
    216211
    217212#endif
  • uspace/lib/net/include/nil_local.h

    r3c106e88 r774e6d1a  
    9696 */
    9797extern int nil_message_standalone(const char *, ipc_callid_t, ipc_call_t *,
    98     ipc_call_t *, int *);
     98    ipc_call_t *, size_t *);
    9999
    100100/** Pass the parameters to the module specific nil_message() function.
     
    112112 */
    113113extern int nil_module_message_standalone(const char *, ipc_callid_t,
    114     ipc_call_t *, ipc_call_t *, int *);
     114    ipc_call_t *, ipc_call_t *, size_t *);
    115115
    116116/** Start the standalone nil layer module.
  • uspace/lib/net/include/tl_local.h

    r3c106e88 r774e6d1a  
    5252 */
    5353extern int tl_module_message_standalone(ipc_callid_t, ipc_call_t *,
    54     ipc_call_t *, int *);
    55 
     54    ipc_call_t *, size_t *);
    5655
    5756/** Processes the TL module message.
  • uspace/lib/net/netif/netif_remote.c

    r3c106e88 r774e6d1a  
    2727 */
    2828
    29 /** @addtogroup libnet 
     29/** @addtogroup libnet
    3030 * @{
    3131 */
     
    4949/** Return the device local hardware address.
    5050 *
    51  * @param[in] netif_phone The network interface phone.
    52  * @param[in] device_id The device identifier.
    53  * @param[out] address  The device local hardware address.
    54  * @param[out] data     The address data.
    55  * @return              EOK on success.
    56  * @return              EBADMEM if the address parameter is NULL.
    57  * @return              ENOENT if there no such device.
    58  * @return              Other error codes as defined for the
    59  *                      netif_get_addr_message() function.
     51 * @param[in]  netif_phone Network interface phone.
     52 * @param[in]  device_id   Device identifier.
     53 * @param[out] address     Device local hardware address.
     54 * @param[out] data        Address data.
     55 *
     56 * @return EOK on success.
     57 * @return EBADMEM if the address parameter is NULL.
     58 * @return ENOENT if there no such device.
     59 * @return Other error codes as defined for the
     60 *         netif_get_addr_message() function.
     61 *
    6062 */
    61 int netif_get_addr_req_remote(int netif_phone, device_id_t device_id,
     63int netif_get_addr_req(int netif_phone, device_id_t device_id,
    6264    measured_string_t **address, uint8_t **data)
    6365{
     
    6870/** Probe the existence of the device.
    6971 *
    70  * @param[in] netif_phone The network interface phone.
    71  * @param[in] device_id The device identifier.
    72  * @param[in] irq       The device interrupt number.
    73  * @param[in] io        The device input/output address.
    74  * @return              EOK on success.
    75  * @return              Other error codes as defined for the
    76  *                      netif_probe_message().
     72 * @param[in] netif_phone Network interface phone.
     73 * @param[in] device_id   Device identifier.
     74 * @param[in] irq         Device interrupt number.
     75 * @param[in] io          Device input/output address.
     76 *
     77 * @return EOK on success.
     78 * @return Other error codes as defined for the
     79 *         netif_probe_message().
     80 *
    7781 */
    78 int
    79 netif_probe_req_remote(int netif_phone, device_id_t device_id, int irq, int io)
     82int netif_probe_req(int netif_phone, device_id_t device_id, int irq, void *io)
    8083{
    81         return async_req_3_0(netif_phone, NET_NETIF_PROBE, device_id, irq, io);
     84        return async_req_3_0(netif_phone, NET_NETIF_PROBE, device_id, irq,
     85            (sysarg_t) io);
    8286}
    8387
    8488/** Send the packet queue.
    8589 *
    86  * @param[in] netif_phone The network interface phone.
    87  * @param[in] device_id The device identifier.
    88  * @param[in] packet    The packet queue.
    89  * @param[in] sender    The sending module service.
    90  * @return              EOK on success.
    91  * @return              Other error codes as defined for the generic_send_msg()
    92  *                      function.
     90 * @param[in] netif_phone Network interface phone.
     91 * @param[in] device_id   Device identifier.
     92 * @param[in] packet      Packet queue.
     93 * @param[in] sender      Sending module service.
     94 *
     95 * @return EOK on success.
     96 * @return Other error codes as defined for the generic_send_msg()
     97 *         function.
     98 *
    9399 */
    94 int
    95 netif_send_msg_remote(int netif_phone, device_id_t device_id, packet_t *packet,
     100int netif_send_msg(int netif_phone, device_id_t device_id, packet_t *packet,
    96101    services_t sender)
    97102{
     
    102107/** Start the device.
    103108 *
    104  * @param[in] netif_phone The network interface phone.
    105  * @param[in] device_id The device identifier.
    106  * @return              EOK on success.
    107  * @return              Other error codes as defined for the find_device()
    108  *                      function.
    109  * @return              Other error codes as defined for the
    110  *                      netif_start_message() function.
     109 * @param[in] netif_phone Network interface phone.
     110 * @param[in] device_id   Device identifier.
     111 *
     112 * @return EOK on success.
     113 * @return Other error codes as defined for the find_device()
     114 *         function.
     115 * @return Other error codes as defined for the
     116 *         netif_start_message() function.
     117 *
    111118 */
    112 int netif_start_req_remote(int netif_phone, device_id_t device_id)
     119int netif_start_req(int netif_phone, device_id_t device_id)
    113120{
    114121        return async_req_1_0(netif_phone, NET_NETIF_START, device_id);
     
    117124/** Stop the device.
    118125 *
    119  * @param[in] netif_phone The network interface phone.
    120  * @param[in] device_id The device identifier.
    121  * @return              EOK on success.
    122  * @return              Other error codes as defined for the find_device()
    123  *                      function.
    124  * @return              Other error codes as defined for the
    125  *                      netif_stop_message() function.
     126 * @param[in] netif_phone Network interface phone.
     127 * @param[in] device_id   Device identifier.
     128 *
     129 * @return EOK on success.
     130 * @return Other error codes as defined for the find_device()
     131 *         function.
     132 * @return Other error codes as defined for the
     133 *         netif_stop_message() function.
     134 *
    126135 */
    127 int netif_stop_req_remote(int netif_phone, device_id_t device_id)
     136int netif_stop_req(int netif_phone, device_id_t device_id)
    128137{
    129138        return async_req_1_0(netif_phone, NET_NETIF_STOP, device_id);
     
    132141/** Return the device usage statistics.
    133142 *
    134  * @param[in] netif_phone The network interface phone.
    135  * @param[in] device_id The device identifier.
    136  * @param[out] stats    The device usage statistics.
     143 * @param[in] netif_phone Network interface phone.
     144 * @param[in] device_id   Device identifier.
     145 * @param[out] stats      Device usage statistics.
     146 *
    137147 * @return EOK on success.
     148 *
    138149 */
    139 int netif_stats_req_remote(int netif_phone, device_id_t device_id,
     150int netif_stats_req(int netif_phone, device_id_t device_id,
    140151    device_stats_t *stats)
    141152{
     
    153164}
    154165
    155 /** Create bidirectional connection with the network interface module and
    156  * registers the message receiver.
     166/** Create bidirectional connection with the network interface module
     167 *
     168 * Create bidirectional connection with the network interface module and
     169 * register the message receiver.
    157170 *
    158171 * @param[in] service   The network interface module service.
     
    161174 * @param[in] receiver  The message receiver.
    162175 *
    163  * @return              The phone of the needed service.
    164  * @return              EOK on success.
    165  * @return              Other error codes as defined for the bind_service()
    166  *                      function.
     176 * @return The phone of the needed service.
     177 * @return EOK on success.
     178 * @return Other error codes as defined for the bind_service()
     179 *         function.
     180 *
    167181 */
    168 int
    169 netif_bind_service_remote(services_t service, device_id_t device_id,
     182int netif_bind_service(services_t service, device_id_t device_id,
    170183    services_t me, async_client_conn_t receiver)
    171184{
  • uspace/lib/net/netif/netif_skel.c

    r3c106e88 r774e6d1a  
    2727 */
    2828
    29 /** @addtogroup libnet 
     29/** @addtogroup libnet
    3030 * @{
    3131 */
     
    5353#include <net/device.h>
    5454#include <nil_interface.h>
    55 #include <netif_local.h>
    56 #include <netif_interface.h>
     55#include <netif_skel.h>
    5756
    5857DEVICE_MAP_IMPLEMENT(netif_device_map, netif_device_t);
     
    6362/** Probe the existence of the device.
    6463 *
    65  * @param[in] netif_phone The network interface phone.
    66  * @param[in] device_id The device identifier.
    67  * @param[in] irq       The device interrupt number.
    68  * @param[in] io        The device input/output address.
    69  * @return              EOK on success.
    70  * @return              Other error codes as defined for the
    71  *                      netif_probe_message().
    72  */
    73 int
    74 netif_probe_req_local(int netif_phone, device_id_t device_id, int irq, int io)
     64 * @param[in] netif_phone Network interface phone.
     65 * @param[in] device_id   Device identifier.
     66 * @param[in] irq         Device interrupt number.
     67 * @param[in] io          Device input/output address.
     68 *
     69 * @return EOK on success.
     70 * @return Other error codes as defined for the
     71 *         netif_probe_message().
     72 *
     73 */
     74static int netif_probe_req_local(int netif_phone, device_id_t device_id,
     75    int irq, void *io)
    7576{
    7677        fibril_rwlock_write_lock(&netif_globals.lock);
     
    8384/** Send the packet queue.
    8485 *
    85  * @param[in] netif_phone The network interface phone.
    86  * @param[in] device_id The device identifier.
    87  * @param[in] packet    The packet queue.
    88  * @param[in] sender    The sending module service.
    89  * @return              EOK on success.
    90  * @return              Other error codes as defined for the generic_send_msg()
    91  *                      function.
    92  */
    93 int netif_send_msg_local(int netif_phone, device_id_t device_id,
     86 * @param[in] netif_phone Network interface phone.
     87 * @param[in] device_id   Device identifier.
     88 * @param[in] packet      Packet queue.
     89 * @param[in] sender      Sending module service.
     90 *
     91 * @return EOK on success.
     92 * @return Other error codes as defined for the generic_send_msg()
     93 *         function.
     94 *
     95 */
     96static int netif_send_msg_local(int netif_phone, device_id_t device_id,
    9497    packet_t *packet, services_t sender)
    9598{
     
    103106/** Start the device.
    104107 *
    105  * @param[in] netif_phone The network interface phone.
    106  * @param[in] device_id The device identifier.
    107  * @return              EOK on success.
    108  * @return              Other error codes as defined for the find_device()
    109  *                      function.
    110  * @return              Other error codes as defined for the
    111  *                      netif_start_message() function.
    112  */
    113 int netif_start_req_local(int netif_phone, device_id_t device_id)
    114 {
    115         int rc;
    116        
     108 * @param[in] netif_phone Network interface phone.
     109 * @param[in] device_id   Device identifier.
     110 *
     111 * @return EOK on success.
     112 * @return Other error codes as defined for the find_device()
     113 *         function.
     114 * @return Other error codes as defined for the
     115 *         netif_start_message() function.
     116 *
     117 */
     118static int netif_start_req_local(int netif_phone, device_id_t device_id)
     119{
    117120        fibril_rwlock_write_lock(&netif_globals.lock);
    118121       
    119122        netif_device_t *device;
    120         rc = find_device(device_id, &device);
     123        int rc = find_device(device_id, &device);
    121124        if (rc != EOK) {
    122125                fibril_rwlock_write_unlock(&netif_globals.lock);
     
    139142/** Stop the device.
    140143 *
    141  * @param[in] netif_phone The network interface phone.
    142  * @param[in] device_id The device identifier.
    143  * @return              EOK on success.
    144  * @return              Other error codes as defined for the find_device()
    145  *                      function.
    146  * @return              Other error codes as defined for the
    147  *                      netif_stop_message() function.
    148  */
    149 int netif_stop_req_local(int netif_phone, device_id_t device_id)
    150 {
    151         int rc;
    152        
     144 * @param[in] netif_phone Network interface phone.
     145 * @param[in] device_id   Device identifier.
     146 *
     147 * @return EOK on success.
     148 * @return Other error codes as defined for the find_device()
     149 *         function.
     150 * @return Other error codes as defined for the
     151 *         netif_stop_message() function.
     152 *
     153 */
     154static int netif_stop_req_local(int netif_phone, device_id_t device_id)
     155{
    153156        fibril_rwlock_write_lock(&netif_globals.lock);
    154157       
    155158        netif_device_t *device;
    156         rc = find_device(device_id, &device);
     159        int rc = find_device(device_id, &device);
    157160        if (rc != EOK) {
    158161                fibril_rwlock_write_unlock(&netif_globals.lock);
     
    173176}
    174177
    175 /** Return the device usage statistics.
    176  *
    177  * @param[in] netif_phone The network interface phone.
    178  * @param[in] device_id The device identifier.
    179  * @param[out] stats    The device usage statistics.
    180  * @return EOK on success.
    181  */
    182 int netif_stats_req_local(int netif_phone, device_id_t device_id,
    183     device_stats_t *stats)
    184 {
    185         fibril_rwlock_read_lock(&netif_globals.lock);
    186         int res = netif_get_device_stats(device_id, stats);
    187         fibril_rwlock_read_unlock(&netif_globals.lock);
    188        
    189         return res;
    190 }
    191 
    192 /** Return the device local hardware address.
    193  *
    194  * @param[in] netif_phone The network interface phone.
    195  * @param[in] device_id The device identifier.
    196  * @param[out] address  The device local hardware address.
    197  * @param[out] data     The address data.
    198  * @return              EOK on success.
    199  * @return              EBADMEM if the address parameter is NULL.
    200  * @return              ENOENT if there no such device.
    201  * @return              Other error codes as defined for the
    202  *                      netif_get_addr_message() function.
    203  */
    204 int netif_get_addr_req_local(int netif_phone, device_id_t device_id,
    205     measured_string_t **address, uint8_t **data)
    206 {
    207         int rc;
    208        
    209         if (!address || !data)
    210                 return EBADMEM;
    211        
    212         fibril_rwlock_read_lock(&netif_globals.lock);
    213        
    214         measured_string_t translation;
    215         rc = netif_get_addr_message(device_id, &translation);
    216         if (rc == EOK) {
    217                 *address = measured_string_copy(&translation);
    218                 rc = (*address) ? EOK : ENOMEM;
    219         }
    220        
    221         fibril_rwlock_read_unlock(&netif_globals.lock);
    222        
    223         *data = (**address).value;
    224        
    225         return rc;
    226 }
    227 
    228178/** Find the device specific data.
    229179 *
    230  * @param[in] device_id The device identifier.
    231  * @param[out] device   The device specific data.
    232  * @return              EOK on success.
    233  * @return              ENOENT if device is not found.
    234  * @return              EPERM if the device is not initialized.
     180 * @param[in]  device_id Device identifier.
     181 * @param[out] device    Device specific data.
     182 *
     183 * @return EOK on success.
     184 * @return ENOENT if device is not found.
     185 * @return EPERM if the device is not initialized.
     186 *
    235187 */
    236188int find_device(device_id_t device_id, netif_device_t **device)
     
    251203/** Clear the usage statistics.
    252204 *
    253  * @param[in] stats     The usage statistics.
     205 * @param[in] stats The usage statistics.
     206 *
    254207 */
    255208void null_device_stats(device_stats_t *stats)
     
    258211}
    259212
    260 /** Initialize the netif module.
    261  *
    262  * @param[in] client_connection The client connection functio to be registered.
    263  * @return              EOK on success.
    264  * @return              Other error codes as defined for each specific module
    265  *                      message function.
    266  */
    267 int netif_init_module(async_client_conn_t client_connection)
    268 {
    269         int rc;
    270        
    271         async_set_client_connection(client_connection);
    272        
    273         netif_globals.net_phone = connect_to_service(SERVICE_NETWORKING);
    274         netif_device_map_initialize(&netif_globals.device_map);
    275        
    276         rc = pm_init();
     213/** Release the given packet.
     214 *
     215 * Prepared for future optimization.
     216 *
     217 * @param[in] packet_id The packet identifier.
     218 *
     219 */
     220void netif_pq_release(packet_id_t packet_id)
     221{
     222        pq_release_remote(netif_globals.net_phone, packet_id);
     223}
     224
     225/** Allocate new packet to handle the given content size.
     226 *
     227 * @param[in] content Minimum content size.
     228 *
     229 * @return The allocated packet.
     230 * @return NULL on error.
     231 *
     232 */
     233packet_t *netif_packet_get_1(size_t content)
     234{
     235        return packet_get_1_remote(netif_globals.net_phone, content);
     236}
     237
     238/** Register the device notification receiver,
     239 *
     240 * Register a  network interface layer module as the device
     241 * notification receiver.
     242 *
     243 * @param[in] device_id Device identifier.
     244 * @param[in] phone     Network interface layer module phone.
     245 *
     246 * @return EOK on success.
     247 * @return ENOENT if there is no such device.
     248 * @return ELIMIT if there is another module registered.
     249 *
     250 */
     251static int register_message(device_id_t device_id, int phone)
     252{
     253        netif_device_t *device;
     254        int rc = find_device(device_id, &device);
    277255        if (rc != EOK)
    278256                return rc;
    279257       
    280         fibril_rwlock_initialize(&netif_globals.lock);
    281        
    282         rc = netif_initialize();
    283         if (rc != EOK) {
    284                 pm_destroy();
    285                 return rc;
    286         }
    287        
     258        if (device->nil_phone >= 0)
     259                return ELIMIT;
     260       
     261        device->nil_phone = phone;
    288262        return EOK;
    289263}
    290264
    291 /** Release the given packet.
    292  *
    293  * Prepared for future optimization.
    294  *
    295  * @param[in] packet_id The packet identifier.
    296  */
    297 void netif_pq_release(packet_id_t packet_id)
    298 {
    299         pq_release_remote(netif_globals.net_phone, packet_id);
    300 }
    301 
    302 /** Allocate new packet to handle the given content size.
    303  *
    304  * @param[in] content   The minimum content size.
    305  * @return              The allocated packet.
    306  * @return              NULL if there is an error.
    307  *
    308  */
    309 packet_t *netif_packet_get_1(size_t content)
    310 {
    311         return packet_get_1_remote(netif_globals.net_phone, content);
    312 }
    313 
    314 /** Register the device notification receiver, the network interface layer
    315  * module.
    316  *
    317  * @param[in] name      Module name.
    318  * @param[in] device_id The device identifier.
    319  * @param[in] phone     The network interface layer module phone.
    320  * @return              EOK on success.
    321  * @return              ENOENT if there is no such device.
    322  * @return              ELIMIT if there is another module registered.
    323  */
    324 static int register_message(const char *name, device_id_t device_id, int phone)
    325 {
    326         netif_device_t *device;
    327         int rc;
    328        
    329         rc = find_device(device_id, &device);
    330         if (rc != EOK)
    331                 return rc;
    332        
    333         if (device->nil_phone > 0)
    334                 return ELIMIT;
    335        
    336         device->nil_phone = phone;
    337         printf("%s: Receiver of device %d registered (phone: %d)\n",
    338             name, device->device_id, device->nil_phone);
    339         return EOK;
    340 }
    341 
    342265/** Process the netif module messages.
    343266 *
    344  * @param[in] name      Module name.
    345  * @param[in] callid    The message identifier.
    346  * @param[in] call      The message parameters.
    347  * @param[out] answer   The message answer parameters.
    348  * @param[out] answer_count The last parameter for the actual answer in the
    349  *                      answer parameter.
    350  * @return              EOK on success.
    351  * @return              ENOTSUP if the message is not known.
    352  * @return              Other error codes as defined for each specific module
    353  *                      message function.
     267 * @param[in]  callid Mmessage identifier.
     268 * @param[in]  call   Message.
     269 * @param[out] answer Answer.
     270 * @param[out] count  Number of arguments of the answer.
     271 *
     272 * @return EOK on success.
     273 * @return ENOTSUP if the message is unknown.
     274 * @return Other error codes as defined for each specific module
     275 *         message function.
    354276 *
    355277 * @see IS_NET_NETIF_MESSAGE()
    356278 *
    357279 */
    358 int netif_module_message_standalone(const char *name, ipc_callid_t callid,
    359     ipc_call_t *call, ipc_call_t *answer, int *answer_count)
     280static int netif_module_message(ipc_callid_t callid, ipc_call_t *call,
     281    ipc_call_t *answer, size_t *count)
    360282{
    361283        size_t length;
     
    365287        int rc;
    366288       
    367         *answer_count = 0;
     289        *count = 0;
     290       
    368291        switch (IPC_GET_IMETHOD(*call)) {
    369292        case IPC_M_PHONE_HUNGUP:
     
    371294       
    372295        case NET_NETIF_PROBE:
    373                 return netif_probe_req_local(0, IPC_GET_DEVICE(call),
    374                     NETIF_GET_IRQ(call), NETIF_GET_IO(call));
    375                    
     296                return netif_probe_req_local(0, IPC_GET_DEVICE(*call),
     297                    NETIF_GET_IRQ(*call), NETIF_GET_IO(*call));
     298       
    376299        case IPC_M_CONNECT_TO_ME:
    377300                fibril_rwlock_write_lock(&netif_globals.lock);
    378                 rc = register_message(name, IPC_GET_DEVICE(call),
    379                     IPC_GET_PHONE(call));
     301               
     302                rc = register_message(IPC_GET_DEVICE(*call), IPC_GET_PHONE(*call));
     303               
    380304                fibril_rwlock_write_unlock(&netif_globals.lock);
    381305                return rc;
    382                
     306       
    383307        case NET_NETIF_SEND:
    384308                rc = packet_translate_remote(netif_globals.net_phone, &packet,
    385                     IPC_GET_PACKET(call));
     309                    IPC_GET_PACKET(*call));
    386310                if (rc != EOK)
    387311                        return rc;
    388                 return netif_send_msg_local(0, IPC_GET_DEVICE(call), packet,
    389                     IPC_GET_SENDER(call));
    390                
     312               
     313                return netif_send_msg_local(0, IPC_GET_DEVICE(*call), packet,
     314                    IPC_GET_SENDER(*call));
     315       
    391316        case NET_NETIF_START:
    392                 return netif_start_req_local(0, IPC_GET_DEVICE(call));
    393                
     317                return netif_start_req_local(0, IPC_GET_DEVICE(*call));
     318       
    394319        case NET_NETIF_STATS:
    395320                fibril_rwlock_read_lock(&netif_globals.lock);
    396 
     321               
    397322                rc = async_data_read_receive(&callid, &length);
    398323                if (rc != EOK) {
     
    400325                        return rc;
    401326                }
     327               
    402328                if (length < sizeof(device_stats_t)) {
    403329                        fibril_rwlock_read_unlock(&netif_globals.lock);
    404330                        return EOVERFLOW;
    405331                }
    406 
    407                 rc = netif_get_device_stats(IPC_GET_DEVICE(call), &stats);
     332               
     333                rc = netif_get_device_stats(IPC_GET_DEVICE(*call), &stats);
    408334                if (rc == EOK) {
    409335                        rc = async_data_read_finalize(callid, &stats,
    410336                            sizeof(device_stats_t));
    411337                }
    412 
     338               
    413339                fibril_rwlock_read_unlock(&netif_globals.lock);
    414340                return rc;
    415 
     341       
    416342        case NET_NETIF_STOP:
    417                 return netif_stop_req_local(0, IPC_GET_DEVICE(call));
    418                
     343                return netif_stop_req_local(0, IPC_GET_DEVICE(*call));
     344       
    419345        case NET_NETIF_GET_ADDR:
    420346                fibril_rwlock_read_lock(&netif_globals.lock);
    421                 rc = netif_get_addr_message(IPC_GET_DEVICE(call), &address);
     347               
     348                rc = netif_get_addr_message(IPC_GET_DEVICE(*call), &address);
    422349                if (rc == EOK)
    423350                        rc = measured_strings_reply(&address, 1);
     351               
    424352                fibril_rwlock_read_unlock(&netif_globals.lock);
    425353                return rc;
    426354        }
    427355       
    428         return netif_specific_message(callid, call, answer, answer_count);
     356        return netif_specific_message(callid, call, answer, count);
     357}
     358
     359/** Default fibril for new module connections.
     360 *
     361 * @param[in] iid   Initial message identifier.
     362 * @param[in] icall Initial message call structure.
     363 *
     364 */
     365static void netif_client_connection(ipc_callid_t iid, ipc_call_t *icall)
     366{
     367        /*
     368         * Accept the connection by answering
     369         * the initial IPC_M_CONNECT_ME_TO call.
     370         */
     371        ipc_answer_0(iid, EOK);
     372       
     373        while (true) {
     374                ipc_call_t answer;
     375                size_t count;
     376               
     377                /* Clear the answer structure */
     378                refresh_answer(&answer, &count);
     379               
     380                /* Fetch the next message */
     381                ipc_call_t call;
     382                ipc_callid_t callid = async_get_call(&call);
     383               
     384                /* Process the message */
     385                int res = netif_module_message(callid, &call, &answer, &count);
     386               
     387                /* End if said to either by the message or the processing result */
     388                if ((IPC_GET_IMETHOD(call) == IPC_M_PHONE_HUNGUP) ||
     389                    (res == EHANGUP))
     390                        return;
     391               
     392                /* Answer the message */
     393                answer_call(callid, res, &answer, count);
     394        }
    429395}
    430396
     
    435401 * messages in an infinite loop.
    436402 *
    437  * @param[in] client_connection The client connection processing function.
    438  *                      The module skeleton propagates its own one.
    439  * @return              EOK on success.
    440  * @return              Other error codes as defined for each specific module
    441  *                      message function.
    442  */
    443 int netif_module_start_standalone(async_client_conn_t client_connection)
    444 {
    445         int rc;
    446        
    447         rc = netif_init_module(client_connection);
     403 * @return EOK on success.
     404 * @return Other error codes as defined for each specific module
     405 *         message function.
     406 *
     407 */
     408int netif_module_start(void)
     409{
     410        async_set_client_connection(netif_client_connection);
     411       
     412        netif_globals.net_phone = connect_to_service(SERVICE_NETWORKING);
     413        netif_device_map_initialize(&netif_globals.device_map);
     414       
     415        int rc = pm_init();
    448416        if (rc != EOK)
    449417                return rc;
     418       
     419        fibril_rwlock_initialize(&netif_globals.lock);
     420       
     421        rc = netif_initialize();
     422        if (rc != EOK) {
     423                pm_destroy();
     424                return rc;
     425        }
    450426       
    451427        async_manager();
  • uspace/lib/packet/generic/packet_server.c

    r3c106e88 r774e6d1a  
    322322int
    323323packet_server_message(ipc_callid_t callid, ipc_call_t *call, ipc_call_t *answer,
    324     int *answer_count)
     324    size_t *answer_count)
    325325{
    326326        packet_t *packet;
     
    333333        case NET_PACKET_CREATE_1:
    334334                packet = packet_get_local(DEFAULT_ADDR_LEN, DEFAULT_PREFIX,
    335                     IPC_GET_CONTENT(call), DEFAULT_SUFFIX);
     335                    IPC_GET_CONTENT(*call), DEFAULT_SUFFIX);
    336336                if (!packet)
    337337                        return ENOMEM;
     
    343343        case NET_PACKET_CREATE_4:
    344344                packet = packet_get_local(
    345                     ((DEFAULT_ADDR_LEN < IPC_GET_ADDR_LEN(call)) ?
    346                     IPC_GET_ADDR_LEN(call) : DEFAULT_ADDR_LEN),
    347                     DEFAULT_PREFIX + IPC_GET_PREFIX(call),
    348                     IPC_GET_CONTENT(call),
    349                     DEFAULT_SUFFIX + IPC_GET_SUFFIX(call));
     345                    ((DEFAULT_ADDR_LEN < IPC_GET_ADDR_LEN(*call)) ?
     346                    IPC_GET_ADDR_LEN(*call) : DEFAULT_ADDR_LEN),
     347                    DEFAULT_PREFIX + IPC_GET_PREFIX(*call),
     348                    IPC_GET_CONTENT(*call),
     349                    DEFAULT_SUFFIX + IPC_GET_SUFFIX(*call));
    350350                if (!packet)
    351351                        return ENOMEM;
     
    356356       
    357357        case NET_PACKET_GET:
    358                 packet = pm_find(IPC_GET_ID(call));
     358                packet = pm_find(IPC_GET_ID(*call));
    359359                if (!packet_is_valid(packet))
    360360                        return ENOENT;
     
    362362       
    363363        case NET_PACKET_GET_SIZE:
    364                 packet = pm_find(IPC_GET_ID(call));
     364                packet = pm_find(IPC_GET_ID(*call));
    365365                if (!packet_is_valid(packet))
    366366                        return ENOENT;
     
    370370       
    371371        case NET_PACKET_RELEASE:
    372                 return packet_release_wrapper(IPC_GET_ID(call));
     372                return packet_release_wrapper(IPC_GET_ID(*call));
    373373        }
    374374       
  • uspace/lib/packet/include/packet_server.h

    r3c106e88 r774e6d1a  
    4848
    4949extern int packet_server_message(ipc_callid_t, ipc_call_t *, ipc_call_t *,
    50     int *);
     50    size_t *);
    5151
    5252#endif
  • uspace/srv/net/il/arp/arp.c

    r3c106e88 r774e6d1a  
    457457        uint8_t *des_proto;
    458458        int rc;
    459 
     459       
    460460        length = packet_get_data_length(packet);
    461461        if (length <= sizeof(arp_header_t))
     
    677677int
    678678arp_message_standalone(ipc_callid_t callid, ipc_call_t *call,
    679     ipc_call_t *answer, int *answer_count)
     679    ipc_call_t *answer, size_t *answer_count)
    680680{
    681681        measured_string_t *address;
     
    696696                        return rc;
    697697               
    698                 rc = arp_device_message(IPC_GET_DEVICE(call),
    699                     IPC_GET_SERVICE(call), ARP_GET_NETIF(call), address);
     698                rc = arp_device_message(IPC_GET_DEVICE(*call),
     699                    IPC_GET_SERVICE(*call), ARP_GET_NETIF(*call), address);
    700700                if (rc != EOK) {
    701701                        free(address);
     
    710710               
    711711                fibril_mutex_lock(&arp_globals.lock);
    712                 rc = arp_translate_message(IPC_GET_DEVICE(call),
    713                     IPC_GET_SERVICE(call), address, &translation);
     712                rc = arp_translate_message(IPC_GET_DEVICE(*call),
     713                    IPC_GET_SERVICE(*call), address, &translation);
    714714                free(address);
    715715                free(data);
     
    727727
    728728        case NET_ARP_CLEAR_DEVICE:
    729                 return arp_clear_device_req(0, IPC_GET_DEVICE(call));
     729                return arp_clear_device_req(0, IPC_GET_DEVICE(*call));
    730730
    731731        case NET_ARP_CLEAR_ADDRESS:
     
    734734                        return rc;
    735735               
    736                 arp_clear_address_req(0, IPC_GET_DEVICE(call),
    737                     IPC_GET_SERVICE(call), address);
     736                arp_clear_address_req(0, IPC_GET_DEVICE(*call),
     737                    IPC_GET_SERVICE(*call), address);
    738738                free(address);
    739739                free(data);
     
    750750               
    751751                rc = packet_translate_remote(arp_globals.net_phone, &packet,
    752                     IPC_GET_PACKET(call));
     752                    IPC_GET_PACKET(*call));
    753753                if (rc != EOK)
    754754                        return rc;
     
    757757                do {
    758758                        next = pq_detach(packet);
    759                         rc = arp_receive_message(IPC_GET_DEVICE(call), packet);
     759                        rc = arp_receive_message(IPC_GET_DEVICE(*call), packet);
    760760                        if (rc != 1) {
    761761                                pq_release_remote(arp_globals.net_phone,
     
    769769       
    770770        case NET_IL_MTU_CHANGED:
    771                 return arp_mtu_changed_message(IPC_GET_DEVICE(call),
    772                     IPC_GET_MTU(call));
     771                return arp_mtu_changed_message(IPC_GET_DEVICE(*call),
     772                    IPC_GET_MTU(*call));
    773773        }
    774774       
     
    791791        while (true) {
    792792                ipc_call_t answer;
    793                 int answer_count;
     793                size_t count;
    794794               
    795795                /* Clear the answer structure */
    796                 refresh_answer(&answer, &answer_count);
     796                refresh_answer(&answer, &count);
    797797               
    798798                /* Fetch the next message */
     
    802802                /* Process the message */
    803803                int res = il_module_message_standalone(callid, &call, &answer,
    804                     &answer_count);
     804                    &count);
    805805               
    806806                /*
     
    813813               
    814814                /* Answer the message */
    815                 answer_call(callid, res, &answer, answer_count);
     815                answer_call(callid, res, &answer, count);
    816816        }
    817817}
  • uspace/srv/net/il/arp/arp_module.c

    r3c106e88 r774e6d1a  
    5858
    5959int il_module_message_standalone(ipc_callid_t callid, ipc_call_t *call,
    60     ipc_call_t *answer, int *answer_count)
     60    ipc_call_t *answer, size_t *count)
    6161{
    62         return arp_message_standalone(callid, call, answer, answer_count);
     62        return arp_message_standalone(callid, call, answer, count);
    6363}
    6464
  • uspace/srv/net/il/arp/arp_module.h

    r3c106e88 r774e6d1a  
    4444extern int arp_initialize(async_client_conn_t);
    4545extern int arp_message_standalone(ipc_callid_t, ipc_call_t *, ipc_call_t *,
    46     int *);
     46    size_t *);
    4747
    4848#endif
  • uspace/srv/net/il/ip/ip.c

    r3c106e88 r774e6d1a  
    477477                ip_globals.gateway.gateway.s_addr = gateway.s_addr;
    478478                ip_globals.gateway.netif = ip_netif;
     479               
     480                char defgateway[INET_ADDRSTRLEN];
     481                inet_ntop(AF_INET, (uint8_t *) &gateway.s_addr,
     482                    defgateway, INET_ADDRSTRLEN);
     483                printf("%s: Default gateway (%s)\n", NAME, defgateway);
    479484        }
    480485
     
    10691074        int index;
    10701075        ip_route_t *route;
    1071 
     1076       
    10721077        if (!netif)
    10731078                return NULL;
    1074 
    1075         // start with the first one - the direct route
     1079       
     1080        /* Start with the first one (the direct route) */
    10761081        for (index = 0; index < ip_routes_count(&netif->routes); index++) {
    10771082                route = ip_routes_get_index(&netif->routes, index);
    1078                 if (route &&
     1083                if ((route) &&
    10791084                    ((route->address.s_addr & route->netmask.s_addr) ==
    1080                     (destination.s_addr & route->netmask.s_addr))) {
     1085                    (destination.s_addr & route->netmask.s_addr)))
    10811086                        return route;
    1082                 }
    10831087        }
    10841088
     
    12881292        if (device_id > 0) {
    12891293                netif = ip_netifs_find(&ip_globals.netifs, device_id);
    1290                 route = ip_netif_find_route(netif, * dest);
     1294                route = ip_netif_find_route(netif, *dest);
    12911295                if (netif && !route && (ip_globals.gateway.netif == netif))
    12921296                        route = &ip_globals.gateway;
     
    13181322                }
    13191323        }
    1320 
     1324       
    13211325        // if the local host is the destination
    13221326        if ((route->address.s_addr == dest->s_addr) &&
     
    15621566        socklen_t addrlen;
    15631567        int rc;
    1564 
     1568       
    15651569        header = (ip_header_t *) packet_get_data(packet);
    15661570        if (!header)
     
    15881592                return EINVAL;
    15891593        }
    1590 
     1594       
    15911595        // process ipopt and get destination
    15921596        dest = ip_get_destination(header);
     
    16091613        if (rc != EOK)
    16101614                return rc;
    1611 
     1615       
    16121616        route = ip_find_route(dest);
    16131617        if (!route) {
     
    18861890int
    18871891ip_message_standalone(ipc_callid_t callid, ipc_call_t *call, ipc_call_t *answer,
    1888     int *answer_count)
     1892    size_t *answer_count)
    18891893{
    18901894        packet_t *packet;
     
    19051909       
    19061910        case IPC_M_CONNECT_TO_ME:
    1907                 return ip_register(IL_GET_PROTO(call), IL_GET_SERVICE(call),
    1908                     IPC_GET_PHONE(call), NULL);
     1911                return ip_register(IL_GET_PROTO(*call), IL_GET_SERVICE(*call),
     1912                    IPC_GET_PHONE(*call), NULL);
    19091913       
    19101914        case NET_IL_DEVICE:
    1911                 return ip_device_req_local(0, IPC_GET_DEVICE(call),
    1912                     IPC_GET_SERVICE(call));
     1915                return ip_device_req_local(0, IPC_GET_DEVICE(*call),
     1916                    IPC_GET_SERVICE(*call));
    19131917       
    19141918        case NET_IL_SEND:
    19151919                rc = packet_translate_remote(ip_globals.net_phone, &packet,
    1916                     IPC_GET_PACKET(call));
     1920                    IPC_GET_PACKET(*call));
    19171921                if (rc != EOK)
    19181922                        return rc;
    1919                 return ip_send_msg_local(0, IPC_GET_DEVICE(call), packet, 0,
    1920                     IPC_GET_ERROR(call));
     1923                return ip_send_msg_local(0, IPC_GET_DEVICE(*call), packet, 0,
     1924                    IPC_GET_ERROR(*call));
    19211925       
    19221926        case NET_IL_DEVICE_STATE:
    1923                 return ip_device_state_message(IPC_GET_DEVICE(call),
    1924                     IPC_GET_STATE(call));
     1927                return ip_device_state_message(IPC_GET_DEVICE(*call),
     1928                    IPC_GET_STATE(*call));
    19251929       
    19261930        case NET_IL_RECEIVED:
    19271931                rc = packet_translate_remote(ip_globals.net_phone, &packet,
    1928                     IPC_GET_PACKET(call));
     1932                    IPC_GET_PACKET(*call));
    19291933                if (rc != EOK)
    19301934                        return rc;
    1931                 return ip_receive_message(IPC_GET_DEVICE(call), packet);
     1935                return ip_receive_message(IPC_GET_DEVICE(*call), packet);
    19321936       
    19331937        case NET_IP_RECEIVED_ERROR:
    19341938                rc = packet_translate_remote(ip_globals.net_phone, &packet,
    1935                     IPC_GET_PACKET(call));
     1939                    IPC_GET_PACKET(*call));
    19361940                if (rc != EOK)
    19371941                        return rc;
    1938                 return ip_received_error_msg_local(0, IPC_GET_DEVICE(call),
    1939                     packet, IPC_GET_TARGET(call), IPC_GET_ERROR(call));
     1942                return ip_received_error_msg_local(0, IPC_GET_DEVICE(*call),
     1943                    packet, IPC_GET_TARGET(*call), IPC_GET_ERROR(*call));
    19401944       
    19411945        case NET_IP_ADD_ROUTE:
    1942                 return ip_add_route_req_local(0, IPC_GET_DEVICE(call),
    1943                     IP_GET_ADDRESS(call), IP_GET_NETMASK(call),
    1944                     IP_GET_GATEWAY(call));
     1946                return ip_add_route_req_local(0, IPC_GET_DEVICE(*call),
     1947                    IP_GET_ADDRESS(*call), IP_GET_NETMASK(*call),
     1948                    IP_GET_GATEWAY(*call));
    19451949
    19461950        case NET_IP_SET_GATEWAY:
    1947                 return ip_set_gateway_req_local(0, IPC_GET_DEVICE(call),
    1948                     IP_GET_GATEWAY(call));
     1951                return ip_set_gateway_req_local(0, IPC_GET_DEVICE(*call),
     1952                    IP_GET_GATEWAY(*call));
    19491953
    19501954        case NET_IP_GET_ROUTE:
     
    19541958                        return rc;
    19551959               
    1956                 rc = ip_get_route_req_local(0, IP_GET_PROTOCOL(call), addr,
     1960                rc = ip_get_route_req_local(0, IP_GET_PROTOCOL(*call), addr,
    19571961                    (socklen_t) addrlen, &device_id, &header, &headerlen);
    19581962                if (rc != EOK)
    19591963                        return rc;
    19601964               
    1961                 IPC_SET_DEVICE(answer, device_id);
    1962                 IP_SET_HEADERLEN(answer, headerlen);
     1965                IPC_SET_DEVICE(*answer, device_id);
     1966                IP_SET_HEADERLEN(*answer, headerlen);
    19631967               
    19641968                *answer_count = 2;
     
    19721976       
    19731977        case NET_IL_PACKET_SPACE:
    1974                 rc = ip_packet_size_message(IPC_GET_DEVICE(call), &addrlen,
     1978                rc = ip_packet_size_message(IPC_GET_DEVICE(*call), &addrlen,
    19751979                    &prefix, &content, &suffix);
    19761980                if (rc != EOK)
    19771981                        return rc;
    19781982               
    1979                 IPC_SET_ADDR(answer, addrlen);
    1980                 IPC_SET_PREFIX(answer, prefix);
    1981                 IPC_SET_CONTENT(answer, content);
    1982                 IPC_SET_SUFFIX(answer, suffix);
     1983                IPC_SET_ADDR(*answer, addrlen);
     1984                IPC_SET_PREFIX(*answer, prefix);
     1985                IPC_SET_CONTENT(*answer, content);
     1986                IPC_SET_SUFFIX(*answer, suffix);
    19831987                *answer_count = 4;
    19841988                return EOK;
    19851989       
    19861990        case NET_IL_MTU_CHANGED:
    1987                 return ip_mtu_changed_message(IPC_GET_DEVICE(call),
    1988                     IPC_GET_MTU(call));
     1991                return ip_mtu_changed_message(IPC_GET_DEVICE(*call),
     1992                    IPC_GET_MTU(*call));
    19891993        }
    19901994       
     
    20072011        while (true) {
    20082012                ipc_call_t answer;
    2009                 int answer_count;
     2013                size_t count;
    20102014               
    20112015                /* Clear the answer structure */
    2012                 refresh_answer(&answer, &answer_count);
     2016                refresh_answer(&answer, &count);
    20132017               
    20142018                /* Fetch the next message */
     
    20182022                /* Process the message */
    20192023                int res = il_module_message_standalone(callid, &call, &answer,
    2020                     &answer_count);
     2024                    &count);
    20212025               
    20222026                /*
     
    20302034               
    20312035                /* Answer the message */
    2032                 answer_call(callid, res, &answer, answer_count);
     2036                answer_call(callid, res, &answer, count);
    20332037        }
    20342038}
  • uspace/srv/net/il/ip/ip_module.c

    r3c106e88 r774e6d1a  
    5959int
    6060il_module_message_standalone(ipc_callid_t callid, ipc_call_t *call,
    61     ipc_call_t *answer, int *answer_count)
     61    ipc_call_t *answer, size_t *count)
    6262{
    63         return ip_message_standalone(callid, call, answer, answer_count);
     63        return ip_message_standalone(callid, call, answer, count);
    6464}
    6565
  • uspace/srv/net/il/ip/ip_module.h

    r3c106e88 r774e6d1a  
    4343extern int ip_initialize(async_client_conn_t);
    4444extern int ip_message_standalone(ipc_callid_t, ipc_call_t *, ipc_call_t *,
    45     int *);
     45    size_t *);
    4646
    4747#endif
  • uspace/srv/net/net/net.c

    r3c106e88 r774e6d1a  
    474474       
    475475        setting = measured_strings_find(&netif->configuration, (uint8_t *) CONF_IO, 0);
    476         int io = setting ? strtol((char *) setting->value, NULL, 16) : 0;
    477        
    478         rc = netif_probe_req_remote(netif->driver->phone, netif->id, irq, io);
     476        uintptr_t io = setting ? strtol((char *) setting->value, NULL, 16) : 0;
     477       
     478        rc = netif_probe_req(netif->driver->phone, netif->id, irq, (void *) io);
    479479        if (rc != EOK)
    480480                return rc;
     
    511511        }
    512512       
    513         return netif_start_req_remote(netif->driver->phone, netif->id);
     513        return netif_start_req(netif->driver->phone, netif->id);
    514514}
    515515
     
    613613/** Process the networking message.
    614614 *
    615  * @param[in] callid        The message identifier.
    616  * @param[in] call          The message parameters.
     615 * @param[in]  callid       The message identifier.
     616 * @param[in]  call         The message parameters.
    617617 * @param[out] answer       The message answer parameters.
    618618 * @param[out] answer_count The last parameter for the actual answer
     
    627627 */
    628628int net_message(ipc_callid_t callid, ipc_call_t *call, ipc_call_t *answer,
    629     int *answer_count)
     629    size_t *answer_count)
    630630{
    631631        measured_string_t *strings;
     
    639639        case NET_NET_GET_DEVICE_CONF:
    640640                rc = measured_strings_receive(&strings, &data,
    641                     IPC_GET_COUNT(call));
     641                    IPC_GET_COUNT(*call));
    642642                if (rc != EOK)
    643643                        return rc;
    644                 net_get_device_conf_req(0, IPC_GET_DEVICE(call), &strings,
    645                     IPC_GET_COUNT(call), NULL);
     644                net_get_device_conf_req(0, IPC_GET_DEVICE(*call), &strings,
     645                    IPC_GET_COUNT(*call), NULL);
    646646               
    647647                /* Strings should not contain received data anymore */
    648648                free(data);
    649649               
    650                 rc = measured_strings_reply(strings, IPC_GET_COUNT(call));
     650                rc = measured_strings_reply(strings, IPC_GET_COUNT(*call));
    651651                free(strings);
    652652                return rc;
    653653        case NET_NET_GET_CONF:
    654654                rc = measured_strings_receive(&strings, &data,
    655                     IPC_GET_COUNT(call));
     655                    IPC_GET_COUNT(*call));
    656656                if (rc != EOK)
    657657                        return rc;
    658                 net_get_conf_req(0, &strings, IPC_GET_COUNT(call), NULL);
     658                net_get_conf_req(0, &strings, IPC_GET_COUNT(*call), NULL);
    659659               
    660660                /* Strings should not contain received data anymore */
    661661                free(data);
    662662               
    663                 rc = measured_strings_reply(strings, IPC_GET_COUNT(call));
     663                rc = measured_strings_reply(strings, IPC_GET_COUNT(*call));
    664664                free(strings);
    665665                return rc;
     
    688688                /* Clear the answer structure */
    689689                ipc_call_t answer;
    690                 int answer_count;
     690                size_t answer_count;
    691691                refresh_answer(&answer, &answer_count);
    692692               
  • uspace/srv/net/net/net.h

    r3c106e88 r774e6d1a  
    135135extern int add_configuration(measured_strings_t *, const uint8_t *,
    136136    const uint8_t *);
    137 extern int net_module_message(ipc_callid_t, ipc_call_t *, ipc_call_t *, int *);
     137extern int net_module_message(ipc_callid_t, ipc_call_t *, ipc_call_t *, size_t *);
    138138extern int net_initialize_build(async_client_conn_t);
    139 extern int net_message(ipc_callid_t, ipc_call_t *, ipc_call_t *, int *);
     139extern int net_message(ipc_callid_t, ipc_call_t *, ipc_call_t *, size_t *);
    140140
    141141#endif
  • uspace/srv/net/net/net_standalone.c

    r3c106e88 r774e6d1a  
    100100 */
    101101int net_module_message(ipc_callid_t callid, ipc_call_t *call,
    102     ipc_call_t *answer, int *answer_count)
     102    ipc_call_t *answer, size_t *count)
    103103{
    104         if (IS_NET_PACKET_MESSAGE(call))
    105                 return packet_server_message(callid, call, answer, answer_count);
     104        if (IS_NET_PACKET_MESSAGE(*call))
     105                return packet_server_message(callid, call, answer, count);
    106106       
    107         return net_message(callid, call, answer, answer_count);
     107        return net_message(callid, call, answer, count);
    108108}
    109109
  • uspace/srv/net/netif/lo/lo.c

    r3c106e88 r774e6d1a  
    4949#include <net/device.h>
    5050#include <nil_interface.h>
    51 #include <netif_interface.h>
    52 #include <netif_local.h>
     51#include <netif_skel.h>
    5352
    5453/** Default hardware address. */
     
    6564
    6665int netif_specific_message(ipc_callid_t callid, ipc_call_t *call,
    67     ipc_call_t *answer, int *answer_count)
     66    ipc_call_t *answer, size_t *count)
    6867{
    6968        return ENOTSUP;
     
    172171}
    173172
    174 int netif_probe_message(device_id_t device_id, int irq, uintptr_t io)
     173int netif_probe_message(device_id_t device_id, int irq, void *io)
    175174{
    176175        netif_device_t *device;
     
    233232}
    234233
    235 /** Default thread for new connections.
    236  *
    237  * @param[in] iid       The initial message identifier.
    238  * @param[in] icall     The initial message call structure.
    239  */
    240 static void netif_client_connection(ipc_callid_t iid, ipc_call_t *icall)
    241 {
    242         /*
    243          * Accept the connection
    244          *  - Answer the first IPC_M_CONNECT_ME_TO call.
    245          */
    246         ipc_answer_0(iid, EOK);
    247        
    248         while (true) {
    249                 ipc_call_t answer;
    250                 int answer_count;
    251                
    252                 /* Clear the answer structure */
    253                 refresh_answer(&answer, &answer_count);
    254                
    255                 /* Fetch the next message */
    256                 ipc_call_t call;
    257                 ipc_callid_t callid = async_get_call(&call);
    258                
    259                 /* Process the message */
    260                 int res = netif_module_message(NAME, callid, &call, &answer,
    261                     &answer_count);
    262                
    263                 /*
    264                  * End if told to either by the message or the processing
    265                  * result.
    266                  */
    267                 if ((IPC_GET_IMETHOD(call) == IPC_M_PHONE_HUNGUP) ||
    268                     (res == EHANGUP))
    269                         return;
    270                
    271                 /* Answer the message */
    272                 answer_call(callid, res, &answer, answer_count);
    273         }
    274 }
    275 
    276234int main(int argc, char *argv[])
    277235{
    278         int rc;
    279        
    280236        /* Start the module */
    281         rc = netif_module_start(netif_client_connection);
    282         return rc;
     237        return netif_module_start();
    283238}
    284239
  • uspace/srv/net/nil/eth/eth.c

    r3c106e88 r774e6d1a  
    5454#include <protocol_map.h>
    5555#include <net/device.h>
    56 #include <netif_interface.h>
     56#include <netif_remote.h>
    5757#include <net_interface.h>
    5858#include <nil_interface.h>
     
    239239                switch (IPC_GET_IMETHOD(*icall)) {
    240240                case NET_NIL_DEVICE_STATE:
    241                         nil_device_state_msg_local(0, IPC_GET_DEVICE(icall),
    242                             IPC_GET_STATE(icall));
     241                        nil_device_state_msg_local(0, IPC_GET_DEVICE(*icall),
     242                            IPC_GET_STATE(*icall));
    243243                        ipc_answer_0(iid, EOK);
    244244                        break;
    245245                case NET_NIL_RECEIVED:
    246246                        rc = packet_translate_remote(eth_globals.net_phone,
    247                             &packet, IPC_GET_PACKET(icall));
     247                            &packet, IPC_GET_PACKET(*icall));
    248248                        if (rc == EOK) {
    249249                                rc = nil_received_msg_local(0,
    250                                     IPC_GET_DEVICE(icall), packet, 0);
     250                                    IPC_GET_DEVICE(*icall), packet, 0);
    251251                        }
    252252                        ipc_answer_0(iid, (sysarg_t) rc);
     
    837837
    838838int nil_message_standalone(const char *name, ipc_callid_t callid,
    839     ipc_call_t *call, ipc_call_t *answer, int *answer_count)
     839    ipc_call_t *call, ipc_call_t *answer, size_t *answer_count)
    840840{
    841841        measured_string_t *address;
     
    853853       
    854854        case NET_NIL_DEVICE:
    855                 return eth_device_message(IPC_GET_DEVICE(call),
    856                     IPC_GET_SERVICE(call), IPC_GET_MTU(call));
     855                return eth_device_message(IPC_GET_DEVICE(*call),
     856                    IPC_GET_SERVICE(*call), IPC_GET_MTU(*call));
    857857        case NET_NIL_SEND:
    858858                rc = packet_translate_remote(eth_globals.net_phone, &packet,
    859                     IPC_GET_PACKET(call));
     859                    IPC_GET_PACKET(*call));
    860860                if (rc != EOK)
    861861                        return rc;
    862                 return eth_send_message(IPC_GET_DEVICE(call), packet,
    863                     IPC_GET_SERVICE(call));
     862                return eth_send_message(IPC_GET_DEVICE(*call), packet,
     863                    IPC_GET_SERVICE(*call));
    864864        case NET_NIL_PACKET_SPACE:
    865                 rc = eth_packet_space_message(IPC_GET_DEVICE(call), &addrlen,
     865                rc = eth_packet_space_message(IPC_GET_DEVICE(*call), &addrlen,
    866866                    &prefix, &content, &suffix);
    867867                if (rc != EOK)
    868868                        return rc;
    869                 IPC_SET_ADDR(answer, addrlen);
    870                 IPC_SET_PREFIX(answer, prefix);
    871                 IPC_SET_CONTENT(answer, content);
    872                 IPC_SET_SUFFIX(answer, suffix);
     869                IPC_SET_ADDR(*answer, addrlen);
     870                IPC_SET_PREFIX(*answer, prefix);
     871                IPC_SET_CONTENT(*answer, content);
     872                IPC_SET_SUFFIX(*answer, suffix);
    873873                *answer_count = 4;
    874874                return EOK;
    875875        case NET_NIL_ADDR:
    876                 rc = eth_addr_message(IPC_GET_DEVICE(call), ETH_LOCAL_ADDR,
     876                rc = eth_addr_message(IPC_GET_DEVICE(*call), ETH_LOCAL_ADDR,
    877877                    &address);
    878878                if (rc != EOK)
     
    880880                return measured_strings_reply(address, 1);
    881881        case NET_NIL_BROADCAST_ADDR:
    882                 rc = eth_addr_message(IPC_GET_DEVICE(call), ETH_BROADCAST_ADDR,
     882                rc = eth_addr_message(IPC_GET_DEVICE(*call), ETH_BROADCAST_ADDR,
    883883                    &address);
    884884                if (rc != EOK)
     
    886886                return measured_strings_reply(address, 1);
    887887        case IPC_M_CONNECT_TO_ME:
    888                 return eth_register_message(NIL_GET_PROTO(call),
    889                     IPC_GET_PHONE(call));
     888                return eth_register_message(NIL_GET_PROTO(*call),
     889                    IPC_GET_PHONE(*call));
    890890        }
    891891       
     
    908908        while (true) {
    909909                ipc_call_t answer;
    910                 int answer_count;
     910                size_t count;
    911911               
    912912                /* Clear the answer structure */
    913                 refresh_answer(&answer, &answer_count);
     913                refresh_answer(&answer, &count);
    914914               
    915915                /* Fetch the next message */
     
    919919                /* Process the message */
    920920                int res = nil_module_message_standalone(NAME, callid, &call,
    921                     &answer, &answer_count);
     921                    &answer, &count);
    922922               
    923923                /*
     
    930930               
    931931                /* Answer the message */
    932                 answer_call(callid, res, &answer, answer_count);
     932                answer_call(callid, res, &answer, count);
    933933        }
    934934}
  • uspace/srv/net/nil/eth/eth_header.h

    r3c106e88 r774e6d1a  
    4242
    4343/** Ethernet address length. */
    44 #define ETH_ADDR        6
     44#define ETH_ADDR  6
    4545
    4646/** Ethernet header preamble value. */
    47 #define ETH_PREAMBLE    0x55
     47#define ETH_PREAMBLE  0x55
    4848
    4949/** Ethernet header start of frame value. */
    50 #define ETH_SFD         0xD5
     50#define ETH_SFD  0xD5
    5151
    5252/** IEEE 802.2 unordered information control field. */
    53 #define IEEE_8023_2_UI  0x03
     53#define IEEE_8023_2_UI  0x03
    5454
    5555/** Type definition of the Ethernet header IEEE 802.3 + 802.2 + SNAP extensions.
  • uspace/srv/net/nil/eth/eth_module.c

    r3c106e88 r774e6d1a  
    7878
    7979int nil_module_message_standalone(const char *name, ipc_callid_t callid,
    80     ipc_call_t *call, ipc_call_t *answer, int *answer_count)
     80    ipc_call_t *call, ipc_call_t *answer, size_t *count)
    8181{
    82         return nil_message_standalone(name, callid, call, answer, answer_count);
     82        return nil_message_standalone(name, callid, call, answer, count);
    8383}
    8484
  • uspace/srv/net/nil/nildummy/nildummy.c

    r3c106e88 r774e6d1a  
    4747#include <net/modules.h>
    4848#include <net/device.h>
    49 #include <netif_interface.h>
    5049#include <nil_interface.h>
    5150#include <il_interface.h>
     
    5352#include <net/packet.h>
    5453#include <packet_remote.h>
     54#include <netif_remote.h>
    5555#include <nil_local.h>
    5656
     
    113113                case NET_NIL_DEVICE_STATE:
    114114                        rc = nil_device_state_msg_local(0,
    115                             IPC_GET_DEVICE(icall), IPC_GET_STATE(icall));
     115                            IPC_GET_DEVICE(*icall), IPC_GET_STATE(*icall));
    116116                        ipc_answer_0(iid, (sysarg_t) rc);
    117117                        break;
     
    119119                case NET_NIL_RECEIVED:
    120120                        rc = packet_translate_remote(nildummy_globals.net_phone,
    121                             &packet, IPC_GET_PACKET(icall));
     121                            &packet, IPC_GET_PACKET(*icall));
    122122                        if (rc == EOK) {
    123123                                rc = nil_received_msg_local(0,
    124                                     IPC_GET_DEVICE(icall), packet, 0);
     124                                    IPC_GET_DEVICE(*icall), packet, 0);
    125125                        }
    126126                        ipc_answer_0(iid, (sysarg_t) rc);
     
    375375
    376376int nil_message_standalone(const char *name, ipc_callid_t callid,
    377     ipc_call_t *call, ipc_call_t *answer, int *answer_count)
     377    ipc_call_t *call, ipc_call_t *answer, size_t *answer_count)
    378378{
    379379        measured_string_t *address;
     
    391391       
    392392        case NET_NIL_DEVICE:
    393                 return nildummy_device_message(IPC_GET_DEVICE(call),
    394                     IPC_GET_SERVICE(call), IPC_GET_MTU(call));
     393                return nildummy_device_message(IPC_GET_DEVICE(*call),
     394                    IPC_GET_SERVICE(*call), IPC_GET_MTU(*call));
    395395       
    396396        case NET_NIL_SEND:
    397397                rc = packet_translate_remote(nildummy_globals.net_phone,
    398                     &packet, IPC_GET_PACKET(call));
     398                    &packet, IPC_GET_PACKET(*call));
    399399                if (rc != EOK)
    400400                        return rc;
    401                 return nildummy_send_message(IPC_GET_DEVICE(call), packet,
    402                     IPC_GET_SERVICE(call));
     401                return nildummy_send_message(IPC_GET_DEVICE(*call), packet,
     402                    IPC_GET_SERVICE(*call));
    403403       
    404404        case NET_NIL_PACKET_SPACE:
    405                 rc = nildummy_packet_space_message(IPC_GET_DEVICE(call),
     405                rc = nildummy_packet_space_message(IPC_GET_DEVICE(*call),
    406406                    &addrlen, &prefix, &content, &suffix);
    407407                if (rc != EOK)
    408408                        return rc;
    409                 IPC_SET_ADDR(answer, addrlen);
    410                 IPC_SET_PREFIX(answer, prefix);
    411                 IPC_SET_CONTENT(answer, content);
    412                 IPC_SET_SUFFIX(answer, suffix);
     409                IPC_SET_ADDR(*answer, addrlen);
     410                IPC_SET_PREFIX(*answer, prefix);
     411                IPC_SET_CONTENT(*answer, content);
     412                IPC_SET_SUFFIX(*answer, suffix);
    413413                *answer_count = 4;
    414414                return EOK;
    415415       
    416416        case NET_NIL_ADDR:
    417                 rc = nildummy_addr_message(IPC_GET_DEVICE(call), &address);
     417                rc = nildummy_addr_message(IPC_GET_DEVICE(*call), &address);
    418418                if (rc != EOK)
    419419                        return rc;
     
    421421       
    422422        case NET_NIL_BROADCAST_ADDR:
    423                 rc = nildummy_addr_message(IPC_GET_DEVICE(call), &address);
     423                rc = nildummy_addr_message(IPC_GET_DEVICE(*call), &address);
    424424                if (rc != EOK)
    425425                        return rc;
     
    427427       
    428428        case IPC_M_CONNECT_TO_ME:
    429                 return nildummy_register_message(NIL_GET_PROTO(call),
    430                     IPC_GET_PHONE(call));
     429                return nildummy_register_message(NIL_GET_PROTO(*call),
     430                    IPC_GET_PHONE(*call));
    431431        }
    432432       
     
    449449        while (true) {
    450450                ipc_call_t answer;
    451                 int answer_count;
     451                size_t count;
    452452               
    453453                /* Clear the answer structure */
    454                 refresh_answer(&answer, &answer_count);
     454                refresh_answer(&answer, &count);
    455455               
    456456                /* Fetch the next message */
     
    460460                /* Process the message */
    461461                int res = nil_module_message_standalone(NAME, callid, &call,
    462                     &answer, &answer_count);
     462                    &answer, &count);
    463463               
    464464                /*
     
    471471               
    472472                /* Answer the message */
    473                 answer_call(callid, res, &answer, answer_count);
     473                answer_call(callid, res, &answer, count);
    474474        }
    475475}
  • uspace/srv/net/nil/nildummy/nildummy_module.c

    r3c106e88 r774e6d1a  
    7979
    8080int nil_module_message_standalone(const char *name, ipc_callid_t callid,
    81     ipc_call_t *call, ipc_call_t *answer, int *answer_count)
     81    ipc_call_t *call, ipc_call_t *answer, size_t *count)
    8282{
    83         return nil_message_standalone(name, callid, call, answer, answer_count);
     83        return nil_message_standalone(name, callid, call, answer, count);
    8484}
    8585
  • uspace/srv/net/tl/icmp/icmp.c

    r3c106e88 r774e6d1a  
    696696        case NET_ICMP_DEST_UNREACH:
    697697                rc = packet_translate_remote(icmp_globals.net_phone, &packet,
    698                     IPC_GET_PACKET(call));
     698                    IPC_GET_PACKET(*call));
    699699                if (rc != EOK)
    700700                        return rc;
    701701                return icmp_destination_unreachable_msg_local(0,
    702                     ICMP_GET_CODE(call), ICMP_GET_MTU(call), packet);
     702                    ICMP_GET_CODE(*call), ICMP_GET_MTU(*call), packet);
    703703        case NET_ICMP_SOURCE_QUENCH:
    704704                rc = packet_translate_remote(icmp_globals.net_phone, &packet,
    705                     IPC_GET_PACKET(call));
     705                    IPC_GET_PACKET(*call));
    706706                if (rc != EOK)
    707707                        return rc;
     
    709709        case NET_ICMP_TIME_EXCEEDED:
    710710                rc = packet_translate_remote(icmp_globals.net_phone, &packet,
    711                     IPC_GET_PACKET(call));
     711                    IPC_GET_PACKET(*call));
    712712                if (rc != EOK)
    713713                        return rc;
    714                 return icmp_time_exceeded_msg_local(0, ICMP_GET_CODE(call),
     714                return icmp_time_exceeded_msg_local(0, ICMP_GET_CODE(*call),
    715715                    packet);
    716716        case NET_ICMP_PARAMETERPROB:
    717717                rc = packet_translate_remote(icmp_globals.net_phone, &packet,
    718                     IPC_GET_PACKET(call));
     718                    IPC_GET_PACKET(*call));
    719719                if (rc != EOK)
    720720                        return rc;
    721                 return icmp_parameter_problem_msg_local(0, ICMP_GET_CODE(call),
    722                     ICMP_GET_POINTER(call), packet);
     721                return icmp_parameter_problem_msg_local(0, ICMP_GET_CODE(*call),
     722                    ICMP_GET_POINTER(*call), packet);
    723723        default:
    724724                return ENOTSUP;
     
    787787        bool keep_on_going = true;
    788788        ipc_call_t answer;
    789         int answer_count;
     789        size_t answer_count;
    790790        size_t length;
    791791        struct sockaddr *addr;
     
    894894 */
    895895int icmp_message_standalone(ipc_callid_t callid, ipc_call_t *call,
    896     ipc_call_t *answer, int *answer_count)
     896    ipc_call_t *answer, size_t *answer_count)
    897897{
    898898        packet_t *packet;
     
    903903        case NET_TL_RECEIVED:
    904904                rc = packet_translate_remote(icmp_globals.net_phone, &packet,
    905                     IPC_GET_PACKET(call));
     905                    IPC_GET_PACKET(*call));
    906906                if (rc != EOK)
    907907                        return rc;
    908                 return icmp_received_msg_local(IPC_GET_DEVICE(call), packet,
    909                     SERVICE_ICMP, IPC_GET_ERROR(call));
     908                return icmp_received_msg_local(IPC_GET_DEVICE(*call), packet,
     909                    SERVICE_ICMP, IPC_GET_ERROR(*call));
    910910       
    911911        case NET_ICMP_INIT:
    912                 return icmp_process_client_messages(callid, * call);
     912                return icmp_process_client_messages(callid, *call);
    913913       
    914914        default:
     
    936936        while (true) {
    937937                ipc_call_t answer;
    938                 int answer_count;
     938                size_t answer_count;
    939939               
    940940                /* Clear the answer structure */
  • uspace/srv/net/tl/icmp/icmp_module.c

    r3c106e88 r774e6d1a  
    8686
    8787int tl_module_message_standalone(ipc_callid_t callid, ipc_call_t *call,
    88     ipc_call_t *answer, int *answer_count)
     88    ipc_call_t *answer, size_t *count)
    8989{
    90         return icmp_message_standalone(callid, call, answer, answer_count);
     90        return icmp_message_standalone(callid, call, answer, count);
    9191}
    9292
  • uspace/srv/net/tl/icmp/icmp_module.h

    r3c106e88 r774e6d1a  
    4444extern int icmp_initialize(async_client_conn_t);
    4545extern int icmp_message_standalone(ipc_callid_t, ipc_call_t *, ipc_call_t *,
    46     int *);
     46    size_t *);
    4747
    4848#endif
  • uspace/srv/net/tl/tcp/tcp.c

    r3c106e88 r774e6d1a  
    12621262int
    12631263tcp_message_standalone(ipc_callid_t callid, ipc_call_t *call,
    1264     ipc_call_t *answer, int *answer_count)
     1264    ipc_call_t *answer, size_t *answer_count)
    12651265{
    12661266        packet_t *packet;
     
    12761276//              fibril_rwlock_read_lock(&tcp_globals.lock);
    12771277                rc = packet_translate_remote(tcp_globals.net_phone, &packet,
    1278                     IPC_GET_PACKET(call));
     1278                    IPC_GET_PACKET(*call));
    12791279                if (rc != EOK) {
    12801280//                      fibril_rwlock_read_unlock(&tcp_globals.lock);
    12811281                        return rc;
    12821282                }
    1283                 rc = tcp_received_msg(IPC_GET_DEVICE(call), packet, SERVICE_TCP,
    1284                     IPC_GET_ERROR(call));
     1283                rc = tcp_received_msg(IPC_GET_DEVICE(*call), packet, SERVICE_TCP,
     1284                    IPC_GET_ERROR(*call));
    12851285//              fibril_rwlock_read_unlock(&tcp_globals.lock);
    12861286                return rc;
     
    13231323        bool keep_on_going = true;
    13241324        socket_cores_t local_sockets;
    1325         int app_phone = IPC_GET_PHONE(&call);
     1325        int app_phone = IPC_GET_PHONE(call);
    13261326        struct sockaddr *addr;
    13271327        int socket_id;
     
    13301330        fibril_rwlock_t lock;
    13311331        ipc_call_t answer;
    1332         int answer_count;
     1332        size_t answer_count;
    13331333        tcp_socket_data_t *socket_data;
    13341334        socket_core_t *socket;
     
    25022502        while (true) {
    25032503                ipc_call_t answer;
    2504                 int answer_count;
     2504                size_t answer_count;
    25052505
    25062506                /* Clear the answer structure */
  • uspace/srv/net/tl/tcp/tcp_module.c

    r3c106e88 r774e6d1a  
    8787
    8888int tl_module_message_standalone(ipc_callid_t callid, ipc_call_t *call,
    89     ipc_call_t *answer, int *answer_count)
     89    ipc_call_t *answer, size_t *count)
    9090{
    91         return tcp_message_standalone(callid, call, answer, answer_count);
     91        return tcp_message_standalone(callid, call, answer, count);
    9292}
    9393
  • uspace/srv/net/tl/tcp/tcp_module.h

    r3c106e88 r774e6d1a  
    4444extern int tcp_initialize(async_client_conn_t);
    4545extern int tcp_message_standalone(ipc_callid_t, ipc_call_t *, ipc_call_t *,
    46     int *);
     46    size_t *);
    4747
    4848#endif
  • uspace/srv/net/tl/udp/udp.c

    r3c106e88 r774e6d1a  
    707707        bool keep_on_going = true;
    708708        socket_cores_t local_sockets;
    709         int app_phone = IPC_GET_PHONE(&call);
     709        int app_phone = IPC_GET_PHONE(call);
    710710        struct sockaddr *addr;
    711711        int socket_id;
     
    713713        size_t size;
    714714        ipc_call_t answer;
    715         int answer_count;
     715        size_t answer_count;
    716716        packet_dimension_t *packet_dimension;
    717717
     
    861861 */
    862862int udp_message_standalone(ipc_callid_t callid, ipc_call_t *call,
    863     ipc_call_t *answer, int *answer_count)
     863    ipc_call_t *answer, size_t *answer_count)
    864864{
    865865        packet_t *packet;
     
    871871        case NET_TL_RECEIVED:
    872872                rc = packet_translate_remote(udp_globals.net_phone, &packet,
    873                     IPC_GET_PACKET(call));
     873                    IPC_GET_PACKET(*call));
    874874                if (rc != EOK)
    875875                        return rc;
    876                 return udp_received_msg(IPC_GET_DEVICE(call), packet,
    877                     SERVICE_UDP, IPC_GET_ERROR(call));
     876                return udp_received_msg(IPC_GET_DEVICE(*call), packet,
     877                    SERVICE_UDP, IPC_GET_ERROR(*call));
    878878        case IPC_M_CONNECT_TO_ME:
    879                 return udp_process_client_messages(callid, * call);
     879                return udp_process_client_messages(callid, *call);
    880880        }
    881881
     
    898898        while (true) {
    899899                ipc_call_t answer;
    900                 int answer_count;
     900                size_t answer_count;
    901901               
    902902                /* Clear the answer structure */
  • uspace/srv/net/tl/udp/udp_module.c

    r3c106e88 r774e6d1a  
    8787
    8888int tl_module_message_standalone(ipc_callid_t callid, ipc_call_t *call,
    89     ipc_call_t *answer, int *answer_count)
     89    ipc_call_t *answer, size_t *count)
    9090{
    91         return udp_message_standalone(callid, call, answer, answer_count);
     91        return udp_message_standalone(callid, call, answer, count);
    9292}
    9393
  • uspace/srv/net/tl/udp/udp_module.h

    r3c106e88 r774e6d1a  
    4444extern int udp_initialize(async_client_conn_t);
    4545extern int udp_message_standalone(ipc_callid_t, ipc_call_t *, ipc_call_t *,
    46     int *);
     46    size_t *);
    4747
    4848#endif
Note: See TracChangeset for help on using the changeset viewer.