Changes in / [1b11576d:58b833c] in mainline


Ignore:
Location:
uspace
Files:
3 added
1 deleted
24 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/net/icmp_codes.h

    r1b11576d r58b833c  
    4242#define LIBC_ICMP_CODES_H_
    4343
    44 #include <sys/types.h>
    45 
    4644/** ICMP type type definition. */
    4745typedef uint8_t icmp_type_t;
  • uspace/lib/net/Makefile

    r1b11576d r58b833c  
    3838        generic/packet_client.c \
    3939        generic/packet_remote.c \
     40        generic/socket_core.c \
    4041        adt/module_map.c \
    4142        netif/netif_local.c \
     
    4748        tl/icmp_remote.c \
    4849        tl/icmp_client.c \
    49         tl/socket_core.c \
    5050        tl/tl_common.c
    5151
  • uspace/lib/net/il/ip_remote.c

    r1b11576d r58b833c  
    2727 */
    2828
    29 /** @addtogroup libnet
     29/** @addtogroup ip
    3030 * @{
    3131 */
     
    7272}
    7373
    74 /** Creates bidirectional connection with the ip module service and registers
    75  * the message receiver.
    76  *
    77  * @param[in] service   The IP module service.
    78  * @param[in] protocol  The transport layer protocol.
    79  * @param[in] me        The requesting module service.
    80  * @param[in] receiver  The message receiver. Used for remote connection.
    81  * @returns             The phone of the needed service.
    82  * @returns             EOK on success.
    83  * @returns             Other error codes as defined for the bind_service()
    84  *                      function.
    85  */
    8674int ip_bind_service(services_t service, int protocol, services_t me,
    8775    async_client_conn_t receiver)
     
    9179}
    9280
    93 /** Connects to the IP module.
    94  *
    95  * @param service       The IP module service. Ignored parameter.
    96  * @returns             The IP module phone on success.
    97  */
    9881int ip_connect_module(services_t service)
    9982{
     
    127110}
    128111
    129 /** Return the device identifier and the IP pseudo header based on the
    130  * destination address.
     112/** Return the device identifier and the IP pseudo header based on the destination address.
    131113 *
    132114 * @param[in]  ip_phone    The IP module phone used for (semi)remote calls.
     
    155137            (ipcarg_t) protocol, &answer);
    156138       
    157         if ((async_data_write_start(ip_phone, destination, addrlen) == EOK) &&
    158             (async_data_read_start(ip_phone, headerlen,
    159             sizeof(*headerlen)) == EOK) && (*headerlen > 0)) {
     139        if ((async_data_write_start(ip_phone, destination, addrlen) == EOK)
     140            && (async_data_read_start(ip_phone, headerlen, sizeof(*headerlen)) == EOK)
     141            && (*headerlen > 0)) {
    160142                *header = malloc(*headerlen);
    161143                if (*header) {
    162                         if (async_data_read_start(ip_phone, *header,
    163                             *headerlen) != EOK)
     144                        if (async_data_read_start(ip_phone, *header, *headerlen) != EOK)
    164145                                free(*header);
    165146                }
     
    192173    packet_dimension_ref packet_dimension)
    193174{
    194         return generic_packet_size_req_remote(ip_phone, NET_IL_PACKET_SPACE,
    195             device_id, packet_dimension);
     175        return generic_packet_size_req_remote(ip_phone, NET_IL_PACKET_SPACE, device_id,
     176            packet_dimension);
    196177}
    197178
  • uspace/lib/net/include/icmp_client.h

    r1b11576d r58b833c  
    2727 */
    2828
    29 /** @addtogroup libnet
    30  * @{
     29/** @addtogroup icmp
     30 *  @{
    3131 */
    3232
    3333/** @file
    34  * ICMP client interface.
     34 *  ICMP client interface.
    3535 */
    3636
    37 #ifndef LIBNET_ICMP_CLIENT_H_
    38 #define LIBNET_ICMP_CLIENT_H_
     37#ifndef __NET_ICMP_CLIENT_H__
     38#define __NET_ICMP_CLIENT_H__
    3939
    4040#include <net/icmp_codes.h>
    4141#include <net/packet.h>
    4242
    43 extern int icmp_client_process_packet(packet_t, icmp_type_t *, icmp_code_t *,
    44     icmp_param_t *, icmp_param_t *);
    45 extern size_t icmp_client_header_length(packet_t);
     43/** Processes the received packet prefixed with an ICMP header.
     44 *  @param[in] packet The received packet.
     45 *  @param[out] type The ICMP header type.
     46 *  @param[out] code The ICMP header code.
     47 *  @param[out] pointer The ICMP header pointer.
     48 *  @param[out] mtu The ICMP header MTU.
     49 *  @returns The ICMP header length.
     50 *  @returns Zero (0) if the packet contains no data.
     51 */
     52extern int icmp_client_process_packet(packet_t packet, icmp_type_t * type, icmp_code_t * code, icmp_param_t * pointer, icmp_param_t * mtu);
     53
     54/** Returns the ICMP header length.
     55 *  @param[in] packet The packet.
     56 *  @returns The ICMP header length in bytes.
     57 */
     58extern size_t icmp_client_header_length(packet_t packet);
    4659
    4760#endif
  • uspace/lib/net/include/il_local.h

    r1b11576d r58b833c  
    2727 */
    2828
    29 /** @addtogroup libnet
    30  * @{
     29/** @addtogroup il_local
     30 *  @{
    3131 */
    3232
    33 #ifndef LIBNET_IL_LOCAL_H_
    34 #define LIBNET_IL_LOCAL_H_
     33#ifndef __IL_LOCAL_H__
     34#define __IL_LOCAL_H__
    3535
    3636#include <ipc/ipc.h>
    3737#include <async.h>
    3838
    39 /** Processes the Internet layer module message.
    40  *
    41  * @param[in]           callid The message identifier.
    42  * @param[in]           call The message parameters.
    43  * @param[out]          answer The message answer parameters.
    44  * @param[out]          answer_count The last parameter for the actual answer in
    45  *                      the answer parameter.
    46  * @returns             EOK on success.
    47  * @returns             Other error codes as defined for the arp_message()
    48  *                      function.
    49  */
    5039extern int il_module_message_standalone(ipc_callid_t callid, ipc_call_t *call,
    5140    ipc_call_t *answer, int *answer_count);
    52 
    53 /** Starts the Internet layer module.
    54  *
    55  * Initializes the client connection servicing function, initializes the module,
    56  * registers the module service and starts the async manager, processing IPC
    57  * messages in an infinite loop.
    58  *
    59  * @param[in] client_connection The client connection processing function. The
    60  *                      module skeleton propagates its own one.
    61  * @returns             EOK on successful module termination.
    62  * @returns             Other error codes as defined for the arp_initialize()
    63  *                      function.
    64  * @returns             Other error codes as defined for the REGISTER_ME() macro
    65  *                      function.
    66  */
    6741extern int il_module_start_standalone(async_client_conn_t client_connection);
    6842
  • uspace/lib/net/include/ip_header.h

    r1b11576d r58b833c  
    2727 */
    2828
    29 /** @addtogroup libnet
    30  * @{
     29/** @addtogroup ip
     30 *  @{
    3131 */
    3232
    3333/** @file
    34  * IP header and options definitions.
    35  * Based on the RFC 791.
    36  */
    37 
    38 #ifndef LIBNET_IP_HEADER_H_
    39 #define LIBNET_IP_HEADER_H_
     34 *  IP header and options definitions.
     35 *  Based on the RFC~791.
     36 */
     37
     38#ifndef __NET_IP_HEADER_H__
     39#define __NET_IP_HEADER_H__
    4040
    4141#include <byteorder.h>
     
    4343
    4444/** Returns the fragment offest high bits.
    45  * @param[in] length The prefixed data total length.
    46  */
    47 #define IP_COMPUTE_FRAGMENT_OFFSET_HIGH(length) \
    48         ((((length) / 8U) & 0x1f00) >> 8)
     45 *  @param[in] length The prefixed data total length.
     46 */
     47#define IP_COMPUTE_FRAGMENT_OFFSET_HIGH(length) ((((length) / 8u) &0x1F00) >> 8)
    4948
    5049/** Returns the fragment offest low bits.
    51  * @param[in] length The prefixed data total length.
    52  */
    53 #define IP_COMPUTE_FRAGMENT_OFFSET_LOW(length) \
    54         (((length) / 8U) & 0xff)
     50 *  @param[in] length The prefixed data total length.
     51 */
     52#define IP_COMPUTE_FRAGMENT_OFFSET_LOW(length) (((length) / 8u) &0xFF)
    5553
    5654/** Returns the IP header length.
    57  * @param[in] length The IP header length in bytes.
    58  */
    59 #define IP_COMPUTE_HEADER_LENGTH(length) \
    60         ((uint8_t) ((length) / 4U))
     55 *  @param[in] length The IP header length in bytes.
     56 */
     57#define IP_COMPUTE_HEADER_LENGTH(length)                ((uint8_t) ((length) / 4u))
    6158
    6259/** Returns the fragment offest.
    63  * @param[in] header The IP packet header.
    64  */
    65 #define IP_FRAGMENT_OFFSET(header) \
    66         ((((header)->fragment_offset_high << 8) + \
    67             (header)->fragment_offset_low) * 8U)
     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)
    6863
    6964/** Returns the IP packet header checksum.
    7065 *  @param[in] header The IP packet header.
    7166 */
    72 #define IP_HEADER_CHECKSUM(header) \
    73         (htons(ip_checksum((uint8_t *) (header), IP_HEADER_LENGTH(header))))
     67#define IP_HEADER_CHECKSUM(header)      (htons(ip_checksum((uint8_t *)(header), IP_HEADER_LENGTH(header))))
    7468
    7569/** Returns the actual IP packet data length.
    76  * @param[in] header The IP packet header.
    77  */
    78 #define IP_HEADER_DATA_LENGTH(header) \
    79         (IP_TOTAL_LENGTH(header) - IP_HEADER_LENGTH(header))
     70 *  @param[in] header The IP packet header.
     71 */
     72#define IP_HEADER_DATA_LENGTH(header)   (IP_TOTAL_LENGTH(header) - IP_HEADER_LENGTH(header))
    8073
    8174/** Returns the actual IP header length in bytes.
    82  * @param[in] header The IP packet header.
    83  */
    84 #define IP_HEADER_LENGTH(header) \
    85         ((header)->header_length * 4U)
     75 *  @param[in] header The IP packet header.
     76 */
     77#define IP_HEADER_LENGTH(header)                ((header)->header_length * 4u)
    8678
    8779/** Returns the actual IP packet total length.
    88  * @param[in] header The IP packet header.
    89  */
    90 #define IP_TOTAL_LENGTH(header) \
    91         ntohs((header)->total_length)
    92 
    93 /** @name IP flags definitions */
     80 *  @param[in] header The IP packet header.
     81 */
     82#define IP_TOTAL_LENGTH(header)         ntohs((header)->total_length)
     83
     84/** @name IP flags definitions
     85 */
    9486/*@{*/
    9587
    96 /** Fragment flag field shift. */
    97 #define IPFLAG_FRAGMENT_SHIFT   1
    98 
    99 /** Fragmented flag field shift. */
    100 #define IPFLAG_FRAGMENTED_SHIFT 0
     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
    10195
    10296/** Don't fragment flag value.
    103  * Permits the packet fragmentation.
    104  */
    105 #define IPFLAG_DONT_FRAGMENT    (0x1 << IPFLAG_FRAGMENT_SHIFT)
     97 *  Permits the packet fragmentation.
     98 */
     99#define IPFLAG_DONT_FRAGMENT            (0x1 << IPFLAG_FRAGMENT_SHIFT)
    106100
    107101/** Last fragment flag value.
    108  * Indicates the last packet fragment.
    109  */
    110 #define IPFLAG_LAST_FRAGMENT    (0x0 << IPFLAG_FRAGMENTED_SHIFT)
     102 *  Indicates the last packet fragment.
     103 */
     104#define IPFLAG_LAST_FRAGMENT            (0x0 << IPFLAG_FRAGMENTED_SHIFT)
    111105
    112106/** May fragment flag value.
    113  * Allows the packet fragmentation.
    114  */
    115 #define IPFLAG_MAY_FRAGMENT     (0x0 << IPFLAG_FRAGMENT_SHIFT)
     107 *  Allows the packet fragmentation.
     108 */
     109#define IPFLAG_MAY_FRAGMENT                     (0x0 << IPFLAG_FRAGMENT_SHIFT)
    116110
    117111/** More fragments flag value.
    118  * Indicates that more packet fragments follow.
    119  */
    120 #define IPFLAG_MORE_FRAGMENTS   (0x1 << IPFLAG_FRAGMENTED_SHIFT)
     112 *  Indicates that more packet fragments follow.
     113 */
     114#define IPFLAG_MORE_FRAGMENTS           (0x1 << IPFLAG_FRAGMENTED_SHIFT)
    121115
    122116/*@}*/
    123117
    124118/** Type definition of the internet header.
    125  * @see ip_header
    126  */
    127 typedef struct ip_header ip_header_t;
     119 *  @see ip_header
     120 */
     121typedef struct ip_header        ip_header_t;
    128122
    129123/** Type definition of the internet header pointer.
    130  * @see ip_header
    131  */
    132 typedef ip_header_t *ip_header_ref;
     124 *  @see ip_header
     125 */
     126typedef ip_header_t *           ip_header_ref;
    133127
    134128/** Type definition of the internet option header.
    135  * @see ip_header
    136  */
    137 typedef struct ip_option ip_option_t;
     129 *  @see ip_header
     130 */
     131typedef struct ip_option        ip_option_t;
    138132
    139133/** Type definition of the internet option header pointer.
    140  * @see ip_header
    141  */
    142 typedef ip_option_t *ip_option_ref;
     134 *  @see ip_header
     135 */
     136typedef ip_option_t *           ip_option_ref;
    143137
    144138/** Type definition of the internet version 4 pseudo header.
    145  * @see ipv4_pseudo_header
    146  */
    147 typedef struct ipv4_pseudo_header ipv4_pseudo_header_t;
     139 *  @see ipv4_pseudo_header
     140 */
     141typedef struct ipv4_pseudo_header       ipv4_pseudo_header_t;
    148142
    149143/** Type definition of the internet version 4 pseudo header pointer.
    150  * @see ipv4_pseudo_header
    151  */
    152 typedef ipv4_pseudo_header_t *ipv4_pseudo_header_ref;
     144 *  @see ipv4_pseudo_header
     145 */
     146typedef ipv4_pseudo_header_t *          ipv4_pseudo_header_ref;
    153147
    154148/** Internet header.
    155  *
    156  * The variable options should be included after the header itself and
    157  * indicated by the increased header length value.
    158  */
    159 struct ip_header {
     149 *  The variable options should be included after the header itself and indicated by the increased header length value.
     150 */
     151struct ip_header{
    160152#ifdef ARCH_IS_BIG_ENDIAN
    161         uint8_t version : 4;
    162         uint8_t header_length : 4;
     153        /** The Version field indicates the format of the internet header.
     154         */
     155        uint8_t version:4;
     156        /** Internet Header Length is the length of the internet header in 32~bit words, and thus points to the beginning of the data.
     157         *  Note that the minimum value for a~correct header is~5.
     158         */
     159        uint8_t header_length:4;
    163160#else
    164         uint8_t header_length : 4;
    165         uint8_t version : 4;
    166 #endif
    167 
     161        /** Internet Header Length is the length of the internet header in 32~bit words, and thus points to the beginning of the data.
     162         *  Note that the minimum value for a~correct header is~5.
     163         */
     164        uint8_t header_length:4;
     165        /** The Version field indicates the format of the internet header.
     166         */
     167        uint8_t version:4;
     168#endif
     169        /** The Type of Service provides an indication of the abstract parameters of the quality of service desired.
     170         *  These parameters are to be used to guide the selection of the actual service parameters when transmitting a~datagram through a~particular network.
     171         *  Several networks offer service precedence, which somehow treats high precedence traffic as more important than other traffic (generally by accepting only traffic above a~certain precedence at time of high load).
     172         *  The major choice is a~three way tradeoff between low-delay, high-reliability, and high-throughput.
     173         */
    168174        uint8_t tos;
     175        /** Total Length is the length of the datagram, measured in octets, including internet header and data.
     176         *  This field allows the length of a~datagram to be up to 65,535~octets.
     177         */
    169178        uint16_t total_length;
     179        /** An identifying value assigned by the sender to aid in assembling the fragments of a~datagram.
     180         */
    170181        uint16_t identification;
    171 
    172182#ifdef ARCH_IS_BIG_ENDIAN
    173         uint8_t flags : 3;
    174         uint8_t fragment_offset_high : 5;
     183        /** Various control flags.
     184         */
     185        uint8_t flags:3;
     186        /** This field indicates where in the datagram this fragment belongs.
     187         *  High bits.
     188         */
     189        uint8_t fragment_offset_high:5;
    175190#else
    176         uint8_t fragment_offset_high : 5;
    177         uint8_t flags : 3;
    178 #endif
    179 
     191        /** This field indicates where in the datagram this fragment belongs.
     192         *  High bits.
     193         */
     194        uint8_t fragment_offset_high:5;
     195        /** Various control flags.
     196         */
     197        uint8_t flags:3;
     198#endif
     199        /** This field indicates where in the datagram this fragment belongs.
     200         *  Low bits.
     201         */
    180202        uint8_t fragment_offset_low;
     203        /** This field indicates the maximum time the datagram is allowed to remain in the internet system.
     204         *  If this field contains the value zero, then the datagram must be destroyed.
     205         *  This field is modified in internet header processing.
     206         *  The time is measured in units of seconds, but since every module that processes a~datagram must decrease the TTL by at least one even if it process the datagram in less than a~second, the TTL must be thought of only as an upper bound on the time a~datagram may exist.
     207         *  The intention is to cause undeliverable datagrams to be discarded, and to bound the maximum datagram lifetime.
     208         */
    181209        uint8_t ttl;
     210        /** This field indicates the next level protocol used in the data portion of the internet datagram.
     211         */
    182212        uint8_t protocol;
     213        /** A checksum of the header only.
     214         *  Since some header fields change (e.g., time to live), this is recomputed and verified at each point that the internet header is processed.
     215         *  The checksum algorithm is: The checksum field is the 16~bit one's complement of the one's complement sum of all 16~bit words in the header.
     216         *  For purposes of computing the checksum, the value of the checksum field is zero.
     217         */
    183218        uint16_t header_checksum;
     219        /** The source address.
     220         */
    184221        uint32_t source_address;
     222        /** The destination address.
     223         */
    185224        uint32_t destination_address;
    186225} __attribute__ ((packed));
    187226
    188227/** Internet option header.
    189  *
    190  * Only type field is always valid.
    191  * Other fields' validity depends on the option type.
    192  */
    193 struct ip_option {
     228 *  Only type field is always valid.
     229 *  Other fields' validity depends on the option type.
     230 */
     231struct ip_option{
     232        /** A single octet of option-type.
     233         */
    194234        uint8_t type;
     235        /** An option length octet.
     236         */
    195237        uint8_t length;
     238        /** A~pointer.
     239         */
    196240        uint8_t pointer;
    197 
    198241#ifdef ARCH_IS_BIG_ENDIAN
    199         uint8_t overflow : 4;
    200         uint8_t flags : 4;
     242        /** The number of IP modules that cannot register timestamps due to lack of space.
     243         */
     244        uint8_t overflow:4;
     245        /** Various internet timestamp control flags.
     246         */
     247        uint8_t flags:4;
    201248#else
    202         uint8_t flags : 4;
    203         uint8_t overflow : 4;
     249        /** Various internet timestamp control flags.
     250         */
     251        uint8_t flags:4;
     252        /** The number of IP modules that cannot register timestamps due to lack of space.
     253         */
     254        uint8_t overflow:4;
    204255#endif
    205256} __attribute__ ((packed));
    206257
    207 /** Internet version 4 pseudo header. */
    208 struct ipv4_pseudo_header {
     258/** Internet version 4 pseudo header.
     259 */
     260struct ipv4_pseudo_header{
     261        /** The source address.
     262         */
    209263        uint32_t source_address;
     264        /** The destination address.
     265         */
    210266        uint32_t destination_address;
     267        /** Reserved byte.
     268         *  Must be zero.
     269         */
    211270        uint8_t reserved;
     271        /** This field indicates the next level protocol used in the data portion of the internet datagram.
     272         */
    212273        uint8_t protocol;
     274        /** Data length is the length of the datagram, measured in octets.
     275         */
    213276        uint16_t data_length;
    214277} __attribute__ ((packed));
  • uspace/lib/net/include/ip_interface.h

    r1b11576d r58b833c  
    2727 */
    2828
    29 /** @addtogroup libnet
    30  * @{
     29/** @addtogroup ip
     30 *  @{
    3131 */
    3232
    33 #ifndef LIBNET_IP_INTERFACE_H_
    34 #define LIBNET_IP_INTERFACE_H_
     33#ifndef __NET_IP_INTERFACE_H__
     34#define __NET_IP_INTERFACE_H__
    3535
    3636#include <net/socket_codes.h>
     
    5555
    5656/** @name IP module interface
    57  * This interface is used by other modules.
     57 *  This interface is used by other modules.
    5858 */
    5959/*@{*/
    6060
    6161/** The transport layer notification function type definition.
    62  *
    63  * Notifies the transport layer modules about the received packet/s.
    64  *
    65  * @param[in] device_id The device identifier.
    66  * @param[in] packet    The received packet or the received packet queue.
    67  * @param[in] receiver  The receiving module service.
    68  * @param[in] error     The packet error reporting service. Prefixes the
    69  *                      received packet.
    70  * @returns             EOK on success.
     62 *  Notifies the transport layer modules about the received packet/s.
     63 *  @param[in] device_id The device identifier.
     64 *  @param[in] packet The received packet or the received packet queue.
     65 *  @param[in] receiver The receiving module service.
     66 *  @param[in] error The packet error reporting service. Prefixes the received packet.
     67 *  @returns EOK on success.
    7168 */
    72 typedef int (*tl_received_msg_t)(device_id_t device_id, packet_t packet,
    73     services_t receiver, services_t error);
     69typedef int     (*tl_received_msg_t)(device_id_t device_id, packet_t packet, services_t receiver, services_t error);
    7470
    75 extern int ip_bind_service(services_t, int, services_t, async_client_conn_t);
    76 extern int ip_connect_module(services_t);
     71/** Creates bidirectional connection with the ip module service and registers the message receiver.
     72 *  @param[in] service The IP module service.
     73 *  @param[in] protocol The transport layer protocol.
     74 *  @param[in] me The requesting module service.
     75 *  @param[in] receiver The message receiver. Used for remote connection.
     76 *  @returns The phone of the needed service.
     77 *  @returns EOK on success.
     78 *  @returns Other error codes as defined for the bind_service() function.
     79 */
     80extern int ip_bind_service(services_t service, int protocol, services_t me, async_client_conn_t receiver);
     81
     82/** Connects to the IP module.
     83 *  @param service The IP module service. Ignored parameter.
     84 *  @returns The IP module phone on success.
     85 */
     86extern int ip_connect_module(services_t service);
    7787
    7888/*@}*/
  • uspace/lib/net/include/ip_remote.h

    r1b11576d r58b833c  
    2727 */
    2828
    29 /** @addtogroup libnet
     29/** @addtogroup ip
    3030 * @{
    3131 */
    3232
    33 #ifndef LIBNET_IP_REMOTE_H_
    34 #define LIBNET_IP_REMOTE_H_
     33#ifndef __NET_IP_REMOTE_H__
     34#define __NET_IP_REMOTE_H__
    3535
    3636#include <ipc/services.h>
  • uspace/lib/net/include/netif_interface.h

    r1b11576d r58b833c  
    2727 */
    2828
    29 /** @addtogroup libnet
     29/** @addtogroup netif
    3030 * @{
    3131 */
    3232
    33 #ifndef LIBNET_NETIF_INTERFACE_H_
    34 #define LIBNET_NETIF_INTERFACE_H_
     33#ifndef __NET_NETIF_INTERFACE_H__
     34#define __NET_NETIF_INTERFACE_H__
    3535
    3636#include <netif_remote.h>
  • uspace/lib/net/include/netif_local.h

    r1b11576d r58b833c  
    2727 */
    2828
    29 /** @addtogroup libnet
     29/** @addtogroup netif
    3030 * @{
    3131 */
     
    3636 */
    3737
    38 #ifndef NET_NETIF_LOCAL_H_
    39 #define NET_NETIF_LOCAL_H_
     38#ifndef __NET_NETIF_LOCAL_H__
     39#define __NET_NETIF_LOCAL_H__
    4040
    4141#include <async.h>
     
    4343#include <ipc/ipc.h>
    4444#include <ipc/services.h>
     45#include <err.h>
    4546
    4647#include <adt/measured_strings.h>
     
    4849#include <net/packet.h>
    4950
    50 /** Network interface device specific data. */
     51/** Network interface device specific data.
     52 *
     53 */
    5154typedef struct {
    5255        device_id_t device_id;  /**< Device identifier. */
     
    6467DEVICE_MAP_DECLARE(netif_device_map, netif_device_t);
    6568
    66 /** Network interface module skeleton global data. */
     69/** Network interface module skeleton global data.
     70 *
     71 */
    6772typedef struct {
    6873        int net_phone;                  /**< Networking module phone. */
     
    7681 *
    7782 * This function has to be implemented in user code.
     83 *
    7884 */
    7985extern int netif_initialize(void);
     
    8389 * This has to be implemented in user code.
    8490 *
    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.
     91 * @param[in] device_id The device identifier.
     92 * @param[in] irq       The device interrupt number.
     93 * @param[in] io        The device input/output address.
     94 *
     95 * @return EOK on success.
     96 * @return Other error codes as defined for the find_device() function.
     97 * @return Other error codes as defined for the specific module message
     98 *         implementation.
     99 *
    94100 */
    95101extern int netif_probe_message(device_id_t device_id, int irq, uintptr_t io);
     
    99105 * This has to be implemented in user code.
    100106 *
    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.
     107 * @param[in] device_id The device identifier.
     108 * @param[in] packet    The packet queue.
     109 * @param[in] sender    The sending module service.
     110 *
     111 * @return EOK on success.
     112 * @return EFORWARD if the device is not active (in the NETIF_ACTIVE state).
     113 * @return Other error codes as defined for the find_device() function.
     114 * @return Other error codes as defined for the specific module message
     115 *         implementation.
     116 *
    112117 */
    113118extern int netif_send_message(device_id_t device_id, packet_t packet,
     
    118123 * This has to be implemented in user code.
    119124 *
    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.
     125 * @param[in] device The device structure.
     126 *
     127 * @return EOK on success.
     128 * @return Other error codes as defined for the find_device() function.
     129 * @return Other error codes as defined for the specific module message
     130 *         implementation.
     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 The device structure.
     140 *
     141 * @return EOK on success.
     142 * @return Other error codes as defined for the find_device() function.
     143 * @return Other error codes as defined for the specific module message
     144 *         implementation.
     145 *
    141146 */
    142147extern int netif_stop_message(netif_device_t *device);
     
    146151 * This has to be implemented in user code.
    147152 *
    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.
     153 * @param[in]  device_id The device identifier.
     154 * @param[out] address   The device local hardware address.
     155 *
     156 * @return EOK on success.
     157 * @return EBADMEM if the address parameter is NULL.
     158 * @return ENOENT if there no such device.
     159 * @return Other error codes as defined for the find_device() function.
     160 * @return Other error codes as defined for the specific module message
     161 *         implementation.
     162 *
    158163 */
    159164extern int netif_get_addr_message(device_id_t device_id,
     
    165170 * skeleton. This has to be implemented in user code.
    166171 *
    167  * @param[in] callid    The message identifier.
    168  * @param[in] call      The message parameters.
    169  * @param[out] answer   The message answer parameters.
     172 * @param[in]  callid       The message identifier.
     173 * @param[in]  call         The message parameters.
     174 * @param[out] answer       The message answer parameters.
    170175 * @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.
     176 *                          the answer parameter.
     177 *
     178 * @return EOK on success.
     179 * @return ENOTSUP if the message is not known.
     180 * @return Other error codes as defined for the specific module message
     181 *         implementation.
     182 *
    177183 */
    178184extern int netif_specific_message(ipc_callid_t callid, ipc_call_t *call,
     
    183189 * This has to be implemented in user code.
    184190 *
    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.
     191 * @param[in]  device_id The device identifier.
     192 * @param[out] stats     The device usage statistics.
     193 *
     194 * @return EOK on success.
     195 * @return Other error codes as defined for the find_device() function.
     196 * @return Other error codes as defined for the specific module message
     197 *         implementation.
     198 *
    193199 */
    194200extern int netif_get_device_stats(device_id_t device_id,
  • uspace/lib/net/include/netif_remote.h

    r1b11576d r58b833c  
    2727 */
    2828
    29 /** @addtogroup libnet
     29/** @addtogroup netif
    3030 * @{
    3131 */
    3232
    33 #ifndef LIBNET_NETIF_REMOTE_H_
    34 #define LIBNET_NETIF_REMOTE_H_
     33#ifndef __NET_NETIF_REMOTE_H__
     34#define __NET_NETIF_REMOTE_H__
    3535
    36 #include <async.h>
    3736#include <ipc/services.h>
    3837#include <adt/measured_strings.h>
    39 
    4038#include <net/device.h>
    41 #include <net/packet.h>
    4239
    4340extern int netif_get_addr_req_remote(int, device_id_t, measured_string_ref *,
  • uspace/lib/net/include/nil_interface.h

    r1b11576d r58b833c  
    2727 */
    2828
    29 /** @addtogroup libnet
    30  * @{
     29/** @addtogroup net_nil
     30 *  @{
    3131 */
    3232
    33 #ifndef LIBNET_NIL_INTERFACE_H_
    34 #define LIBNET_NIL_INTERFACE_H_
     33#ifndef __NET_NIL_INTERFACE_H__
     34#define __NET_NIL_INTERFACE_H__
    3535
    3636#include <async.h>
     
    4747
    4848#define nil_packet_size_req(nil_phone, device_id, packet_dimension) \
    49         generic_packet_size_req_remote(nil_phone, NET_NIL_PACKET_SPACE, \
    50             device_id, packet_dimension)
     49        generic_packet_size_req_remote(nil_phone, NET_NIL_PACKET_SPACE, device_id, \
     50            packet_dimension)
    5151
    5252#define nil_get_addr_req(nil_phone, device_id, address, data) \
  • uspace/lib/net/include/nil_local.h

    r1b11576d r58b833c  
    2727 */
    2828
    29 /** @addtogroup libnet
    30  * @{
     29/** @addtogroup net_nil
     30 *  @{
    3131 */
    3232
     
    3636 */
    3737
    38 #ifndef LIBNET_NIL_LOCAL_H_
    39 #define LIBNET_NIL_LOCAL_H_
     38#ifndef __NET_NIL_LOCAL_H__
     39#define __NET_NIL_LOCAL_H__
    4040
    4141#include <ipc/ipc.h>
     
    4545 * Is called by the module_start() function.
    4646 *
    47  * @param[in] net_phone The networking moduel phone.
    48  * @return              EOK on success.
    49  * @return              Other error codes as defined for each specific module
    50  *                      initialize function.
     47 * @param[in] net_phone The networking moduel phone.
     48 *
     49 * @return EOK on success.
     50 * @return Other error codes as defined for each specific module initialize function.
     51 *
    5152 */
    5253extern int nil_initialize(int);
    5354
    54 /** Notify the network interface layer about the device state change.
    55  *
    56  * @param[in] nil_phone The network interface layer phone.
    57  * @param[in] device_id The device identifier.
    58  * @param[in] state     The new device state.
    59  * @return              EOK on success.
    60  * @return              Other error codes as defined for each specific module
    61  *                      device state function.
    62  */
    6355extern int nil_device_state_msg_local(int, device_id_t, int);
    64 
    65 
    66 /** Pass the packet queue to the network interface layer.
    67  *
    68  * Process and redistribute the received packet queue to the registered
    69  * upper layers.
    70  *
    71  * @param[in] nil_phone The network interface layer phone.
    72  * @param[in] device_id The source device identifier.
    73  * @param[in] packet    The received packet or the received packet queue.
    74  * @param target        The target service. Ignored parameter.
    75  * @return              EOK on success.
    76  * @return              Other error codes as defined for each specific module
    77  *                      received function.
    78  */
    7956extern int nil_received_msg_local(int, device_id_t, packet_t, services_t);
    8057
    8158/** Message processing function.
    8259 *
    83  * @param[in] name      Module name.
    84  * @param[in] callid    The message identifier.
    85  * @param[in] call      The message parameters.
    86  * @param[out] answer   The message answer parameters.
    87  * @param[out] answer_count The last parameter for the actual answer in the
    88  *                      answer parameter.
    89  * @return              EOK on success.
    90  * @return              ENOTSUP if the message is not known.
    91  * @return              Other error codes as defined for each specific module
    92  *                      message function.
     60 * @param[in]  name         Module name.
     61 * @param[in]  callid       The message identifier.
     62 * @param[in]  call         The message parameters.
     63 * @param[out] answer       The message answer parameters.
     64 * @param[out] answer_count The last parameter for the actual answer
     65 *                          in the answer parameter.
     66 *
     67 * @return EOK on success.
     68 * @return ENOTSUP if the message is not known.
     69 * @return Other error codes as defined for each specific
     70 *         module message function.
    9371 *
    9472 * @see nil_interface.h
    9573 * @see IS_NET_NIL_MESSAGE()
     74 *
    9675 */
    97 extern int nil_message_standalone(const char *, ipc_callid_t, ipc_call_t *,
    98     ipc_call_t *, int *);
     76extern int nil_message_standalone(const char *, ipc_callid_t, ipc_call_t *, ipc_call_t *,
     77    int *);
    9978
    100 /** Pass the parameters to the module specific nil_message() function.
    101  *
    102  * @param[in] name      Module name.
    103  * @param[in] callid    The message identifier.
    104  * @param[in] call      The message parameters.
    105  * @param[out] answer   The message answer parameters.
    106  * @param[out] answer_count The last parameter for the actual answer in the
    107  *                      answer parameter.
    108  * @return              EOK on success.
    109  * @return              ENOTSUP if the message is not known.
    110  * @return              Other error codes as defined for each specific module
    111  *                      message function.
    112  */
    11379extern int nil_module_message_standalone(const char *, ipc_callid_t,
    11480    ipc_call_t *, ipc_call_t *, int *);
    115 
    116 /** Start the standalone nil layer module.
    117  *
    118  * Initialize the client connection serving function, initialize
    119  * the module, register the module service and start the async
    120  * manager, processing IPC messages in an infinite loop.
    121  *
    122  * @param[in] client_connection The client connection processing function.
    123  *                      The module skeleton propagates its own one.
    124  * @return              EOK on success.
    125  * @return              Other error codes as defined for the pm_init() function.
    126  * @return              Other error codes as defined for the nil_initialize()
    127  *                      function.
    128  * @return              Other error codes as defined for the REGISTER_ME() macro
    129  *                      function.
    130  */
    13181extern int nil_module_start_standalone(async_client_conn_t);
    13282
  • uspace/lib/net/include/tl_common.h

    r1b11576d r58b833c  
    2727 */
    2828
    29 /** @addtogroup libnet
    30  * @{
     29/** @addtogroup net_tl
     30 *  @{
    3131 */
    3232
    3333/** @file
    34  * Transport layer common functions.
     34 *  Transport layer common functions.
    3535 */
    3636
    37 #ifndef LIBNET_TL_COMMON_H_
    38 #define LIBNET_TL_COMMON_H_
    39 
    40 #include <ipc/services.h>
     37#ifndef __NET_TL_COMMON_H__
     38#define __NET_TL_COMMON_H__
    4139
    4240#include <net/socket_codes.h>
     
    4644
    4745/** Device packet dimensions.
    48  * Maps devices to the packet dimensions.
    49  * @see device.h
     46 *  Maps devices to the packet dimensions.
     47 *  @see device.h
    5048 */
    5149DEVICE_MAP_DECLARE(packet_dimensions, packet_dimension_t);
     
    5351extern int tl_get_ip_packet_dimension(int, packet_dimensions_ref,
    5452    device_id_t, packet_dimension_ref *);
    55 extern int tl_get_address_port(const struct sockaddr *, int, uint16_t *);
    56 extern int tl_update_ip_packet_dimension(packet_dimensions_ref, device_id_t,
    57     size_t);
    58 extern int tl_set_address_port(struct sockaddr *, int, uint16_t);
    59 extern int tl_prepare_icmp_packet(int, int, packet_t, services_t);
    60 extern int tl_socket_read_packet_data(int, packet_ref, size_t,
    61     const packet_dimension_ref, const struct sockaddr *, socklen_t);
     53
     54/** Gets the address port.
     55 *  Supports AF_INET and AF_INET6 address families.
     56 *  @param[in,out] addr The address to be updated.
     57 *  @param[in] addrlen The address length.
     58 *  @param[out] port The set port.
     59 *  @returns EOK on success.
     60 *  @returns EINVAL if the address length does not match the address family.
     61 *  @returns EAFNOSUPPORT if the address family is not supported.
     62 */
     63extern int tl_get_address_port(const struct sockaddr * addr, int addrlen, uint16_t * port);
     64
     65/** Updates IP device packet dimensions cache.
     66 *  @param[in,out] packet_dimensions The packet dimensions cache.
     67 *  @param[in] device_id The device identifier.
     68 *  @param[in] content The new maximum content size.
     69 *  @returns EOK on success.
     70 *  @returns ENOENT if the packet dimension is not cached.
     71 */
     72extern int tl_update_ip_packet_dimension(packet_dimensions_ref packet_dimensions, device_id_t device_id, size_t content);
     73
     74/** Sets the address port.
     75 *  Supports AF_INET and AF_INET6 address families.
     76 *  @param[in,out] addr The address to be updated.
     77 *  @param[in] addrlen The address length.
     78 *  @param[in] port The port to be set.
     79 *  @returns EOK on success.
     80 *  @returns EINVAL if the address length does not match the address family.
     81 *  @returns EAFNOSUPPORT if the address family is not supported.
     82 */
     83extern int tl_set_address_port(struct sockaddr * addr, int addrlen, uint16_t port);
     84
     85/** Prepares the packet for ICMP error notification.
     86 *  Keeps the first packet and releases all the others.
     87 *  Releases all the packets on error.
     88 *  @param[in] packet_phone The packet server module phone.
     89 *  @param[in] icmp_phone The ICMP module phone.
     90 *  @param[in] packet The packet to be send.
     91 *  @param[in] error The packet error reporting service. Prefixes the received packet.
     92 *  @returns EOK on success.
     93 *  @returns ENOENT if no packet may be sent.
     94 */
     95extern int tl_prepare_icmp_packet(int packet_phone, int icmp_phone, packet_t packet, services_t error);
     96
     97/** Receives data from the socket into a packet.
     98 *  @param[in] packet_phone The packet server module phone.
     99 *  @param[out] packet The new created packet.
     100 *  @param[in] prefix Reserved packet data prefix length.
     101 *  @param[in] dimension The packet dimension.
     102 *  @param[in] addr The destination address.
     103 *  @param[in] addrlen The address length.
     104 *  @returns Number of bytes received.
     105 *  @returns EINVAL if the client does not send data.
     106 *  @returns ENOMEM if there is not enough memory left.
     107 *  @returns Other error codes as defined for the async_data_read_finalize() function.
     108 */
     109extern int tl_socket_read_packet_data(int packet_phone, packet_ref packet, size_t prefix, const packet_dimension_ref dimension, const struct sockaddr * addr, socklen_t addrlen);
    62110
    63111#endif
  • uspace/lib/net/netif/netif_local.c

    r1b11576d r58b833c  
    2727 */
    2828
    29 /** @addtogroup libnet
     29/** @addtogroup netif
    3030 * @{
    3131 */
     
    5858DEVICE_MAP_IMPLEMENT(netif_device_map, netif_device_t);
    5959
    60 /** Network interface global data. */
     60/** Network interface global data.
     61 */
    6162netif_globals_t netif_globals;
    6263
     
    6465 *
    6566 * @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)
     67 * @param[in] device_id   The device identifier.
     68 * @param[in] irq         The device interrupt number.
     69 * @param[in] io          The device input/output address.
     70 *
     71 * @return EOK on success.
     72 * @return Other errro codes as defined for the netif_probe_message().
     73 *
     74 */
     75int netif_probe_req_local(int netif_phone, device_id_t device_id, int irq, int io)
    7576{
    7677        fibril_rwlock_write_lock(&netif_globals.lock);
     
    8485 *
    8586 * @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.
     87 * @param[in] device_id   The device identifier.
     88 * @param[in] packet      The packet queue.
     89 * @param[in] sender      The sending module service.
     90 *
     91 * @return EOK on success.
     92 * @return Other error codes as defined for the generic_send_msg() function.
     93 *
    9294 */
    9395int netif_send_msg_local(int netif_phone, device_id_t device_id,
     
    104106 *
    105107 * @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.
     108 * @param[in] device_id   The device identifier.
     109 *
     110 * @return EOK on success.
     111 * @return Other error codes as defined for the find_device() function.
     112 * @return Other error codes as defined for the netif_start_message() function.
     113 *
    112114 */
    113115int netif_start_req_local(int netif_phone, device_id_t device_id)
     
    139141 *
    140142 * @param[in] netif_phone The network interface phone.
    141  * @param[in] device_id The device identifier.
    142  * @return              EOK on success.
    143  * @return              Other error codes as defined for the find_device()
    144  *                      function.
    145  * @return              Other error codes as defined for the
    146  *                      netif_stop_message() function.
     143 * @param[in] device_id   The device identifier.
     144 *
     145 * @return EOK on success.
     146 * @return Other error codes as defined for the find_device() function.
     147 * @return Other error codes as defined for the netif_stop_message() function.
     148 *
    147149 */
    148150int netif_stop_req_local(int netif_phone, device_id_t device_id)
     
    173175/** Return the device usage statistics.
    174176 *
    175  * @param[in] netif_phone The network interface phone.
    176  * @param[in] device_id The device identifier.
    177  * @param[out] stats    The device usage statistics.
    178  * @return EOK on success.
     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 *
     181 * @return EOK on success.
     182 *
    179183 */
    180184int netif_stats_req_local(int netif_phone, device_id_t device_id,
     
    190194/** Return the device local hardware address.
    191195 *
    192  * @param[in] netif_phone The network interface phone.
    193  * @param[in] device_id The device identifier.
    194  * @param[out] address  The device local hardware address.
    195  * @param[out] data     The address data.
    196  * @return              EOK on success.
    197  * @return              EBADMEM if the address parameter is NULL.
    198  * @return              ENOENT if there no such device.
    199  * @return              Other error codes as defined for the
    200  *                      netif_get_addr_message() function.
     196 * @param[in]  netif_phone The network interface phone.
     197 * @param[in]  device_id   The device identifier.
     198 * @param[out] address     The device local hardware address.
     199 * @param[out] data        The address data.
     200 *
     201 * @return EOK on success.
     202 * @return EBADMEM if the address parameter is NULL.
     203 * @return ENOENT if there no such device.
     204 * @return Other error codes as defined for the netif_get_addr_message()
     205 *         function.
     206 *
    201207 */
    202208int netif_get_addr_req_local(int netif_phone, device_id_t device_id,
     
    205211        ERROR_DECLARE;
    206212       
    207         if (!address || !data)
     213        if ((!address) || (!data))
    208214                return EBADMEM;
    209215       
     
    225231/** Find the device specific data.
    226232 *
    227  * @param[in] device_id The device identifier.
    228  * @param[out] device   The device specific data.
    229  * @return              EOK on success.
    230  * @return              ENOENT if device is not found.
    231  * @return              EPERM if the device is not initialized.
     233 * @param[in]  device_id The device identifier.
     234 * @param[out] device    The device specific data.
     235 *
     236 * @return EOK on success.
     237 * @return ENOENT if device is not found.
     238 * @return EPERM if the device is not initialized.
     239 *
    232240 */
    233241int find_device(device_id_t device_id, netif_device_t **device)
     
    248256/** Clear the usage statistics.
    249257 *
    250  * @param[in] stats     The usage statistics.
     258 * @param[in] stats The usage statistics.
     259 *
    251260 */
    252261void null_device_stats(device_stats_ref stats)
     
    257266/** Initialize the netif module.
    258267 *
    259  * @param[in] client_connection The client connection functio to be registered.
    260  * @return              EOK on success.
    261  * @return              Other error codes as defined for each specific module
    262  *                      message function.
     268 *  @param[in] client_connection The client connection functio to be
     269 *                               registered.
     270 *
     271 *  @return EOK on success.
     272 *  @return Other error codes as defined for each specific module
     273 *          message function.
     274 *
    263275 */
    264276int netif_init_module(async_client_conn_t client_connection)
     
    286298 * Prepared for future optimization.
    287299 *
    288  * @param[in] packet_id The packet identifier.
     300 * @param[in] packet_id The packet identifier.
     301 *
    289302 */
    290303void netif_pq_release(packet_id_t packet_id)
     
    295308/** Allocate new packet to handle the given content size.
    296309 *
    297  * @param[in] content   The minimum content size.
    298  * @return              The allocated packet.
    299  * @return              NULL if there is an error.
     310 * @param[in] content The minimum content size.
     311 *
     312 * @return The allocated packet.
     313 * @return NULL if there is an error.
    300314 *
    301315 */
     
    305319}
    306320
    307 /** Register the device notification receiver, the network interface layer
    308  * module.
    309  *
    310  * @param[in] name      Module name.
    311  * @param[in] device_id The device identifier.
    312  * @param[in] phone     The network interface layer module phone.
    313  * @return              EOK on success.
    314  * @return              ENOENT if there is no such device.
    315  * @return              ELIMIT if there is another module registered.
     321/** Register the device notification receiver, the network interface layer module.
     322 *
     323 * @param[in] name      Module name.
     324 * @param[in] device_id The device identifier.
     325 * @param[in] phone     The network interface layer module phone.
     326 *
     327 * @return EOK on success.
     328 * @return ENOENT if there is no such device.
     329 * @return ELIMIT if there is another module registered.
     330 *
    316331 */
    317332static int register_message(const char *name, device_id_t device_id, int phone)
     
    332347/** Process the netif module messages.
    333348 *
    334  * @param[in] name      Module name.
    335  * @param[in] callid    The message identifier.
    336  * @param[in] call      The message parameters.
    337  * @param[out] answer   The message answer parameters.
    338  * @param[out] answer_count The last parameter for the actual answer in the
    339  *                      answer parameter.
    340  * @return              EOK on success.
    341  * @return              ENOTSUP if the message is not known.
    342  * @return              Other error codes as defined for each specific module
    343  *                      message function.
     349 * @param[in]  name         Module name.
     350 * @param[in]  callid       The message identifier.
     351 * @param[in]  call         The message parameters.
     352 * @param[out] answer       The message answer parameters.
     353 * @param[out] answer_count The last parameter for the actual answer
     354 *                          in the answer parameter.
     355 *
     356 * @return EOK on success.
     357 * @return ENOTSUP if the message is not known.
     358 * @return Other error codes as defined for each specific module message function.
    344359 *
    345360 * @see IS_NET_NETIF_MESSAGE()
     
    358373        *answer_count = 0;
    359374        switch (IPC_GET_METHOD(*call)) {
    360         case IPC_M_PHONE_HUNGUP:
    361                 return EOK;
    362        
    363         case NET_NETIF_PROBE:
    364                 return netif_probe_req_local(0, IPC_GET_DEVICE(call),
    365                     NETIF_GET_IRQ(call), NETIF_GET_IO(call));
    366                    
    367         case IPC_M_CONNECT_TO_ME:
    368                 fibril_rwlock_write_lock(&netif_globals.lock);
    369                 ERROR_CODE = register_message(name, IPC_GET_DEVICE(call),
    370                     IPC_GET_PHONE(call));
    371                 fibril_rwlock_write_unlock(&netif_globals.lock);
    372                 return ERROR_CODE;
    373                
    374         case NET_NETIF_SEND:
    375                 ERROR_PROPAGATE(packet_translate_remote(netif_globals.net_phone,
    376                     &packet, IPC_GET_PACKET(call)));
    377                 return netif_send_msg_local(0, IPC_GET_DEVICE(call), packet,
    378                     IPC_GET_SENDER(call));
    379                    
    380         case NET_NETIF_START:
    381                 return netif_start_req_local(0, IPC_GET_DEVICE(call));
    382                
    383         case NET_NETIF_STATS:
    384                 fibril_rwlock_read_lock(&netif_globals.lock);
    385 
    386                 if (ERROR_OCCURRED(async_data_read_receive(&callid, &length))) {
     375                case IPC_M_PHONE_HUNGUP:
     376                        return EOK;
     377                case NET_NETIF_PROBE:
     378                        return netif_probe_req_local(0, IPC_GET_DEVICE(call),
     379                            NETIF_GET_IRQ(call), NETIF_GET_IO(call));
     380                case IPC_M_CONNECT_TO_ME:
     381                        fibril_rwlock_write_lock(&netif_globals.lock);
     382                        ERROR_CODE = register_message(name, IPC_GET_DEVICE(call),
     383                            IPC_GET_PHONE(call));
     384                        fibril_rwlock_write_unlock(&netif_globals.lock);
     385                        return ERROR_CODE;
     386                case NET_NETIF_SEND:
     387                        ERROR_PROPAGATE(packet_translate_remote(netif_globals.net_phone,
     388                            &packet, IPC_GET_PACKET(call)));
     389                        return netif_send_msg_local(0, IPC_GET_DEVICE(call), packet,
     390                            IPC_GET_SENDER(call));
     391                case NET_NETIF_START:
     392                        return netif_start_req_local(0, IPC_GET_DEVICE(call));
     393                case NET_NETIF_STATS:
     394                        fibril_rwlock_read_lock(&netif_globals.lock);
     395                        if (!ERROR_OCCURRED(async_data_read_receive(&callid, &length))) {
     396                                if (length < sizeof(device_stats_t))
     397                                        ERROR_CODE = EOVERFLOW;
     398                                else {
     399                                        if (!ERROR_OCCURRED(netif_get_device_stats(
     400                                            IPC_GET_DEVICE(call), &stats)))
     401                                                ERROR_CODE = async_data_read_finalize(callid, &stats,
     402                                                    sizeof(device_stats_t));
     403                                }
     404                        }
    387405                        fibril_rwlock_read_unlock(&netif_globals.lock);
    388406                        return ERROR_CODE;
    389                 }
    390                 if (length < sizeof(device_stats_t)) {
     407                case NET_NETIF_STOP:
     408                        return netif_stop_req_local(0, IPC_GET_DEVICE(call));
     409                case NET_NETIF_GET_ADDR:
     410                        fibril_rwlock_read_lock(&netif_globals.lock);
     411                        if (!ERROR_OCCURRED(netif_get_addr_message(IPC_GET_DEVICE(call),
     412                            &address)))
     413                                ERROR_CODE = measured_strings_reply(&address, 1);
    391414                        fibril_rwlock_read_unlock(&netif_globals.lock);
    392                         return EOVERFLOW;
    393                 }
    394 
    395                 if (ERROR_NONE(netif_get_device_stats(IPC_GET_DEVICE(call),
    396                     &stats))) {
    397                         ERROR_CODE = async_data_read_finalize(callid, &stats,
    398                             sizeof(device_stats_t));
    399                 }
    400 
    401                 fibril_rwlock_read_unlock(&netif_globals.lock);
    402                 return ERROR_CODE;
    403 
    404         case NET_NETIF_STOP:
    405                 return netif_stop_req_local(0, IPC_GET_DEVICE(call));
    406                
    407         case NET_NETIF_GET_ADDR:
    408                 fibril_rwlock_read_lock(&netif_globals.lock);
    409                 if (ERROR_NONE(netif_get_addr_message(IPC_GET_DEVICE(call),
    410                     &address)))
    411                         ERROR_CODE = measured_strings_reply(&address, 1);
    412                 fibril_rwlock_read_unlock(&netif_globals.lock);
    413                 return ERROR_CODE;
     415                        return ERROR_CODE;
    414416        }
    415417       
     
    419421/** Start the network interface module.
    420422 *
    421  * Initialize the client connection serving function, initialize the module,
    422  * registers the module service and start the async manager, processing IPC
    423  * messages in an infinite loop.
    424  *
    425  * @param[in] client_connection The client connection processing function.
    426  *                      The module skeleton propagates its own one.
    427  * @return              EOK on success.
    428  * @return              Other error codes as defined for each specific module
    429  *                      message function.
     423 * Initialize the client connection serving function, initialize
     424 * the module, registers the module service and start the async
     425 * manager, processing IPC messages in an infinite loop.
     426 *
     427 * @param[in] client_connection The client connection processing
     428 *                              function. The module skeleton propagates
     429 *                              its own one.
     430 *
     431 * @return EOK on success.
     432 * @return Other error codes as defined for each specific module message
     433 *         function.
     434 *
    430435 */
    431436int netif_module_start_standalone(async_client_conn_t client_connection)
  • uspace/lib/net/netif/netif_remote.c

    r1b11576d r58b833c  
    2727 */
    2828
    29 /** @addtogroup libnet
     29/** @addtogroup netif
    3030 * @{
    3131 */
     
    3535 */
    3636
    37 #include <netif_remote.h>
    38 #include <packet_client.h>
    39 #include <generic.h>
    40 
    4137#include <ipc/services.h>
    4238#include <ipc/netif.h>
     
    4541#include <adt/measured_strings.h>
    4642#include <net/packet.h>
     43#include <packet_client.h>
    4744#include <net/device.h>
     45#include <netif_remote.h>
     46#include <generic.h>
    4847
    49 /** Return the device local hardware address.
    50  *
    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.
    60  */
    6148int netif_get_addr_req_remote(int netif_phone, device_id_t device_id,
    6249    measured_string_ref *address, char **data)
     
    6653}
    6754
    68 /** Probe the existence of the device.
    69  *
    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().
    77  */
    78 int
    79 netif_probe_req_remote(int netif_phone, device_id_t device_id, int irq, int io)
     55int netif_probe_req_remote(int netif_phone, device_id_t device_id, int irq, int io)
    8056{
    8157        return async_req_3_0(netif_phone, NET_NETIF_PROBE, device_id, irq, io);
    8258}
    8359
    84 /** Send the packet queue.
    85  *
    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.
    93  */
    94 int
    95 netif_send_msg_remote(int netif_phone, device_id_t device_id, packet_t packet,
     60int netif_send_msg_remote(int netif_phone, device_id_t device_id, packet_t packet,
    9661    services_t sender)
    9762{
     
    10065}
    10166
    102 /** Start the device.
    103  *
    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.
    111  */
    11267int netif_start_req_remote(int netif_phone, device_id_t device_id)
    11368{
     
    11570}
    11671
    117 /** Stop the device.
    118  *
    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  */
    12772int netif_stop_req_remote(int netif_phone, device_id_t device_id)
    12873{
     
    13075}
    13176
    132 /** Return the device usage statistics.
    133  *
    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.
    137  * @return EOK on success.
    138  */
    13977int netif_stats_req_remote(int netif_phone, device_id_t device_id,
    14078    device_stats_ref stats)
     
    16199 * @param[in] receiver  The message receiver.
    162100 *
    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.
     101 * @return The phone of the needed service.
     102 * @return EOK on success.
     103 * @return Other error codes as defined for the bind_service() function.
     104 *
    167105 */
    168 int
    169 netif_bind_service_remote(services_t service, device_id_t device_id,
    170     services_t me, async_client_conn_t receiver)
     106int netif_bind_service_remote(services_t service, device_id_t device_id, services_t me,
     107    async_client_conn_t receiver)
    171108{
    172109        return bind_service(service, device_id, me, 0, receiver);
  • uspace/lib/net/nil/nil_remote.c

    r1b11576d r58b833c  
    2727 */
    2828
    29 /** @addtogroup libnet
     29/** @addtogroup net_nil
    3030 * @{
    3131 */
     
    4747/** Notify the network interface layer about the device state change.
    4848 *
    49  * @param[in] nil_phone The network interface layer phone.
    50  * @param[in] device_id The device identifier.
    51  * @param[in] state     The new device state.
    52  * @return              EOK on success.
    53  * @return              Other error codes as defined for each specific module
    54  *                      device state function.
     49 * @param[in] nil_phone The network interface layer phone.
     50 * @param[in] device_id The device identifier.
     51 * @param[in] state     The new device state.
     52 *
     53 * @return EOK on success.
     54 * @return Other error codes as defined for each specific module device
     55 *         state function.
     56 *
    5557 */
    5658int nil_device_state_msg_remote(int nil_phone, device_id_t device_id, int state)
     
    6567 * upper layers.
    6668 *
    67  * @param[in] nil_phone The network interface layer phone.
    68  * @param[in] device_id The source device identifier.
    69  * @param[in] packet    The received packet or the received packet queue.
    70  * @param target        The target service. Ignored parameter.
    71  * @return              EOK on success.
    72  * @return              Other error codes as defined for each specific module
    73  *                      received function.
     69 * @param[in] nil_phone The network interface layer phone.
     70 * @param[in] device_id The source device identifier.
     71 * @param[in] packet    The received packet or the received packet queue.
     72 * @param     target    The target service. Ignored parameter.
     73 *
     74 * @return EOK on success.
     75 * @return Other error codes as defined for each specific module
     76 *         received function.
     77 *
    7478 */
    7579int nil_received_msg_remote(int nil_phone, device_id_t device_id,
    7680    packet_t packet, services_t target)
    7781{
    78         return generic_received_msg_remote(nil_phone, NET_NIL_RECEIVED,
    79             device_id, packet_get_id(packet), target, 0);
     82        return generic_received_msg_remote(nil_phone, NET_NIL_RECEIVED, device_id,
     83            packet_get_id(packet), target, 0);
    8084}
    8185
  • uspace/lib/net/tl/icmp_client.c

    r1b11576d r58b833c  
    2727 */
    2828
    29 /** @addtogroup libnet
    30  * @{
     29/** @addtogroup icmp
     30 *  @{
    3131 */
    3232
    3333/** @file
    34  * ICMP client interface implementation.
    35  * @see icmp_client.h
     34 *  ICMP client interface implementation.
     35 *  @see icmp_client.h
    3636 */
    3737
    38 #include <icmp_client.h>
    39 #include <icmp_header.h>
    40 #include <packet_client.h>
    41 
    4238#ifdef CONFIG_DEBUG
    43 #include <stdio.h>
     39        #include <stdio.h>
    4440#endif
    4541
     
    4844
    4945#include <net/icmp_codes.h>
     46#include <icmp_client.h>
    5047#include <net/packet.h>
     48#include <packet_client.h>
     49#include <icmp_header.h>
    5150
    52 /** Processes the received packet prefixed with an ICMP header.
    53  *
    54  * @param[in] packet    The received packet.
    55  * @param[out] type     The ICMP header type.
    56  * @param[out] code     The ICMP header code.
    57  * @param[out] pointer  The ICMP header pointer.
    58  * @param[out] mtu      The ICMP header MTU.
    59  * @returns             The ICMP header length.
    60  * @returns             Zero if the packet contains no data.
    61  */
    62 int
    63 icmp_client_process_packet(packet_t packet, icmp_type_t *type,
    64     icmp_code_t *code, icmp_param_t *pointer, icmp_param_t *mtu)
    65 {
     51int icmp_client_process_packet(packet_t packet, icmp_type_t * type, icmp_code_t * code, icmp_param_t * pointer, icmp_param_t * mtu){
    6652        icmp_header_ref header;
    6753
    6854        header = (icmp_header_ref) packet_get_data(packet);
    69         if (!header ||
    70             (packet_get_data_length(packet) < sizeof(icmp_header_t))) {
     55        if((! header)
     56                || (packet_get_data_length(packet) < sizeof(icmp_header_t))){
    7157                return 0;
    7258        }
    73 
    74         if (type)
     59        if(type){
    7560                *type = header->type;
    76         if (code)
     61        }
     62        if(code){
    7763                *code = header->code;
    78         if (pointer)
     64        }
     65        if(pointer){
    7966                *pointer = header->un.param.pointer;
    80         if (mtu)
     67        }
     68        if(mtu){
    8169                *mtu = header->un.frag.mtu;
    82 
     70        }
    8371        // remove debug dump
    8472#ifdef CONFIG_DEBUG
    85         printf("ICMP error %d (%d) in packet %d\n", header->type, header->code,
    86             packet_get_id(packet));
     73        printf("ICMP error %d (%d) in packet %d\n", header->type, header->code, packet_get_id(packet));
    8774#endif
    8875        return sizeof(icmp_header_t);
    8976}
    9077
    91 /** Returns the ICMP header length.
    92  *
    93  * @param[in] packet    The packet.
    94  * @returns             The ICMP header length in bytes.
    95  */
    96 size_t icmp_client_header_length(packet_t packet)
    97 {
    98         if (packet_get_data_length(packet) < sizeof(icmp_header_t))
     78size_t icmp_client_header_length(packet_t packet){
     79        if(packet_get_data_length(packet) < sizeof(icmp_header_t)){
    9980                return 0;
    100 
     81        }
    10182        return sizeof(icmp_header_t);
    10283}
  • uspace/lib/net/tl/tl_common.c

    r1b11576d r58b833c  
    2727 */
    2828
    29 /** @addtogroup libnet
    30  * @{
     29/** @addtogroup net_tl
     30 *  @{
    3131 */
    3232
    3333/** @file
    34  * Transport layer common functions implementation.
    35  * @see tl_common.h
    36  */
    37 
    38 #include <tl_common.h>
     34 *  Transport layer common functions implementation.
     35 *  @see tl_common.h
     36 */
     37
     38#include <net/socket_codes.h>
     39#include <net/in.h>
     40#include <net/in6.h>
     41#include <net/inet.h>
     42#include <async.h>
     43#include <ipc/services.h>
     44#include <errno.h>
     45#include <err.h>
     46
     47#include <net/packet.h>
    3948#include <packet_client.h>
    4049#include <packet_remote.h>
     50#include <net/device.h>
    4151#include <icmp_interface.h>
    4252#include <ip_remote.h>
    4353#include <ip_interface.h>
    4454#include <tl_interface.h>
    45 
    46 #include <net/socket_codes.h>
    47 #include <net/in.h>
    48 #include <net/in6.h>
    49 #include <net/inet.h>
    50 #include <net/device.h>
    51 #include <net/packet.h>
    52 
    53 #include <async.h>
    54 #include <ipc/services.h>
    55 #include <errno.h>
    56 #include <err.h>
     55#include <tl_common.h>
    5756
    5857DEVICE_MAP_IMPLEMENT(packet_dimensions, packet_dimension_t);
    5958
    60 /** Gets the address port.
    61  *
    62  * Supports AF_INET and AF_INET6 address families.
    63  *
    64  * @param[in,out] addr  The address to be updated.
    65  * @param[in] addrlen   The address length.
    66  * @param[out] port     The set port.
    67  * @returns             EOK on success.
    68  * @returns             EINVAL if the address length does not match the address
    69  *                      family.
    70  * @returns             EAFNOSUPPORT if the address family is not supported.
    71  */
    7259int
    7360tl_get_address_port(const struct sockaddr *addr, int addrlen, uint16_t *port)
     
    8774                *port = ntohs(address_in->sin_port);
    8875                break;
    89        
    9076        case AF_INET6:
    9177                if (addrlen != sizeof(struct sockaddr_in6))
    92                         return EINVAL;
     78                                return EINVAL;
    9379
    9480                address_in6 = (struct sockaddr_in6 *) addr;
    9581                *port = ntohs(address_in6->sin6_port);
    9682                break;
    97        
    9883        default:
    9984                return EAFNOSUPPORT;
     
    10893 * The reply is cached then.
    10994 *
    110  * @param[in] ip_phone  The IP moduel phone for (semi)remote calls.
    111  * @param[in] packet_dimensions The packet dimensions cache.
    112  * @param[in] device_id The device identifier.
    113  * @param[out] packet_dimension The IP packet dimensions.
    114  * @return              EOK on success.
    115  * @return              EBADMEM if the packet_dimension parameter is NULL.
    116  * @return              ENOMEM if there is not enough memory left.
    117  * @return              EINVAL if the packet_dimensions cache is not valid.
    118  * @return              Other codes as defined for the ip_packet_size_req()
    119  *                      function.
    120  */
    121 int
    122 tl_get_ip_packet_dimension(int ip_phone,
     95 * @param[in]  ip_phone          The IP moduel phone for (semi)remote calls.
     96 * @param[in]  packet_dimensions The packet dimensions cache.
     97 * @param[in]  device_id         The device identifier.
     98 * @param[out] packet_dimension  The IP packet dimensions.
     99 *
     100 * @return EOK on success.
     101 * @return EBADMEM if the packet_dimension parameter is NULL.
     102 * @return ENOMEM if there is not enough memory left.
     103 * @return EINVAL if the packet_dimensions cache is not valid.
     104 * @return Other codes as defined for the ip_packet_size_req() function.
     105 *
     106 */
     107int tl_get_ip_packet_dimension(int ip_phone,
    123108    packet_dimensions_ref packet_dimensions, device_id_t device_id,
    124109    packet_dimension_ref *packet_dimension)
     
    154139}
    155140
    156 /** Updates IP device packet dimensions cache.
    157  *
    158  * @param[in,out] packet_dimensions The packet dimensions cache.
    159  * @param[in] device_id The device identifier.
    160  * @param[in] content   The new maximum content size.
    161  * @returns             EOK on success.
    162  * @return              ENOENT if the packet dimension is not cached.
    163  */
    164141int
    165142tl_update_ip_packet_dimension(packet_dimensions_ref packet_dimensions,
     
    171148        if (!packet_dimension)
    172149                return ENOENT;
    173 
    174150        packet_dimension->content = content;
    175151
     
    184160                                packet_dimensions_exclude(packet_dimensions,
    185161                                    DEVICE_INVALID_ID);
     162
    186163                }
    187164        }
     
    190167}
    191168
    192 /** Sets the address port.
    193  *
    194  * Supports AF_INET and AF_INET6 address families.
    195  *
    196  * @param[in,out] addr  The address to be updated.
    197  * @param[in] addrlen   The address length.
    198  * @param[in] port      The port to be set.
    199  * @returns             EOK on success.
    200  * @returns             EINVAL if the address length does not match the address
    201  *                      family.
    202  * @returns             EAFNOSUPPORT if the address family is not supported.
    203  */
    204169int tl_set_address_port(struct sockaddr * addr, int addrlen, uint16_t port)
    205170{
     
    222187                address_in->sin_port = htons(port);
    223188                return EOK;
    224        
    225189        case AF_INET6:
    226190                if (length != sizeof(struct sockaddr_in6))
     
    229193                address_in6->sin6_port = htons(port);
    230194                return EOK;
    231        
    232195        default:
    233196                return EAFNOSUPPORT;
     
    235198}
    236199
    237 /** Prepares the packet for ICMP error notification.
    238  *
    239  * Keeps the first packet and releases all the others.
    240  * Releases all the packets on error.
    241  *
    242  * @param[in] packet_phone The packet server module phone.
    243  * @param[in] icmp_phone The ICMP module phone.
    244  * @param[in] packet    The packet to be send.
    245  * @param[in] error     The packet error reporting service. Prefixes the
    246  *                      received packet.
    247  * @returns             EOK on success.
    248  * @returns             ENOENT if no packet may be sent.
    249  */
    250200int
    251201tl_prepare_icmp_packet(int packet_phone, int icmp_phone, packet_t packet,
     
    273223}
    274224
    275 /** Receives data from the socket into a packet.
    276  *
    277  * @param[in] packet_phone The packet server module phone.
    278  * @param[out] packet   The new created packet.
    279  * @param[in] prefix    Reserved packet data prefix length.
    280  * @param[in] dimension The packet dimension.
    281  * @param[in] addr      The destination address.
    282  * @param[in] addrlen   The address length.
    283  * @returns             Number of bytes received.
    284  * @returns             EINVAL if the client does not send data.
    285  * @returns             ENOMEM if there is not enough memory left.
    286  * @returns             Other error codes as defined for the
    287  *                      async_data_read_finalize() function.
    288  */
    289225int
    290226tl_socket_read_packet_data(int packet_phone, packet_ref packet, size_t prefix,
  • uspace/srv/net/il/arp/arp_module.c

    r1b11576d r58b833c  
    5757extern arp_globals_t    arp_globals;
    5858
     59/** Processes the ARP message.
     60 *  @param[in] callid The message identifier.
     61 *  @param[in] call The message parameters.
     62 *  @param[out] answer The message answer parameters.
     63 *  @param[out] answer_count The last parameter for the actual answer in the answer parameter.
     64 *  @returns EOK on success.
     65 *  @returns Other error codes as defined for the arp_message() function.
     66 */
    5967int il_module_message_standalone(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
    6068        return arp_message_standalone(callid, call, answer, answer_count);
    6169}
    6270
     71/** Starts the ARP module.
     72 *  Initializes the client connection serving function, initializes the module, registers the module service and starts the async manager, processing IPC messages in an infinite loop.
     73 *  @param[in] client_connection The client connection processing function. The module skeleton propagates its own one.
     74 *  @returns EOK on successful module termination.
     75 *  @returns Other error codes as defined for the arp_initialize() function.
     76 *  @returns Other error codes as defined for the REGISTER_ME() macro function.
     77 */
    6378int il_module_start_standalone(async_client_conn_t client_connection){
    6479        ERROR_DECLARE;
  • uspace/srv/net/il/ip/ip.c

    r1b11576d r58b833c  
    6767#include <ip_client.h>
    6868#include <ip_interface.h>
    69 #include <ip_header.h>
    7069#include <net_interface.h>
    7170#include <nil_interface.h>
     
    7877
    7978#include "ip.h"
     79#include "ip_header.h"
    8080#include "ip_module.h"
    8181#include "ip_local.h"
  • uspace/srv/net/il/ip/ip_module.c

    r1b11576d r58b833c  
    5656extern ip_globals_t ip_globals;
    5757
     58/** Processes the IP message.
     59 *  @param[in] callid The message identifier.
     60 *  @param[in] call The message parameters.
     61 *  @param[out] answer The message answer parameters.
     62 *  @param[out] answer_count The last parameter for the actual answer in the answer parameter.
     63 *  @returns EOK on success.
     64 *  @returns Other error codes as defined for the ip_message() function.
     65 */
    5866int il_module_message_standalone(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count){
    5967        return ip_message_standalone(callid, call, answer, answer_count);
    6068}
    6169
     70/** Starts the IP module.
     71 *  Initializes the client connection serving function, initializes the module, registers the module service and starts the async manager, processing IPC messages in an infinite loop.
     72 *  @param[in] client_connection The client connection processing function. The module skeleton propagates its own one.
     73 *  @returns EOK on successful module termination.
     74 *  @returns Other error codes as defined for the ip_initialize() function.
     75 *  @returns Other error codes as defined for the REGISTER_ME() macro function.
     76 */
    6277int il_module_start_standalone(async_client_conn_t client_connection){
    6378        ERROR_DECLARE;
  • uspace/srv/net/nil/eth/eth_module.c

    r1b11576d r58b833c  
    5050#include "eth.h"
    5151
     52/** Starts the Ethernet module.
     53 *  Initializes the client connection serving function, initializes the module, registers the module service and starts the async manager, processing IPC messages in an infinite loop.
     54 *  @param[in] client_connection The client connection processing function. The module skeleton propagates its own one.
     55 *  @returns EOK on success.
     56 *  @returns Other error codes as defined for the pm_init() function.
     57 *  @returns Other error codes as defined for the nil_initialize() function.
     58 *  @returns Other error codes as defined for the REGISTER_ME() macro function.
     59 */
    5260int nil_module_start_standalone(async_client_conn_t client_connection)
    5361{
     
    7179}
    7280
     81/** Pass the parameters to the module specific nil_message() function.
     82 *
     83 * @param[in]  name         Module name.
     84 * @param[in]  callid       The message identifier.
     85 * @param[in]  call         The message parameters.
     86 * @param[out] answer       The message answer parameters.
     87 * @param[out] answer_count The last parameter for the actual answer
     88 *                          in the answer parameter.
     89 *
     90 * @return EOK on success.
     91 * @return ENOTSUP if the message is not known.
     92 * @return Other error codes as defined for each
     93 *         specific module message function.
     94 *
     95 */
    7396int nil_module_message_standalone(const char *name, ipc_callid_t callid, ipc_call_t *call,
    7497    ipc_call_t *answer, int *answer_count)
  • uspace/srv/net/nil/nildummy/nildummy_module.c

    r1b11576d r58b833c  
    5050#include "nildummy.h"
    5151
     52/** Start the dummy nil module.
     53 *
     54 * Initialize the client connection serving function, initialize
     55 * the module, register the module service and start the async
     56 * manager, processing IPC messages in an infinite loop.
     57 *
     58 * @param[in] client_connection The client connection processing
     59 *                              function. The module skeleton propagates
     60 *                              its own one.
     61 *
     62 * @return EOK on success.
     63 * @return Other error codes as defined for the pm_init() function.
     64 * @return Other error codes as defined for the nil_initialize() function.
     65 * @return Other error codes as defined for the REGISTER_ME() macro function.
     66 *
     67 */
    5268int nil_module_start_standalone(async_client_conn_t client_connection)
    5369{
     
    7187}
    7288
     89/** Pass the parameters to the module specific nil_message() function.
     90 *
     91 * @param[in]  name         Module name.
     92 * @param[in]  callid       The message identifier.
     93 * @param[in]  call         The message parameters.
     94 * @param[out] answer       The message answer parameters.
     95 * @param[out] answer_count The last parameter for the actual answer
     96 *                          in the answer parameter.
     97 *
     98 * @return EOK on success.
     99 * @return ENOTSUP if the message is not known.
     100 * @return Other error codes as defined for each specific
     101 *          module message function.
     102 *
     103 */
    73104int nil_module_message_standalone(const char *name, ipc_callid_t callid,
    74105    ipc_call_t *call, ipc_call_t *answer, int *answer_count)
Note: See TracChangeset for help on using the changeset viewer.