Changeset a64c64d in mainline for uspace/srv/net/il/ip


Ignore:
Timestamp:
2010-03-09T22:24:31Z (16 years ago)
Author:
Lukas Mejdrech <lukasmejdrech@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
74520daf
Parents:
9f2ea28
Message:
  • code reorganization (no functional change)
Location:
uspace/srv/net/il/ip
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/il/ip/ip.h

    r9f2ea28 ra64c64d  
    106106 */
    107107struct  ip_netif{
    108         /** Device identifier.
    109          */
    110         device_id_t device_id;
    111         /** Netif module service.
    112          */
    113         services_t service;
    114         /** Netif module phone.
    115          */
    116         int phone;
    117108        /** ARP module.
    118109         *  Assigned if using ARP.
    119110         */
    120111        module_ref arp;
     112        /** Broadcast address.
     113         */
     114        in_addr_t broadcast;
     115        /** Device identifier.
     116         */
     117        device_id_t device_id;
     118        /** Indicates whether using DHCP.
     119         */
     120        int dhcp;
    121121        /** IP version.
    122122         */
    123123        int ipv;
    124         /** Indicates whether using DHCP.
    125          */
    126         int dhcp;
     124        /** Packet dimension.
     125         */
     126        packet_dimension_t packet_dimension;
     127        /** Netif module phone.
     128         */
     129        int phone;
     130        /** Routing table.
     131         */
     132        ip_routes_t routes;
    127133        /** Indicates whether IP routing is enabled.
    128134         */
    129135        int routing;
     136        /** Netif module service.
     137         */
     138        services_t service;
    130139        /** Device state.
    131140         */
    132141        device_state_t state;
    133         /** Broadcast address.
    134          */
    135         in_addr_t broadcast;
    136         /** Routing table.
    137          */
    138         ip_routes_t routes;
    139         /** Packet dimension.
    140          */
    141         packet_dimension_t packet_dimension;
    142142};
    143143
     
    145145 */
    146146struct ip_proto{
     147        /** Protocol module phone.
     148         */
     149        int phone;
    147150        /** Protocol number.
    148151         */
    149152        int protocol;
     153        /** Protocol packet receiving function.
     154         */
     155        tl_received_msg_t received_msg;
    150156        /** Protocol module service.
    151157         */
    152158        services_t service;
    153         /** Protocol module phone.
    154          */
    155         int phone;
    156         /** Protocol packet receiving function.
    157          */
    158         tl_received_msg_t received_msg;
    159159};
    160160
     
    165165         */
    166166        in_addr_t address;
    167         /** Target network mask.
    168          */
    169         in_addr_t netmask;
    170167        /** Gateway.
    171168         */
     
    174171         */
    175172        ip_netif_ref netif;
     173        /** Target network mask.
     174         */
     175        in_addr_t netmask;
    176176};
    177177
     
    179179 */
    180180struct  ip_globals{
     181        /** Default client connection function for support modules.
     182         */
     183        async_client_conn_t client_connection;
     184        /** Default gateway.
     185         */
     186        ip_route_t gateway;
     187        /** Safety lock.
     188         */
     189        fibril_rwlock_t lock;
     190        /** Known support modules.
     191         */
     192        modules_t modules;
    181193        /** Networking module phone.
    182194         */
     
    188200         */
    189201        fibril_rwlock_t netifs_lock;
     202        /** Packet counter.
     203         */
     204        uint16_t packet_counter;
    190205        /** Registered protocols.
    191206         */
     
    194209         */
    195210        fibril_rwlock_t protos_lock;
    196         /** Default gateway.
    197          */
    198         ip_route_t gateway;
    199         /** Known support modules.
    200          */
    201         modules_t modules;
    202         /** Default client connection function for support modules.
    203          */
    204         async_client_conn_t client_connection;
    205         /** Packet counter.
    206          */
    207         uint16_t packet_counter;
    208         /** Safety lock.
    209          */
    210         fibril_rwlock_t lock;
    211211};
    212212
  • uspace/srv/net/il/ip/ip_client.c

    r9f2ea28 ra64c64d  
    4848#include "ip_header.h"
    4949
    50 int ip_client_prepare_packet(packet_t packet, ip_protocol_t protocol, ip_ttl_t ttl, ip_tos_t tos, int dont_fragment, size_t ipopt_length){
    51         ip_header_ref header;
    52         uint8_t * data;
    53         size_t padding;
    54 
    55         padding =  ipopt_length % 4;
    56         if(padding){
    57                 padding = 4 - padding;
    58                 ipopt_length += padding;
    59         }
    60         data = (uint8_t *) packet_prefix(packet, sizeof(ip_header_t) + padding);
    61         if(! data){
    62                 return ENOMEM;
    63         }
    64         while(padding --){
    65                 data[sizeof(ip_header_t) + padding] = IPOPT_NOOP;
    66         }
    67         header = (ip_header_ref) data;
    68         header->header_length = IP_COMPUTE_HEADER_LENGTH(sizeof(ip_header_t) + ipopt_length);
    69         header->ttl = (ttl ? ttl : IPDEFTTL); //(((ttl) <= MAXTTL) ? ttl : MAXTTL) : IPDEFTTL;
    70         header->tos = tos;
    71         header->protocol = protocol;
    72         if(dont_fragment){
    73                 header->flags = IPFLAG_DONT_FRAGMENT;
    74         }
    75         return EOK;
    76 }
    77 
    78 int ip_client_process_packet(packet_t packet, ip_protocol_t * protocol, ip_ttl_t * ttl, ip_tos_t * tos, int * dont_fragment, size_t * ipopt_length){
    79         ip_header_ref header;
    80 
    81         header = (ip_header_ref) packet_get_data(packet);
    82         if((! header)
    83                 || (packet_get_data_length(packet) < sizeof(ip_header_t))){
    84                 return ENOMEM;
    85         }
    86         if(protocol){
    87                 *protocol = header->protocol;
    88         }
    89         if(ttl){
    90                 *ttl = header->ttl;
    91         }
    92         if(tos){
    93                 *tos = header->tos;
    94         }
    95         if(dont_fragment){
    96                 *dont_fragment = header->flags &IPFLAG_DONT_FRAGMENT;
    97         }
    98         if(ipopt_length){
    99                 *ipopt_length = IP_HEADER_LENGTH(header) - sizeof(ip_header_t);
    100                 return sizeof(ip_header_t);
    101         }else{
    102                 return IP_HEADER_LENGTH(header);
    103         }
    104 }
    105 
    10650size_t ip_client_header_length(packet_t packet){
    10751        ip_header_ref header;
     
    11357        }
    11458        return IP_HEADER_LENGTH(header);
    115 }
    116 
    117 int ip_client_set_pseudo_header_data_length(ip_pseudo_header_ref header, size_t headerlen, size_t data_length){
    118         ipv4_pseudo_header_ref header_in;
    119 
    120         if(! header){
    121                 return EBADMEM;
    122         }
    123         if(headerlen == sizeof(ipv4_pseudo_header_t)){
    124                 header_in = (ipv4_pseudo_header_ref) header;
    125                 header_in->data_length = htons(data_length);
    126                 return EOK;
    127         }else{
    128                 return EINVAL;
    129         }
    13059}
    13160
     
    14069                return EINVAL;
    14170        }
     71
    14272        switch(src->sa_family){
    14373                case AF_INET:
     
    171101}
    172102
     103int ip_client_prepare_packet(packet_t packet, ip_protocol_t protocol, ip_ttl_t ttl, ip_tos_t tos, int dont_fragment, size_t ipopt_length){
     104        ip_header_ref header;
     105        uint8_t * data;
     106        size_t padding;
     107
     108        // compute the padding if IP options are set
     109        // multiple of 4 bytes
     110        padding =  ipopt_length % 4;
     111        if(padding){
     112                padding = 4 - padding;
     113                ipopt_length += padding;
     114        }
     115
     116        // prefix the header
     117        data = (uint8_t *) packet_prefix(packet, sizeof(ip_header_t) + padding);
     118        if(! data){
     119                return ENOMEM;
     120        }
     121
     122        // add the padding
     123        while(padding --){
     124                data[sizeof(ip_header_t) + padding] = IPOPT_NOOP;
     125        }
     126
     127        // set the header
     128        header = (ip_header_ref) data;
     129        header->header_length = IP_COMPUTE_HEADER_LENGTH(sizeof(ip_header_t) + ipopt_length);
     130        header->ttl = (ttl ? ttl : IPDEFTTL); //(((ttl) <= MAXTTL) ? ttl : MAXTTL) : IPDEFTTL;
     131        header->tos = tos;
     132        header->protocol = protocol;
     133
     134        if(dont_fragment){
     135                header->flags = IPFLAG_DONT_FRAGMENT;
     136        }
     137        return EOK;
     138}
     139
     140int ip_client_process_packet(packet_t packet, ip_protocol_t * protocol, ip_ttl_t * ttl, ip_tos_t * tos, int * dont_fragment, size_t * ipopt_length){
     141        ip_header_ref header;
     142
     143        header = (ip_header_ref) packet_get_data(packet);
     144        if((! header)
     145                || (packet_get_data_length(packet) < sizeof(ip_header_t))){
     146                return ENOMEM;
     147        }
     148
     149        if(protocol){
     150                *protocol = header->protocol;
     151        }
     152        if(ttl){
     153                *ttl = header->ttl;
     154        }
     155        if(tos){
     156                *tos = header->tos;
     157        }
     158        if(dont_fragment){
     159                *dont_fragment = header->flags &IPFLAG_DONT_FRAGMENT;
     160        }
     161        if(ipopt_length){
     162                *ipopt_length = IP_HEADER_LENGTH(header) - sizeof(ip_header_t);
     163                return sizeof(ip_header_t);
     164        }else{
     165                return IP_HEADER_LENGTH(header);
     166        }
     167}
     168
     169int ip_client_set_pseudo_header_data_length(ip_pseudo_header_ref header, size_t headerlen, size_t data_length){
     170        ipv4_pseudo_header_ref header_in;
     171
     172        if(! header){
     173                return EBADMEM;
     174        }
     175
     176        if(headerlen == sizeof(ipv4_pseudo_header_t)){
     177                header_in = (ipv4_pseudo_header_ref) header;
     178                header_in->data_length = htons(data_length);
     179                return EOK;
     180        // TODO IPv6
     181        }else{
     182                return EINVAL;
     183        }
     184}
     185
    173186/** @}
    174187 */
  • uspace/srv/net/il/ip/ip_header.h

    r9f2ea28 ra64c64d  
    4242#include <sys/types.h>
    4343
    44 /** Returns the actual IP header length in bytes.
    45  *  @param[in] header The IP packet header.
    46  */
    47 #define IP_HEADER_LENGTH(header)                ((header)->header_length * 4u)
     44/** Returns the fragment offest high bits.
     45 *  @param[in] length The prefixed data total length.
     46 */
     47#define IP_COMPUTE_FRAGMENT_OFFSET_HIGH(length) ((((length) / 8u) &0x1F00) >> 8)
     48
     49/** Returns the fragment offest low bits.
     50 *  @param[in] length The prefixed data total length.
     51 */
     52#define IP_COMPUTE_FRAGMENT_OFFSET_LOW(length) (((length) / 8u) &0xFF)
    4853
    4954/** Returns the IP header length.
     
    5257#define IP_COMPUTE_HEADER_LENGTH(length)                ((uint8_t) ((length) / 4u))
    5358
     59/** Returns the fragment offest.
     60 *  @param[in] header The IP packet header.
     61 */
     62#define IP_FRAGMENT_OFFSET(header) ((((header)->fragment_offset_high << 8) + (header)->fragment_offset_low) * 8u)
     63
     64/** Returns the IP packet header checksum.
     65 *  @param[in] header The IP packet header.
     66 */
     67#define IP_HEADER_CHECKSUM(header)      (htons(ip_checksum((uint8_t *)(header), IP_HEADER_LENGTH(header))))
     68
     69/** Returns the actual IP packet data length.
     70 *  @param[in] header The IP packet header.
     71 */
     72#define IP_HEADER_DATA_LENGTH(header)   (IP_TOTAL_LENGTH(header) - IP_HEADER_LENGTH(header))
     73
     74/** Returns the actual IP header length in bytes.
     75 *  @param[in] header The IP packet header.
     76 */
     77#define IP_HEADER_LENGTH(header)                ((header)->header_length * 4u)
     78
    5479/** Returns the actual IP packet total length.
    5580 *  @param[in] header The IP packet header.
     
    5782#define IP_TOTAL_LENGTH(header)         ntohs((header)->total_length)
    5883
    59 /** Returns the actual IP packet data length.
    60  *  @param[in] header The IP packet header.
    61  */
    62 #define IP_HEADER_DATA_LENGTH(header)   (IP_TOTAL_LENGTH(header) - IP_HEADER_LENGTH(header))
    63 
    64 /** Returns the IP packet header checksum.
    65  *  @param[in] header The IP packet header.
    66  */
    67 #define IP_HEADER_CHECKSUM(header)      (htons(ip_checksum((uint8_t *)(header), IP_HEADER_LENGTH(header))))
    68 
    69 /** Returns the fragment offest.
    70  *  @param[in] header The IP packet header.
    71  */
    72 #define IP_FRAGMENT_OFFSET(header) ((((header)->fragment_offset_high << 8) + (header)->fragment_offset_low) * 8u)
    73 
    74 /** Returns the fragment offest high bits.
    75  *  @param[in] length The prefixed data total length.
    76  */
    77 #define IP_COMPUTE_FRAGMENT_OFFSET_HIGH(length) ((((length) / 8u) &0x1F00) >> 8)
    78 
    79 /** Returns the fragment offest low bits.
    80  *  @param[in] length The prefixed data total length.
    81  */
    82 #define IP_COMPUTE_FRAGMENT_OFFSET_LOW(length) (((length) / 8u) &0xFF)
     84/** @name IP flags definitions
     85 */
     86/*@{*/
     87
     88/** Fragment flag field shift.
     89 */
     90#define IPFLAG_FRAGMENT_SHIFT           1
     91
     92/** Fragmented flag field shift.
     93 */
     94#define IPFLAG_FRAGMENTED_SHIFT         0
     95
     96/** Don't fragment flag value.
     97 *  Permits the packet fragmentation.
     98 */
     99#define IPFLAG_DONT_FRAGMENT            (0x1 << IPFLAG_FRAGMENT_SHIFT)
     100
     101/** Last fragment flag value.
     102 *  Indicates the last packet fragment.
     103 */
     104#define IPFLAG_LAST_FRAGMENT            (0x0 << IPFLAG_FRAGMENTED_SHIFT)
     105
     106/** May fragment flag value.
     107 *  Allows the packet fragmentation.
     108 */
     109#define IPFLAG_MAY_FRAGMENT                     (0x0 << IPFLAG_FRAGMENT_SHIFT)
     110
     111/** More fragments flag value.
     112 *  Indicates that more packet fragments follow.
     113 */
     114#define IPFLAG_MORE_FRAGMENTS           (0x1 << IPFLAG_FRAGMENTED_SHIFT)
     115
     116/*@}*/
    83117
    84118/** Type definition of the internet header.
     
    91125 */
    92126typedef ip_header_t *           ip_header_ref;
     127
     128/** Type definition of the internet option header.
     129 *  @see ip_header
     130 */
     131typedef struct ip_option        ip_option_t;
     132
     133/** Type definition of the internet option header pointer.
     134 *  @see ip_header
     135 */
     136typedef ip_option_t *           ip_option_ref;
     137
     138/** Type definition of the internet version 4 pseudo header.
     139 *  @see ipv4_pseudo_header
     140 */
     141typedef struct ipv4_pseudo_header       ipv4_pseudo_header_t;
     142
     143/** Type definition of the internet version 4 pseudo header pointer.
     144 *  @see ipv4_pseudo_header
     145 */
     146typedef ipv4_pseudo_header_t *          ipv4_pseudo_header_ref;
    93147
    94148/** Internet header.
     
    171225} __attribute__ ((packed));
    172226
    173 /** Type definition of the internet option header.
    174  *  @see ip_header
    175  */
    176 typedef struct ip_option        ip_option_t;
    177 
    178 /** Type definition of the internet option header pointer.
    179  *  @see ip_header
    180  */
    181 typedef ip_option_t *           ip_option_ref;
    182 
    183227/** Internet option header.
    184228 *  Only type field is always valid.
     
    212256} __attribute__ ((packed));
    213257
    214 /** @name IP flags definitions
    215  */
    216 /*@{*/
    217 
    218 /** Fragment flag field shift.
    219  */
    220 #define IPFLAG_FRAGMENT_SHIFT           1
    221 
    222 /** Fragmented flag field shift.
    223  */
    224 #define IPFLAG_FRAGMENTED_SHIFT         0
    225 
    226 /** May fragment flag value.
    227  *  Allows the packet fragmentation.
    228  */
    229 #define IPFLAG_MAY_FRAGMENT                     (0x0 << IPFLAG_FRAGMENT_SHIFT)
    230 
    231 /** Don't fragment flag value.
    232  *  Permits the packet fragmentation.
    233  */
    234 #define IPFLAG_DONT_FRAGMENT            (0x1 << IPFLAG_FRAGMENT_SHIFT)
    235 
    236 /** Last fragment flag value.
    237  *  Indicates the last packet fragment.
    238  */
    239 #define IPFLAG_LAST_FRAGMENT            (0x0 << IPFLAG_FRAGMENTED_SHIFT)
    240 
    241 /** More fragments flag value.
    242  *  Indicates that more packet fragments follow.
    243  */
    244 #define IPFLAG_MORE_FRAGMENTS           (0x1 << IPFLAG_FRAGMENTED_SHIFT)
    245 
    246 /*@}*/
    247 
    248 /** Type definition of the internet version 4 pseudo header.
    249  *  @see ipv4_pseudo_header
    250  */
    251 typedef struct ipv4_pseudo_header       ipv4_pseudo_header_t;
    252 
    253 /** Type definition of the internet version 4 pseudo header pointer.
    254  *  @see ipv4_pseudo_header
    255  */
    256 typedef ipv4_pseudo_header_t *          ipv4_pseudo_header_ref;
    257 
    258258/** Internet version 4 pseudo header.
    259259 */
  • uspace/srv/net/il/ip/ip_messages.h

    r9f2ea28 ra64c64d  
    5151         */
    5252        NET_IP_ADD_ROUTE = NET_IP_FIRST,
    53         /** Sets the default gateway.
    54          *  @see ip_set_default_gateway()
     53        /** Gets the actual route information.
     54         *  @see ip_get_route()
    5555         */
    56         NET_IP_SET_GATEWAY,
     56        NET_IP_GET_ROUTE,
    5757        /** Processes the received error notification.
    5858         *  @see ip_received_error_msg()
    5959         */
    6060        NET_IP_RECEIVED_ERROR,
    61         /** Gets the actual route information.
    62          *  @see ip_get_route()
     61        /** Sets the default gateway.
     62         *  @see ip_set_default_gateway()
    6363         */
    64         NET_IP_GET_ROUTE
     64        NET_IP_SET_GATEWAY
    6565} ip_messages;
    6666
     
    6969/*@{*/
    7070
     71/** Returns the address message parameter.
     72 *  @param[in] call The message call structure.
     73 */
     74#define IP_GET_ADDRESS(call)            ({in_addr_t addr; addr.s_addr = IPC_GET_ARG3(*call); addr;})
     75
    7176/** Returns the gateway message parameter.
    7277 *  @param[in] call The message call structure.
     
    7479#define IP_GET_GATEWAY(call)            ({in_addr_t addr; addr.s_addr = IPC_GET_ARG2(*call); addr;})
    7580
    76 /** Returns the address message parameter.
    77  *  @param[in] call The message call structure.
     81/** Sets the header length in the message answer.
     82 *  @param[out] answer The message answer structure.
    7883 */
    79 #define IP_GET_ADDRESS(call)            ({in_addr_t addr; addr.s_addr = IPC_GET_ARG3(*call); addr;})
     84#define IP_SET_HEADERLEN(answer)        ((size_t *) &IPC_GET_ARG2(*answer))
    8085
    8186/** Returns the network mask message parameter.
     
    8994#define IP_GET_PROTOCOL(call)           ((ip_protocol_t) IPC_GET_ARG1(*call))
    9095
    91 /** Sets the header length in the message answer.
    92  *  @param[out] answer The message answer structure.
    93  */
    94 #define IP_SET_HEADERLEN(answer)        ((size_t *) &IPC_GET_ARG2(*answer))
    95 
    9696/*@}*/
    9797
  • uspace/srv/net/il/ip/ip_module.c

    r9f2ea28 ra64c64d  
    5858#define NAME    "IP protocol"
    5959
     60/** IP module global data.
     61 */
     62extern ip_globals_t     ip_globals;
     63
     64/** Processes the IP message.
     65 *  @param[in] callid The message identifier.
     66 *  @param[in] call The message parameters.
     67 *  @param[out] answer The message answer parameters.
     68 *  @param[out] answer_count The last parameter for the actual answer in the answer parameter.
     69 *  @returns EOK on success.
     70 *  @returns Other error codes as defined for the ip_message() function.
     71 */
     72int module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
     73
    6074/** Prints the module name.
    6175 *  @see NAME
     
    7286int module_start(async_client_conn_t client_connection);
    7387
    74 /** Processes the IP message.
    75  *  @param[in] callid The message identifier.
    76  *  @param[in] call The message parameters.
    77  *  @param[out] answer The message answer parameters.
    78  *  @param[out] answer_count The last parameter for the actual answer in the answer parameter.
    79  *  @returns EOK on success.
    80  *  @returns Other error codes as defined for the ip_message() function.
    81  */
    82 int module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
    83 
    84 /** IP module global data.
    85  */
    86 extern ip_globals_t     ip_globals;
     88int module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
     89        return ip_message(callid, call, answer, answer_count);
     90}
    8791
    8892void module_print_name(void){
     
    110114}
    111115
    112 int module_message(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
    113         return ip_message(callid, call, answer, answer_count);
    114 }
    115 
    116116/** @}
    117117 */
  • uspace/srv/net/il/ip/ip_remote.c

    r9f2ea28 ra64c64d  
    5252#include "ip_messages.h"
    5353
    54 int ip_device_req(int ip_phone, device_id_t device_id, services_t service){
    55         return generic_device_req(ip_phone, NET_IL_DEVICE, device_id, 0, service);
     54int ip_add_route_req(int ip_phone, device_id_t device_id, in_addr_t address, in_addr_t netmask, in_addr_t gateway){
     55        return (int) async_req_4_0(ip_phone, NET_IP_ADD_ROUTE, (ipcarg_t) device_id, (ipcarg_t) gateway.s_addr, (ipcarg_t) address.s_addr, (ipcarg_t) netmask.s_addr);
    5656}
    5757
    58 int ip_send_msg(int ip_phone, device_id_t device_id, packet_t packet, services_t sender, services_t error){
    59         return generic_send_msg(ip_phone, NET_IL_SEND, device_id, packet_get_id(packet), sender, error);
     58int ip_bind_service(services_t service, int protocol, services_t me, async_client_conn_t receiver, tl_received_msg_t tl_received_msg){
     59        return (int) bind_service(service, (ipcarg_t) protocol, me, service, receiver);
    6060}
    6161
     
    6464}
    6565
    66 int ip_add_route_req(int ip_phone, device_id_t device_id, in_addr_t address, in_addr_t netmask, in_addr_t gateway){
    67         return (int) async_req_4_0(ip_phone, NET_IP_ADD_ROUTE, (ipcarg_t) device_id, (ipcarg_t) gateway.s_addr, (ipcarg_t) address.s_addr, (ipcarg_t) netmask.s_addr);
    68 }
    69 
    70 int ip_set_gateway_req(int ip_phone, device_id_t device_id, in_addr_t gateway){
    71         return (int) async_req_2_0(ip_phone, NET_IP_SET_GATEWAY, (ipcarg_t) device_id, (ipcarg_t) gateway.s_addr);
    72 }
    73 
    74 int ip_packet_size_req(int ip_phone, device_id_t device_id, packet_dimension_ref packet_dimension){
    75         return generic_packet_size_req(ip_phone, NET_IL_PACKET_SPACE, device_id, packet_dimension);
    76 }
    77 
    78 int ip_bind_service(services_t service, int protocol, services_t me, async_client_conn_t receiver, tl_received_msg_t tl_received_msg){
    79         return (int) bind_service(service, (ipcarg_t) protocol, me, service, receiver);
    80 }
    81 
    82 int ip_received_error_msg(int ip_phone, device_id_t device_id, packet_t packet, services_t target, services_t error){
    83         return generic_received_msg(ip_phone, NET_IP_RECEIVED_ERROR, device_id, packet_get_id(packet), target, error);
     66int ip_device_req(int ip_phone, device_id_t device_id, services_t service){
     67        return generic_device_req(ip_phone, NET_IL_DEVICE, device_id, 0, service);
    8468}
    8569
     
    9579                return EBADMEM;
    9680        }
     81
    9782        *header = NULL;
    9883        message_id = async_send_1(ip_phone, NET_IP_GET_ROUTE, (ipcarg_t) protocol, &answer);
     
    10893        }
    10994        async_wait_for(message_id, &result);
     95
    11096        if((result != EOK) && (*header)){
    11197                free(*header);
     
    116102}
    117103
     104int ip_packet_size_req(int ip_phone, device_id_t device_id, packet_dimension_ref packet_dimension){
     105        return generic_packet_size_req(ip_phone, NET_IL_PACKET_SPACE, device_id, packet_dimension);
     106}
     107
     108int ip_received_error_msg(int ip_phone, device_id_t device_id, packet_t packet, services_t target, services_t error){
     109        return generic_received_msg(ip_phone, NET_IP_RECEIVED_ERROR, device_id, packet_get_id(packet), target, error);
     110}
     111
     112int ip_send_msg(int ip_phone, device_id_t device_id, packet_t packet, services_t sender, services_t error){
     113        return generic_send_msg(ip_phone, NET_IL_SEND, device_id, packet_get_id(packet), sender, error);
     114}
     115
     116int ip_set_gateway_req(int ip_phone, device_id_t device_id, in_addr_t gateway){
     117        return (int) async_req_2_0(ip_phone, NET_IP_SET_GATEWAY, (ipcarg_t) device_id, (ipcarg_t) gateway.s_addr);
     118}
     119
    118120/** @}
    119121 */
Note: See TracChangeset for help on using the changeset viewer.