Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 753bca3 in mainline


Ignore:
Timestamp:
2010-10-13T22:38:16Z (10 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
master
Children:
10056483, b2a109d9
Parents:
f3b4051
Message:

Move ICMP client stuff from libsocket to standard library.

Location:
uspace
Files:
1 added
1 deleted
12 edited
5 moved

Legend:

Unmodified
Added
Removed
  • uspace/app/netecho/print_error.c

    rf3b4051 r753bca3  
    3838#include <errno.h>
    3939
    40 #include <icmp_codes.h>
     40#include <net/icmp_codes.h>
    4141
    4242#include "print_error.h"
  • uspace/app/ping/ping.c

    rf3b4051 r753bca3  
    4545#include <arg_parse.h>
    4646
    47 #include <icmp_api.h>
     47#include <net/icmp_api.h>
    4848#include <net/in.h>
    4949#include <net/in6.h>
  • uspace/lib/c/Makefile

    rf3b4051 r753bca3  
    100100        generic/vfs/canonify.c \
    101101        generic/net/inet.c \
     102        generic/net/icmp_common.c \
     103        generic/net/icmp_api.c \
    102104        generic/net/modules.c \
    103105        generic/net/packet.c \
  • uspace/lib/c/generic/net/icmp_common.c

    rf3b4051 r753bca3  
    2727 */
    2828
    29 /** @addtogroup icmp
     29/** @addtogroup libc
    3030 *  @{
    3131 */
    3232
    3333/** @file
    34  *  ICMP application interface implementation.
    35  *  @see icmp_api.h
     34 * ICMP common interface implementation.
     35 * @see icmp_common.h
    3636 */
    3737
    38 #include <net/socket_codes.h>
    39 #include <net/inet.h>
     38#include <net/modules.h>
     39#include <net/icmp_common.h>
     40
     41#include <ipc/services.h>
     42#include <ipc/icmp.h>
     43
     44#include <sys/time.h>
    4045#include <async.h>
    4146
    42 #include <ipc/ipc.h>
    43 #include <ipc/services.h>
     47/** Connects to the ICMP module.
     48 *
     49 * @param service       The ICMP module service. Ignored parameter.
     50 * @param[in] timeout   The connection timeout in microseconds. No timeout if
     51 *                      set to zero.
     52 * @returns             The ICMP module phone on success.
     53 * @returns             ETIMEOUT if the connection timeouted.
     54 */
     55int icmp_connect_module(services_t service, suseconds_t timeout)
     56{
     57        int phone;
    4458
    45 #include <sys/types.h>
     59        phone = connect_to_service_timeout(SERVICE_ICMP, timeout);
     60        if (phone >= 0)
     61                async_req_0_0(phone, NET_ICMP_INIT);
    4662
    47 #include <net/modules.h>
    48 #include <icmp_api.h>
    49 #include <net/ip_codes.h>
    50 #include <icmp_messages.h>
    51 
    52 int icmp_echo_msg(int icmp_phone, size_t size, mseconds_t timeout, ip_ttl_t ttl, ip_tos_t tos, int dont_fragment, const struct sockaddr * addr, socklen_t addrlen){
    53         aid_t message_id;
    54         ipcarg_t result;
    55 
    56         if(addrlen <= 0){
    57                 return EINVAL;
    58         }
    59         message_id = async_send_5(icmp_phone, NET_ICMP_ECHO, size, timeout, ttl, tos, (ipcarg_t) dont_fragment, NULL);
    60         // send the address
    61         async_data_write_start(icmp_phone, addr, (size_t) addrlen);
    62         // timeout version may cause inconsistency - there is also an inner timer
    63         // return async_wait_timeout(message_id, &result, timeout);
    64         async_wait_for(message_id, &result);
    65         return (int) result;
     63        return phone;
    6664}
    6765
  • uspace/lib/c/include/ipc/icmp.h

    rf3b4051 r753bca3  
    2727 */
    2828
    29 /** @addtogroup icmp
    30  *  @{
     29/** @addtogroup libc
     30 * @{
    3131 */
    3232
    3333/** @file
    34  *  ICMP module messages.
    35  *  @see icmp_interface.h
     34 * ICMP module messages.
     35 * @see icmp_interface.h
    3636 */
    3737
    38 #ifndef __NET_ICMP_MESSAGES__
    39 #define __NET_ICMP_MESSAGES__
     38#ifndef LIBC_ICMP_MESSAGES_
     39#define LIBC_ICMP_MESSAGES_
    4040
    4141#include <ipc/ipc.h>
    4242#include <ipc/net.h>
    4343#include <sys/types.h>
     44#include <sys/time.h>
    4445
    45 #include <icmp_codes.h>
     46#include <net/icmp_codes.h>
    4647
    47 /** ICMP module messages.
    48  */
    49 typedef enum{
    50         /** Sends echo request.
    51          *  @see icmp_echo()
    52          */
     48/** ICMP module messages. */
     49typedef enum {
     50        /** Sends echo request. @see icmp_echo() */
    5351        NET_ICMP_ECHO = NET_ICMP_FIRST,
    54         /** Sends destination unreachable error message.
    55          *  @see icmp_destination_unreachable_msg()
     52       
     53        /**
     54         * Sends destination unreachable error message.
     55         * @see icmp_destination_unreachable_msg()
    5656         */
    5757        NET_ICMP_DEST_UNREACH,
    58         /** Sends source quench error message.
    59          *  @see icmp_source_quench_msg()
     58       
     59        /**
     60         * Sends source quench error message.
     61         * @see icmp_source_quench_msg()
    6062         */
    6163        NET_ICMP_SOURCE_QUENCH,
    62         /** Sends time exceeded error message.
    63          *  @see icmp_time_exceeded_msg()
     64       
     65        /**
     66         * Sends time exceeded error message.
     67         * @see icmp_time_exceeded_msg()
    6468         */
    6569        NET_ICMP_TIME_EXCEEDED,
    66         /** Sends parameter problem error message.
    67          *  @see icmp_parameter_problem_msg()
     70       
     71        /**
     72         * Sends parameter problem error message.
     73         * @see icmp_parameter_problem_msg()
    6874         */
    6975        NET_ICMP_PARAMETERPROB,
    70         /** Initializes new connection.
    71         */
     76       
     77        /** Initializes new connection. */
    7278        NET_ICMP_INIT
    7379} icmp_messages;
    7480
    75 /** @name ICMP specific message parameters definitions
    76  */
     81/** @name ICMP specific message parameters definitions */
    7782/*@{*/
    7883
    7984/** Returns the ICMP code message parameter.
    80  *  @param[in] call The message call structure.
     85 *
     86 * @param[in] call      The message call structure.
    8187 */
    8288#define ICMP_GET_CODE(call) \
    83         ({icmp_code_t code = (icmp_code_t) IPC_GET_ARG1(*call); code;})
     89        ({ \
     90                icmp_code_t code = (icmp_code_t) IPC_GET_ARG1(*call); \
     91                code; \
     92        })
    8493
    8594/** Returns the ICMP link MTU message parameter.
    86  *  @param[in] call The message call structure.
     95 *
     96 * @param[in] call      The message call structure.
    8797 */
    8898#define ICMP_GET_MTU(call) \
    89         ({icmp_param_t mtu = (icmp_param_t) IPC_GET_ARG3(*call); mtu;})
     99        ({ \
     100                icmp_param_t mtu = (icmp_param_t) IPC_GET_ARG3(*call); \
     101                mtu; \
     102        })
    90103
    91104/** Returns the pointer message parameter.
    92  *  @param[in] call The message call structure.
     105 *
     106 * @param[in] call      The message call structure.
    93107 */
    94108#define ICMP_GET_POINTER(call) \
    95         ({icmp_param_t pointer = (icmp_param_t) IPC_GET_ARG3(*call); pointer;})
     109        ({ \
     110                icmp_param_t pointer = (icmp_param_t) IPC_GET_ARG3(*call); \
     111                pointer; \
     112        })
    96113
    97114/** Returns the size message parameter.
    98  *  @param[in] call The message call structure.
     115 *
     116 * @param[in] call      The message call structure.
    99117 */
    100118#define ICMP_GET_SIZE(call) \
    101         ({size_t size = (size_t) IPC_GET_ARG1(call); size;})
     119        ({ \
     120                size_t size = (size_t) IPC_GET_ARG1(call); \
     121                size; \
     122        })
    102123
    103124/** Returns the timeout message parameter.
    104  *  @param[in] call The message call structure.
     125 *
     126 * @param[in] call      The message call structure.
    105127 */
    106128#define ICMP_GET_TIMEOUT(call) \
    107         (({suseconds_t timeout = (suseconds_t) IPC_GET_ARG2(call); timeout;}))
     129        ({ \
     130                suseconds_t timeout = (suseconds_t) IPC_GET_ARG2(call); \
     131                timeout; \
     132        })
    108133
    109134/** Returns the time to live message parameter.
    110  *  @param[in] call The message call structure.
     135 *
     136 * @param[in] call      The message call structure.
    111137 */
    112138#define ICMP_GET_TTL(call) \
    113         ({ip_ttl_t ttl = (ip_ttl_t) IPC_GET_ARG3(call); ttl;})
     139        ({ \
     140                ip_ttl_t ttl = (ip_ttl_t) IPC_GET_ARG3(call); \
     141                ttl; \
     142        })
    114143
    115144/** Returns the type of service message parameter.
    116  *  @param[in] call The message call structure.
     145 *
     146 * @param[in] call      The message call structure.
    117147 */
    118148#define ICMP_GET_TOS(call) \
    119         ({ip_tos_t tos = (ip_tos_t) IPC_GET_ARG4(call); tos;})
     149        ({ \
     150                ip_tos_t tos = (ip_tos_t) IPC_GET_ARG4(call); \
     151                tos; \
     152        })
    120153
    121154/** Returns the dont fragment message parameter.
    122  *  @param[in] call The message call structure.
     155 *
     156 * @param[in] call      The message call structure.
    123157 */
    124158#define ICMP_GET_DONT_FRAGMENT(call) \
    125         ({int dont_fragment = (int) IPC_GET_ARG5(call); dont_fragment;})
     159        ({ \
     160                int dont_fragment = (int) IPC_GET_ARG5(call); \
     161                dont_fragment; \
     162        })
    126163
    127164/*@}*/
  • uspace/lib/c/include/net/icmp_api.h

    rf3b4051 r753bca3  
    2727 */
    2828
    29 /** @addtogroup icmp
    30  *  @{
     29/** @addtogroup libc
     30 * @{
    3131 */
    3232
    3333/** @file
    34  *  ICMP module common interface.
     34 * ICMP module application interface.
    3535 */
    3636
    37 #ifndef __NET_ICMP_COMMON_H__
    38 #define __NET_ICMP_COMMON_H__
     37#ifndef LIBC_ICMP_API_H_
     38#define LIBC_ICMP_API_H_
    3939
    40 #include <ipc/services.h>
    41 
     40#include <net/socket_codes.h>
     41#include <net/inet.h>
     42#include <sys/types.h>
    4243#include <sys/time.h>
    4344
    44 /** Default timeout for incoming connections in microseconds.
     45#include <adt/measured_strings.h>
     46#include <net/packet.h>
     47#include <net/ip_codes.h>
     48#include <net/icmp_codes.h>
     49#include <net/icmp_common.h>
     50
     51/** @name ICMP module application interface
     52 * This interface is used by other application modules.
    4553 */
    46 #define ICMP_CONNECT_TIMEOUT    (1 * 1000 * 1000)
     54/*@{*/
    4755
    48 /** Connects to the ICMP module.
    49  *  @param service The ICMP module service. Ignored parameter.
    50  *  @param[in] timeout The connection timeout in microseconds. No timeout if set to zero (0).
    51  *  @returns The ICMP module phone on success.
    52  *  @returns ETIMEOUT if the connection timeouted.
    53  */
    54 extern int icmp_connect_module(services_t service, suseconds_t timeout);
     56extern int icmp_echo_msg(int, size_t, mseconds_t, ip_ttl_t, ip_tos_t, int,
     57    const struct sockaddr *, socklen_t);
     58
     59/*@}*/
    5560
    5661#endif
  • uspace/lib/c/include/net/icmp_codes.h

    rf3b4051 r753bca3  
    2727 */
    2828
    29 /** @addtogroup icmp
     29/** @addtogroup libc
    3030 *  @{
    3131 */
    3232
    3333/** @file
    34  *  ICMP types and codes according to the on-line IANA - ICMP Type Numbers - <http://http://www.iana.org/assignments/icmp-parameters>, cited September 14 2009.
    35  */
    36 
    37 #ifndef __NET_ICMP_CODES_H__
    38 #define __NET_ICMP_CODES_H__
    39 
    40 /** ICMP type type definition.
    41  */
    42 typedef uint8_t icmp_type_t;
    43 
    44 /** ICMP code type definition.
    45  */
    46 typedef uint8_t icmp_code_t;
    47 
    48 /** ICMP parameter type definition.
    49  */
    50 typedef uint16_t        icmp_param_t;
    51 
    52 /** @name ICMP types definitions
    53  */
    54 /*@{*/
    55 
    56 /** Echo Reply.
    57  */
     34 * ICMP types and codes according to the on-line IANA - ICMP Type Numbers
     35 *
     36 * http://www.iana.org/assignments/icmp-parameters>
     37 *
     38 * cited September 14 2009.
     39 */
     40
     41#ifndef LIBC_ICMP_CODES_H_
     42#define LIBC_ICMP_CODES_H_
     43
     44/** ICMP type type definition. */
     45typedef uint8_t icmp_type_t;
     46
     47/** ICMP code type definition. */
     48typedef uint8_t icmp_code_t;
     49
     50/** ICMP parameter type definition. */
     51typedef uint16_t icmp_param_t;
     52
     53/** @name ICMP types definitions */
     54/*@{*/
     55
     56/** Echo Reply. */
    5857#define ICMP_ECHOREPLY          0
    5958
    60 /** Destination Unreachable.
    61  */
     59/** Destination Unreachable. */
    6260#define ICMP_DEST_UNREACH       3
    6361
    64 /** Source Quench.
    65  */
     62/** Source Quench. */
    6663#define ICMP_SOURCE_QUENCH      4
    6764
    68 /** Redirect.
    69  */
     65/** Redirect. */
    7066#define ICMP_REDIRECT           5
    7167
    72 /** Alternate Host Address.
    73  */
     68/** Alternate Host Address. */
    7469#define ICMP_ALTERNATE_ADDR     6
    7570
    76 /** Echo Request.
    77  */
    78 #define ICMP_ECHO                       8
    79 
    80 /** Router Advertisement.
    81  */
     71/** Echo Request. */
     72#define ICMP_ECHO               8
     73
     74/** Router Advertisement. */
    8275#define ICMP_ROUTER_ADV         9
    8376
    84 /** Router solicitation.
    85  */
     77/** Router solicitation. */
    8678#define ICMP_ROUTER_SOL         10
    8779
    88 /** Time Exceeded.
    89  */
     80/** Time Exceeded. */
    9081#define ICMP_TIME_EXCEEDED      11
    9182
    92 /** Parameter Problem.
    93  */
     83/** Parameter Problem. */
    9484#define ICMP_PARAMETERPROB      12
    9585
    96 /** Timestamp Request.
    97  */
     86/** Timestamp Request. */
    9887#define ICMP_TIMESTAMP          13
    9988
    100 /** Timestamp Reply.
    101  */
     89/** Timestamp Reply. */
    10290#define ICMP_TIMESTAMPREPLY     14
    10391
    104 /** Information Request.
    105  */
     92/** Information Request. */
    10693#define ICMP_INFO_REQUEST       15
    10794
    108 /** Information Reply.
    109  */
     95/** Information Reply. */
    11096#define ICMP_INFO_REPLY         16
    11197
    112 /** Address Mask Request.
    113  */
     98/** Address Mask Request. */
    11499#define ICMP_ADDRESS            17
    115100
    116 /** Address Mask Reply.
    117  */
     101/** Address Mask Reply. */
    118102#define ICMP_ADDRESSREPLY       18
    119103
    120 /** Traceroute.
    121  */
     104/** Traceroute. */
    122105#define ICMP_TRACEROUTE         30
    123106
    124 /** Datagram Conversion Error.
    125  */
     107/** Datagram Conversion Error. */
    126108#define ICMP_CONVERSION_ERROR   31
    127109
    128 /** Mobile Host Redirect.
    129  */
     110/** Mobile Host Redirect. */
    130111#define ICMP_REDIRECT_MOBILE    32
    131112
    132 /** IPv6 Where-Are-You.
    133  */
     113/** IPv6 Where-Are-You. */
    134114#define ICMP_IPV6_WHERE_ARE_YOU 33
    135115
    136 /** IPv6 I-Am-Here.
    137  */
     116/** IPv6 I-Am-Here. */
    138117#define ICMP_IPV6_I_AM_HERE     34
    139118
    140 /** Mobile Registration Request.
    141  */
     119/** Mobile Registration Request. */
    142120#define ICMP_MOBILE_REQUEST     35
    143121
    144 /** Mobile Registration Reply.
    145  */
     122/** Mobile Registration Reply. */
    146123#define ICMP_MOBILE_REPLY       36
    147124
    148 /** Domain name request.
    149  */
     125/** Domain name request. */
    150126#define ICMP_DN_REQUEST         37
    151127
    152 /** Domain name reply.
    153  */
     128/** Domain name reply. */
    154129#define ICMP_DN_REPLY           38
    155130
    156 /** SKIP.
    157  */
    158 #define ICMP_SKIP                       39
    159 
    160 /** Photuris.
    161  */
     131/** SKIP. */
     132#define ICMP_SKIP               39
     133
     134/** Photuris. */
    162135#define ICMP_PHOTURIS           40
    163136
     
    168141/*@{*/
    169142
    170 /** Network Unreachable.
    171  */
     143/** Network Unreachable. */
    172144#define ICMP_NET_UNREACH        0
    173145
    174 /** Host Unreachable.
    175  */
     146/** Host Unreachable. */
    176147#define ICMP_HOST_UNREACH       1
    177148
    178 /** Protocol Unreachable.
    179  */
     149/** Protocol Unreachable. */
    180150#define ICMP_PROT_UNREACH       2
    181151
    182 /** Port Unreachable.
    183  */
     152/** Port Unreachable. */
    184153#define ICMP_PORT_UNREACH       3
    185154
    186 /** Fragmentation needed but the Do Not Fragment bit was set.
    187  */
     155/** Fragmentation needed but the Do Not Fragment bit was set. */
    188156#define ICMP_FRAG_NEEDED        4
    189157
    190 /** Source Route failed.
    191  */
     158/** Source Route failed. */
    192159#define ICMP_SR_FAILED          5
    193160
    194 /** Destination network unknown.
    195  */
     161/** Destination network unknown. */
    196162#define ICMP_NET_UNKNOWN        6
    197163
    198 /** Destination host unknown.
    199  */
     164/** Destination host unknown. */
    200165#define ICMP_HOST_UNKNOWN       7
    201166
    202 /** Source host isolated (obsolete).
    203  */
     167/** Source host isolated (obsolete). */
    204168#define ICMP_HOST_ISOLATED      8
    205169
    206 /** Destination network administratively prohibited.
    207  */
     170/** Destination network administratively prohibited. */
    208171#define ICMP_NET_ANO            9
    209172
    210 /** Destination host administratively prohibited.
    211  */
     173/** Destination host administratively prohibited. */
    212174#define ICMP_HOST_ANO           10
    213175
    214 /** Network unreachable for this type of service.
    215  */
     176/** Network unreachable for this type of service. */
    216177#define ICMP_NET_UNR_TOS        11
    217178
    218 /** Host unreachable for this type of service.
    219  */
     179/** Host unreachable for this type of service. */
    220180#define ICMP_HOST_UNR_TOS       12
    221181
    222 /** Communication administratively prohibited by filtering.
    223  */
     182/** Communication administratively prohibited by filtering. */
    224183#define ICMP_PKT_FILTERED       13
    225184
    226 /** Host precedence violation.
    227  */
     185/** Host precedence violation. */
    228186#define ICMP_PREC_VIOLATION     14
    229187
    230 /** Precedence cutoff in effect.
    231  */
     188/** Precedence cutoff in effect. */
    232189#define ICMP_PREC_CUTOFF        15
    233190
    234191/*@}*/
    235192
    236 /** @name ICMP_REDIRECT codes definitions
    237  */
    238 /*@{*/
    239 
    240 /** Network redirect (or subnet).
    241  */
     193/** @name ICMP_REDIRECT codes definitions */
     194/*@{*/
     195
     196/** Network redirect (or subnet). */
    242197#define ICMP_REDIR_NET          0
    243198
    244 /** Host redirect.
    245  */
     199/** Host redirect. */
    246200#define ICMP_REDIR_HOST         1
    247201
    248 /** Network redirect for this type of service.
    249  */
     202/** Network redirect for this type of service. */
    250203#define ICMP_REDIR_NETTOS       2
    251204
    252 /** Host redirect for this type of service.
    253  */
     205/** Host redirect for this type of service. */
    254206#define ICMP_REDIR_HOSTTOS      3
    255207
    256208/*@}*/
    257209
    258 /** @name ICMP_ALTERNATE_ADDRESS codes definitions
    259  */
    260 /*@{*/
    261 
    262 /** Alternate address for host.
    263  */
     210/** @name ICMP_ALTERNATE_ADDRESS codes definitions */
     211/*@{*/
     212
     213/** Alternate address for host. */
    264214#define ICMP_ALTERNATE_HOST     0
    265215
    266216/*@}*/
    267217
    268 /** @name ICMP_ROUTER_ADV codes definitions
    269  */
    270 /*@{*/
    271 
    272 /** Normal router advertisement.
    273  */
     218/** @name ICMP_ROUTER_ADV codes definitions */
     219/*@{*/
     220
     221/** Normal router advertisement. */
    274222#define ICMP_ROUTER_NORMAL      0
    275223
    276 /** Does not route common traffic.
    277  */
     224/** Does not route common traffic. */
    278225#define ICMP_ROUTER_NO_NORMAL_TRAFFIC   16
    279226
    280227/*@}*/
    281228
    282 /** @name ICMP_TIME_EXCEEDED codes definitions
    283  */
    284 /*@{*/
    285 
    286 /** Transit TTL exceeded.
    287  */
     229/** @name ICMP_TIME_EXCEEDED codes definitions */
     230/*@{*/
     231
     232/** Transit TTL exceeded. */
    288233#define ICMP_EXC_TTL            0
    289234
    290 /** Reassembly TTL exceeded.
    291  */
     235/** Reassembly TTL exceeded. */
    292236#define ICMP_EXC_FRAGTIME       1
    293237
    294238/*@}*/
    295239
    296 /** @name ICMP_PARAMETERPROB codes definitions
    297  */
    298 /*@{*/
    299 
    300 /** Pointer indicates the error.
    301  */
     240/** @name ICMP_PARAMETERPROB codes definitions */
     241/*@{*/
     242
     243/** Pointer indicates the error. */
    302244#define ICMP_PARAM_POINTER      0
    303245
    304 /** Missing required option.
    305  */
     246/** Missing required option. */
    306247#define ICMP_PARAM_MISSING      1
    307248
    308 /** Bad length.
    309  */
     249/** Bad length. */
    310250#define ICMP_PARAM_LENGTH       2
    311251
    312252/*@}*/
    313253
    314 /** @name ICMP_PHOTURIS codes definitions
    315  */
    316 /*@{*/
    317 
    318 /** Bad SPI.
    319  */
    320 #define ICMP_PHOTURIS_BAD_SPI   0
    321 
    322 /** Authentication failed.
    323  */
    324 #define ICMP_PHOTURIS_AUTHENTICATION    1
    325 
    326 /** Decompression failed.
    327  */
     254/** @name ICMP_PHOTURIS codes definitions */
     255/*@{*/
     256
     257/** Bad SPI. */
     258#define ICMP_PHOTURIS_BAD_SPI                   0
     259
     260/** Authentication failed. */
     261#define ICMP_PHOTURIS_AUTHENTICATION            1
     262
     263/** Decompression failed. */
    328264#define ICMP_PHOTURIS_DECOMPRESSION             2
    329265
    330 /** Decryption failed.
    331  */
    332 #define ICMP_PHOTURIS_DECRYPTION        3
    333 
    334 /** Need authentication.
    335  */
     266/** Decryption failed. */
     267#define ICMP_PHOTURIS_DECRYPTION                3
     268
     269/** Need authentication. */
    336270#define ICMP_PHOTURIS_NEED_AUTHENTICATION       4
    337271
    338 /** Need authorization.
    339  */
     272/** Need authorization. */
    340273#define ICMP_PHOTURIS_NEED_AUTHORIZATION        5
    341274
  • uspace/lib/c/include/net/icmp_common.h

    rf3b4051 r753bca3  
    2727 */
    2828
    29 /** @addtogroup icmp
     29/** @addtogroup libc
    3030 *  @{
    3131 */
    3232
    3333/** @file
    34  *  ICMP common interface implementation.
    35  *  @see icmp_common.h
     34 * ICMP module common interface.
    3635 */
    3736
    38 #include <async.h>
     37#ifndef LIBC_ICMP_COMMON_H_
     38#define LIBC_ICMP_COMMON_H_
     39
    3940#include <ipc/services.h>
     41#include <sys/time.h>
    4042
    41 #include <net/modules.h>
    42 #include <icmp_common.h>
    43 #include <icmp_messages.h>
     43/** Default timeout for incoming connections in microseconds. */
     44#define ICMP_CONNECT_TIMEOUT    (1 * 1000 * 1000)
    4445
    45 int icmp_connect_module(services_t service, suseconds_t timeout){
    46         int phone;
     46extern int icmp_connect_module(services_t, suseconds_t);
    4747
    48         phone = connect_to_service_timeout(SERVICE_ICMP, timeout);
    49         if(phone >= 0){
    50                 async_req_0_0(phone, NET_ICMP_INIT);
    51         }
    52         return phone;
    53 }
     48#endif
    5449
    5550/** @}
  • uspace/lib/net/include/icmp_client.h

    rf3b4051 r753bca3  
    3838#define __NET_ICMP_CLIENT_H__
    3939
    40 #include <icmp_codes.h>
     40#include <net/icmp_codes.h>
    4141#include <net/packet.h>
    4242
  • uspace/lib/net/include/icmp_header.h

    rf3b4051 r753bca3  
    4242
    4343#include <net/in.h>
    44 #include <icmp_codes.h>
     44#include <net/icmp_codes.h>
    4545
    4646/** ICMP header size in bytes.
  • uspace/lib/net/include/icmp_interface.h

    rf3b4051 r753bca3  
    4242#include <net/inet.h>
    4343#include <net/ip_codes.h>
    44 #include <icmp_codes.h>
    45 #include <icmp_common.h>
     44#include <net/icmp_codes.h>
     45#include <net/icmp_common.h>
    4646
    4747/** @name ICMP module interface
  • uspace/lib/net/tl/icmp_client.c

    rf3b4051 r753bca3  
    4343#include <sys/types.h>
    4444
    45 #include <icmp_codes.h>
     45#include <net/icmp_codes.h>
    4646#include <icmp_client.h>
    4747#include <net/packet.h>
  • uspace/lib/net/tl/icmp_remote.c

    rf3b4051 r753bca3  
    4040#include <ipc/ipc.h>
    4141#include <ipc/services.h>
     42#include <ipc/icmp.h>
    4243#include <sys/types.h>
    4344
     
    4647#include <icmp_interface.h>
    4748#include <packet_client.h>
    48 #include <icmp_messages.h>
    4949
    5050int icmp_destination_unreachable_msg(int icmp_phone, icmp_code_t code, icmp_param_t mtu, packet_t packet){
  • uspace/lib/socket/Makefile

    rf3b4051 r753bca3  
    3333
    3434SOURCES = \
    35         generic/icmp_common.c \
    36         generic/icmp_api.c \
    3735        packet/packet_server.c
    3836
  • uspace/srv/net/il/ip/ip.c

    rf3b4051 r753bca3  
    5858#include <net_device.h>
    5959#include <icmp_client.h>
    60 #include <icmp_codes.h>
     60#include <net/icmp_codes.h>
    6161#include <icmp_interface.h>
    6262#include <il_interface.h>
  • uspace/srv/net/tl/icmp/icmp.c

    rf3b4051 r753bca3  
    4444#include <ipc/ipc.h>
    4545#include <ipc/services.h>
     46#include <ipc/icmp.h>
    4647#include <sys/time.h>
    4748#include <sys/types.h>
     
    5960#include <packet_remote.h>
    6061#include <net_checksum.h>
    61 #include <icmp_api.h>
     62#include <net/icmp_api.h>
    6263#include <icmp_client.h>
    63 #include <icmp_codes.h>
    64 #include <icmp_common.h>
     64#include <net/icmp_codes.h>
     65#include <net/icmp_common.h>
    6566#include <icmp_interface.h>
    6667#include <il_interface.h>
     
    7172#include <tl_interface.h>
    7273#include <tl_local.h>
    73 #include <icmp_messages.h>
    7474#include <icmp_header.h>
    7575
  • uspace/srv/net/tl/icmp/icmp.h

    rf3b4051 r753bca3  
    4040#include <fibril_synch.h>
    4141
    42 #include <icmp_codes.h>
     42#include <net/icmp_codes.h>
    4343#include <adt/int_map.h>
    4444#include <icmp_header.h>
Note: See TracChangeset for help on using the changeset viewer.