Changeset fdbc3ff in mainline for uspace/srv/net


Ignore:
Timestamp:
2010-11-19T23:50:06Z (15 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
46d4d9f
Parents:
b4c9c61 (diff), a9c6b966 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

Location:
uspace/srv/net
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/il/arp/arp.c

    rb4c9c61 rfdbc3ff  
    8383 * @param[in] device    The device specific data.
    8484 */
    85 static void arp_clear_device(arp_device_ref device)
     85static void arp_clear_device(arp_device_t *device)
    8686{
    8787        int count;
    88         arp_proto_ref proto;
     88        arp_proto_t *proto;
    8989
    9090        for (count = arp_protos_count(&device->protos) - 1; count >= 0;
     
    105105{
    106106        int count;
    107         arp_device_ref device;
     107        arp_device_t *device;
    108108
    109109        fibril_rwlock_write_lock(&arp_globals.lock);
     
    126126
    127127static int arp_clear_address_req(int arp_phone, device_id_t device_id,
    128     services_t protocol, measured_string_ref address)
    129 {
    130         arp_device_ref device;
    131         arp_proto_ref proto;
     128    services_t protocol, measured_string_t *address)
     129{
     130        arp_device_t *device;
     131        arp_proto_t *proto;
    132132
    133133        fibril_rwlock_write_lock(&arp_globals.lock);
     
    150150static int arp_clear_device_req(int arp_phone, device_id_t device_id)
    151151{
    152         arp_device_ref device;
     152        arp_device_t *device;
    153153
    154154        fibril_rwlock_write_lock(&arp_globals.lock);
     
    171171 * @param[in] service   The protocol module service.
    172172 * @param[in] address   The actual protocol device address.
    173  * @returns             EOK on success.
    174  * @returns             ENOMEM if there is not enough memory left.
    175  */
    176 static int arp_proto_create(arp_proto_ref *proto, services_t service,
    177     measured_string_ref address)
     173 * @return              EOK on success.
     174 * @return              ENOMEM if there is not enough memory left.
     175 */
     176static int arp_proto_create(arp_proto_t **proto, services_t service,
     177    measured_string_t *address)
    178178{
    179179        int rc;
    180180
    181         *proto = (arp_proto_ref) malloc(sizeof(arp_proto_t));
     181        *proto = (arp_proto_t *) malloc(sizeof(arp_proto_t));
    182182        if (!*proto)
    183183                return ENOMEM;
     
    205205 * @param[in] protocol  The protocol service.
    206206 * @param[in] address   The actual device protocol address.
    207  * @returns             EOK on success.
    208  * @returns             EEXIST if another device with the same device identifier
     207 * @return              EOK on success.
     208 * @return              EEXIST if another device with the same device identifier
    209209 *                      and different driver service exists.
    210  * @returns             ENOMEM if there is not enough memory left.
    211  * @returns             Other error codes as defined for the
     210 * @return              ENOMEM if there is not enough memory left.
     211 * @return              Other error codes as defined for the
    212212 *                      measured_strings_return() function.
    213213 */
    214214static int arp_device_message(device_id_t device_id, services_t service,
    215     services_t protocol, measured_string_ref address)
    216 {
    217         arp_device_ref device;
    218         arp_proto_ref proto;
     215    services_t protocol, measured_string_t *address)
     216{
     217        arp_device_t *device;
     218        arp_proto_t *proto;
    219219        hw_type_t hardware;
    220220        int index;
     
    260260               
    261261                /* Create a new device */
    262                 device = (arp_device_ref) malloc(sizeof(arp_device_t));
     262                device = (arp_device_t *) malloc(sizeof(arp_device_t));
    263263                if (!device) {
    264264                        fibril_rwlock_write_unlock(&arp_globals.lock);
     
    356356 *  @param[in] client_connection The client connection processing function.
    357357 *                      The module skeleton propagates its own one.
    358  *  @returns            EOK on success.
    359  *  @returns            ENOMEM if there is not enough memory left.
     358 *  @return             EOK on success.
     359 *  @return             ENOMEM if there is not enough memory left.
    360360 */
    361361int arp_initialize(async_client_conn_t client_connection)
     
    376376 * @param[in] device_id The device identifier.
    377377 * @param[in] mtu       The new mtu value.
    378  * @returns             ENOENT if device is not found.
    379  * @returns             EOK on success.
     378 * @return              ENOENT if device is not found.
     379 * @return              EOK on success.
    380380 */
    381381static int arp_mtu_changed_message(device_id_t device_id, size_t mtu)
    382382{
    383         arp_device_ref device;
     383        arp_device_t *device;
    384384
    385385        fibril_rwlock_write_lock(&arp_globals.lock);
     
    404404 * @param[in] device_id The source device identifier.
    405405 * @param[in,out] packet The received packet.
    406  * @returns             EOK on success and the packet is no longer needed.
    407  * @returns             One on success and the packet has been reused.
    408  * @returns             EINVAL if the packet is too small to carry an ARP
     406 * @return              EOK on success and the packet is no longer needed.
     407 * @return              One on success and the packet has been reused.
     408 * @return              EINVAL if the packet is too small to carry an ARP
    409409 *                      packet.
    410  * @returns             EINVAL if the received address lengths differs from
     410 * @return              EINVAL if the received address lengths differs from
    411411 *                      the registered values.
    412  * @returns             ENOENT if the device is not found in the cache.
    413  * @returns             ENOENT if the protocol for the device is not found in
     412 * @return              ENOENT if the device is not found in the cache.
     413 * @return              ENOENT if the protocol for the device is not found in
    414414 *                      the cache.
    415  * @returns             ENOMEM if there is not enough memory left.
     415 * @return              ENOMEM if there is not enough memory left.
    416416 */
    417417static int arp_receive_message(device_id_t device_id, packet_t packet)
    418418{
    419419        size_t length;
    420         arp_header_ref header;
    421         arp_device_ref device;
    422         arp_proto_ref proto;
    423         measured_string_ref hw_source;
     420        arp_header_t *header;
     421        arp_device_t *device;
     422        arp_proto_t *proto;
     423        measured_string_t *hw_source;
    424424        uint8_t *src_hw;
    425425        uint8_t *src_proto;
     
    436436                return ENOENT;
    437437
    438         header = (arp_header_ref) packet_get_data(packet);
     438        header = (arp_header_t *) packet_get_data(packet);
    439439        if ((ntohs(header->hardware) != device->hardware) ||
    440440            (length < sizeof(arp_header_t) + header->hardware_length * 2U +
     
    516516 * @param[in] protocol  The protocol service.
    517517 * @param[in] target    The target protocol address.
    518  * @returns             The hardware address of the target.
    519  * @returns             NULL if the target parameter is NULL.
    520  * @returns             NULL if the device is not found.
    521  * @returns             NULL if the device packet is too small to send a
     518 * @return              The hardware address of the target.
     519 * @return              NULL if the target parameter is NULL.
     520 * @return              NULL if the device is not found.
     521 * @return              NULL if the device packet is too small to send a
    522522 *                      request.
    523  * @returns             NULL if the hardware address is not found in the cache.
    524  */
    525 static measured_string_ref
     523 * @return              NULL if the hardware address is not found in the cache.
     524 */
     525static measured_string_t *
    526526arp_translate_message(device_id_t device_id, services_t protocol,
    527     measured_string_ref target)
    528 {
    529         arp_device_ref device;
    530         arp_proto_ref proto;
    531         measured_string_ref addr;
     527    measured_string_t *target)
     528{
     529        arp_device_t *device;
     530        arp_proto_t *proto;
     531        measured_string_t *addr;
    532532        size_t length;
    533533        packet_t packet;
    534         arp_header_ref header;
     534        arp_header_t *header;
    535535
    536536        if (!target)
     
    561561                return NULL;
    562562
    563         header = (arp_header_ref) packet_suffix(packet, length);
     563        header = (arp_header_t *) packet_suffix(packet, length);
    564564        if (!header) {
    565565                pq_release_remote(arp_globals.net_phone, packet_get_id(packet));
     
    602602 * @param[out] answer_count The last parameter for the actual answer in the
    603603 *                      answer parameter.
    604  * @returns             EOK on success.
    605  * @returns             ENOTSUP if the message is not known.
     604 * @return              EOK on success.
     605 * @return              ENOTSUP if the message is not known.
    606606 *
    607607 * @see arp_interface.h
     
    612612    ipc_call_t *answer, int *answer_count)
    613613{
    614         measured_string_ref address;
    615         measured_string_ref translation;
     614        measured_string_t *address;
     615        measured_string_t *translation;
    616616        char *data;
    617617        packet_t packet;
     
    747747/** Starts the module.
    748748 *
    749  * @returns             EOK on success.
    750  * @returns             Other error codes as defined for each specific module
     749 * @return              EOK on success.
     750 * @return              Other error codes as defined for each specific module
    751751 *                      start function.
    752752 */
  • uspace/srv/net/il/arp/arp.h

    rb4c9c61 rfdbc3ff  
    5555typedef struct arp_device arp_device_t;
    5656
    57 /** Type definition of the ARP device specific data pointer.
    58  * @see arp_device
    59  */
    60 typedef arp_device_t *arp_device_ref;
    61 
    6257/** Type definition of the ARP global data.
    6358 * @see arp_globals
     
    6964 */
    7065typedef struct arp_proto arp_proto_t;
    71 
    72 /** Type definition of the ARP protocol specific data pointer.
    73  * @see arp_proto
    74  */
    75 typedef arp_proto_t *arp_proto_ref;
    7666
    7767/** ARP address map.
     
    9989struct arp_device {
    10090        /** Actual device hardware address. */
    101         measured_string_ref addr;
     91        measured_string_t * addr;
    10292        /** Actual device hardware address data. */
    10393        char *addr_data;
    10494        /** Broadcast device hardware address. */
    105         measured_string_ref broadcast_addr;
     95        measured_string_t * broadcast_addr;
    10696        /** Broadcast device hardware address data. */
    10797        char *broadcast_data;
     
    145135struct arp_proto {
    146136        /** Actual device protocol address. */
    147         measured_string_ref addr;
     137        measured_string_t *addr;
    148138        /** Actual device protocol address data. */
    149139        char *addr_data;
  • uspace/srv/net/il/arp/arp_header.h

    rb4c9c61 rfdbc3ff  
    4646typedef struct arp_header arp_header_t;
    4747
    48 /** Type definition of an ARP protocol header pointer.
    49  * @see arp_header
    50  */
    51 typedef arp_header_t *arp_header_ref;
    52 
    5348/** ARP protocol header. */
    5449struct arp_header {
  • uspace/srv/net/il/ip/ip.c

    rb4c9c61 rfdbc3ff  
    139139 * Searches the registered protocols.
    140140 *
    141  * @returns             The found ICMP phone.
    142  * @returns             ENOENT if the ICMP is not registered.
     141 * @return              The found ICMP phone.
     142 * @return              ENOENT if the ICMP is not registered.
    143143 */
    144144static int ip_get_icmp_phone(void)
    145145{
    146         ip_proto_ref proto;
     146        ip_proto_t *proto;
    147147        int phone;
    148148
     
    160160 * @param[in] packet    The packet or the packet queue to be reported as faulty.
    161161 * @param[in] header    The first packet IP header. May be NULL.
    162  * @returns             EOK on success.
    163  * @returns             EINVAL if there are no data in the packet.
    164  * @returns             EINVAL if the packet is a fragment.
    165  * @returns             ENOMEM if the packet is too short to contain the IP
     162 * @return              EOK on success.
     163 * @return              EINVAL if there are no data in the packet.
     164 * @return              EINVAL if the packet is a fragment.
     165 * @return              ENOMEM if the packet is too short to contain the IP
    166166 *                      header.
    167  * @returns             EAFNOSUPPORT if the address family is not supported.
    168  * @returns             EPERM if the protocol is not allowed to send ICMP
     167 * @return              EAFNOSUPPORT if the address family is not supported.
     168 * @return              EPERM if the protocol is not allowed to send ICMP
    169169 *                      notifications. The ICMP protocol itself.
    170  * @returns             Other error codes as defined for the packet_set_addr().
    171  */
    172 static int ip_prepare_icmp(packet_t packet, ip_header_ref header)
     170 * @return              Other error codes as defined for the packet_set_addr().
     171 */
     172static int ip_prepare_icmp(packet_t packet, ip_header_t *header)
    173173{
    174174        packet_t next;
     
    187187
    188188                // get header
    189                 header = (ip_header_ref) packet_get_data(packet);
     189                header = (ip_header_t *) packet_get_data(packet);
    190190                if (!header)
    191191                        return EINVAL;
     
    227227 * @param[in] packet    The packet or the packet queue to be reported as faulty.
    228228 * @param[in] header    The first packet IP header. May be NULL.
    229  * @returns             The found ICMP phone.
    230  * @returns             EINVAL if the error parameter is set.
    231  * @returns             EINVAL if the ICMP phone is not found.
    232  * @returns             EINVAL if the ip_prepare_icmp() fails.
     229 * @return              The found ICMP phone.
     230 * @return              EINVAL if the error parameter is set.
     231 * @return              EINVAL if the ICMP phone is not found.
     232 * @return              EINVAL if the ip_prepare_icmp() fails.
    233233 */
    234234static int
    235235ip_prepare_icmp_and_get_phone(services_t error, packet_t packet,
    236     ip_header_ref header)
     236    ip_header_t *header)
    237237{
    238238        int phone;
     
    248248 * @param[in] client_connection The client connection processing function. The
    249249 *                      module skeleton propagates its own one.
    250  * @returns             EOK on success.
    251  * @returns             ENOMEM if there is not enough memory left.
     250 * @return              EOK on success.
     251 * @return              ENOMEM if there is not enough memory left.
    252252 */
    253253int ip_initialize(async_client_conn_t client_connection)
     
    293293 *
    294294 * @param[in,out] ip_netif Network interface specific data.
    295  * @returns             EOK on success.
    296  * @returns             ENOTSUP if DHCP is configured.
    297  * @returns             ENOTSUP if IPv6 is configured.
    298  * @returns             EINVAL if any of the addresses is invalid.
    299  * @returns             EINVAL if the used ARP module is not known.
    300  * @returns             ENOMEM if there is not enough memory left.
    301  * @returns             Other error codes as defined for the
     295 * @return              EOK on success.
     296 * @return              ENOTSUP if DHCP is configured.
     297 * @return              ENOTSUP if IPv6 is configured.
     298 * @return              EINVAL if any of the addresses is invalid.
     299 * @return              EINVAL if the used ARP module is not known.
     300 * @return              ENOMEM if there is not enough memory left.
     301 * @return              Other error codes as defined for the
    302302 *                      net_get_device_conf_req() function.
    303  * @returns             Other error codes as defined for the bind_service()
     303 * @return              Other error codes as defined for the bind_service()
    304304 *                      function.
    305  * @returns             Other error codes as defined for the specific
     305 * @return              Other error codes as defined for the specific
    306306 *                      arp_device_req() function.
    307  * @returns             Other error codes as defined for the
     307 * @return              Other error codes as defined for the
    308308 *                      nil_packet_size_req() function.
    309309 */
    310 static int ip_netif_initialize(ip_netif_ref ip_netif)
     310static int ip_netif_initialize(ip_netif_t *ip_netif)
    311311{
    312312        measured_string_t names[] = {
     
    344344                }
    345345        };
    346         measured_string_ref configuration;
     346        measured_string_t *configuration;
    347347        size_t count = sizeof(names) / sizeof(measured_string_t);
    348348        char *data;
    349349        measured_string_t address;
    350         ip_route_ref route;
     350        ip_route_t *route;
    351351        in_addr_t gateway;
    352352        int index;
     
    378378                        return ENOTSUP;
    379379                } else if (ip_netif->ipv == IPV4) {
    380                         route = (ip_route_ref) malloc(sizeof(ip_route_t));
     380                        route = (ip_route_t *) malloc(sizeof(ip_route_t));
    381381                        if (!route) {
    382382                                net_free_settings(configuration, data);
     
    486486 * @param[in] device_id The device identifier.
    487487 * @param[in] mtu       The new mtu value.
    488  * @returns             EOK on success.
    489  * @returns             ENOENT if device is not found.
     488 * @return              EOK on success.
     489 * @return              ENOENT if device is not found.
    490490 */
    491491static int ip_mtu_changed_message(device_id_t device_id, size_t mtu)
    492492{
    493         ip_netif_ref netif;
     493        ip_netif_t *netif;
    494494
    495495        fibril_rwlock_write_lock(&ip_globals.netifs_lock);
     
    511511 * @param[in] device_id The device identifier.
    512512 * @param[in] state     The new state value.
    513  * @returns             EOK on success.
    514  * @returns             ENOENT if device is not found.
     513 * @return              EOK on success.
     514 * @return              ENOENT if device is not found.
    515515 */
    516516static int ip_device_state_message(device_id_t device_id, device_state_t state)
    517517{
    518         ip_netif_ref netif;
     518        ip_netif_t *netif;
    519519
    520520        fibril_rwlock_write_lock(&ip_globals.netifs_lock);
     
    539539 * @param[in] packet    The packet to be prefixed.
    540540 * @param[in] last      The last header to be copied.
    541  * @returns             The prefixed middle header.
    542  * @returns             NULL on error.
    543  */
    544 static ip_header_ref
    545 ip_create_middle_header(packet_t packet, ip_header_ref last)
    546 {
    547         ip_header_ref middle;
    548 
    549         middle = (ip_header_ref) packet_suffix(packet, IP_HEADER_LENGTH(last));
     541 * @return              The prefixed middle header.
     542 * @return              NULL on error.
     543 */
     544static ip_header_t *
     545ip_create_middle_header(packet_t packet, ip_header_t *last)
     546{
     547        ip_header_t *middle;
     548
     549        middle = (ip_header_t *) packet_suffix(packet, IP_HEADER_LENGTH(last));
    550550        if (!middle)
    551551                return NULL;
     
    562562 * @param[in] first     The original header to be copied.
    563563 */
    564 static void ip_create_last_header(ip_header_ref last, ip_header_ref first)
    565 {
    566         ip_option_ref option;
     564static void ip_create_last_header(ip_header_t *last, ip_header_t *first)
     565{
     566        ip_option_t *option;
    567567        size_t next;
    568568        size_t length;
     
    575575        // process all ip options
    576576        while (next < first->header_length) {
    577                 option = (ip_option_ref) (((uint8_t *) first) + next);
     577                option = (ip_option_t *) (((uint8_t *) first) + next);
    578578                // skip end or noop
    579579                if ((option->type == IPOPT_END) ||
     
    613613 * @param[in,out] packet The packet to be sent.
    614614 * @param[in] destination The destination hardware address.
    615  * @returns             EOK on success.
    616  * @returns             EINVAL if the packet is too small to contain the IP
     615 * @return              EOK on success.
     616 * @return              EINVAL if the packet is too small to contain the IP
    617617 *                      header.
    618  * @returns             EINVAL if the packet is too long than the IP allows.
    619  * @returns             ENOMEM if there is not enough memory left.
    620  * @returns             Other error codes as defined for the packet_set_addr()
     618 * @return              EINVAL if the packet is too long than the IP allows.
     619 * @return              ENOMEM if there is not enough memory left.
     620 * @return              Other error codes as defined for the packet_set_addr()
    621621 *                      function.
    622622 */
    623623static int
    624624ip_prepare_packet(in_addr_t *source, in_addr_t dest, packet_t packet,
    625     measured_string_ref destination)
     625    measured_string_t *destination)
    626626{
    627627        size_t length;
    628         ip_header_ref header;
    629         ip_header_ref last_header;
    630         ip_header_ref middle_header;
     628        ip_header_t *header;
     629        ip_header_t *last_header;
     630        ip_header_t *middle_header;
    631631        packet_t next;
    632632        int rc;
     
    636636                return EINVAL;
    637637
    638         header = (ip_header_ref) packet_get_data(packet);
     638        header = (ip_header_t *) packet_get_data(packet);
    639639        if (destination) {
    640640                rc = packet_set_addr(packet, NULL, (uint8_t *) destination->value,
     
    660660
    661661        if (pq_next(packet)) {
    662                 last_header = (ip_header_ref) malloc(IP_HEADER_LENGTH(header));
     662                last_header = (ip_header_t *) malloc(IP_HEADER_LENGTH(header));
    663663                if (!last_header)
    664664                        return ENOMEM;
     
    666666                next = pq_next(packet);
    667667                while (pq_next(next)) {
    668                         middle_header = (ip_header_ref) packet_prefix(next,
     668                        middle_header = (ip_header_t *) packet_prefix(next,
    669669                            IP_HEADER_LENGTH(last_header));
    670670                        if (!middle_header) {
     
    698698                }
    699699
    700                 middle_header = (ip_header_ref) packet_prefix(next,
     700                middle_header = (ip_header_t *) packet_prefix(next,
    701701                    IP_HEADER_LENGTH(last_header));
    702702                if (!middle_header) {
     
    746746 * @param[in] dest      The destiantion address.
    747747 * @param[in] addrlen   The address length.
    748  * @returns             EOK on success.
    749  * @returns             ENOMEM if the target packet is too small.
    750  * @returns             Other error codes as defined for the packet_set_addr()
     748 * @return              EOK on success.
     749 * @return              ENOMEM if the target packet is too small.
     750 * @return              Other error codes as defined for the packet_set_addr()
    751751 *                      function.
    752  * @returns             Other error codes as defined for the pq_insert_after()
     752 * @return              Other error codes as defined for the pq_insert_after()
    753753 *                      function.
    754754 */
    755755static int
    756756ip_fragment_packet_data(packet_t packet, packet_t new_packet,
    757     ip_header_ref header, ip_header_ref new_header, size_t length,
     757    ip_header_t *header, ip_header_t *new_header, size_t length,
    758758    const struct sockaddr *src, const struct sockaddr *dest, socklen_t addrlen)
    759759{
     
    799799 * @param[in] suffix    The minimum suffix size.
    800800 * @param[in] addr_len  The minimum address length.
    801  * @returns             EOK on success.
    802  * @returns             EINVAL if the packet_get_addr() function fails.
    803  * @returns             EINVAL if the packet does not contain the IP header.
    804  * @returns             EPERM if the packet needs to be fragmented and the
     801 * @return              EOK on success.
     802 * @return              EINVAL if the packet_get_addr() function fails.
     803 * @return              EINVAL if the packet does not contain the IP header.
     804 * @return              EPERM if the packet needs to be fragmented and the
    805805 *                      fragmentation is not allowed.
    806  * @returns             ENOMEM if there is not enough memory left.
    807  * @returns             ENOMEM if there is no packet available.
    808  * @returns             ENOMEM if the packet is too small to contain the IP
     806 * @return              ENOMEM if there is not enough memory left.
     807 * @return              ENOMEM if there is no packet available.
     808 * @return              ENOMEM if the packet is too small to contain the IP
    809809 *                      header.
    810  * @returns             Other error codes as defined for the packet_trim()
     810 * @return              Other error codes as defined for the packet_trim()
    811811 *                      function.
    812  * @returns             Other error codes as defined for the
     812 * @return              Other error codes as defined for the
    813813 *                      ip_create_middle_header() function.
    814  * @returns             Other error codes as defined for the
     814 * @return              Other error codes as defined for the
    815815 *                      ip_fragment_packet_data() function.
    816816 */
     
    820820{
    821821        packet_t new_packet;
    822         ip_header_ref header;
    823         ip_header_ref middle_header;
    824         ip_header_ref last_header;
     822        ip_header_t *header;
     823        ip_header_t *middle_header;
     824        ip_header_t *last_header;
    825825        struct sockaddr *src;
    826826        struct sockaddr *dest;
     
    838838
    839839        // get header
    840         header = (ip_header_ref) packet_get_data(packet);
     840        header = (ip_header_t *) packet_get_data(packet);
    841841        if (!header)
    842842                return EINVAL;
     
    853853
    854854        // allocate as much as originally
    855         last_header = (ip_header_ref) packet_suffix(new_packet,
     855        last_header = (ip_header_t *) packet_suffix(new_packet,
    856856            IP_HEADER_LENGTH(header));
    857857        if (!last_header)
     
    919919 * @param[in] addr_len  The minimum address length.
    920920 * @param[in] error     The error module service.
    921  * @returns             The packet or the packet queue of the allowed length.
    922  * @returns             NULL if there are no packets left.
     921 * @return              The packet or the packet queue of the allowed length.
     922 * @return              NULL if there are no packets left.
    923923 */
    924924static packet_t
     
    986986 * @param[in] dest      The destination address.
    987987 * @param[in] error     The error module service.
    988  * @returns             EOK on success.
    989  * @returns             Other error codes as defined for the arp_translate_req()
     988 * @return              EOK on success.
     989 * @return              Other error codes as defined for the arp_translate_req()
    990990 *                      function.
    991  * @returns             Other error codes as defined for the ip_prepare_packet()
     991 * @return              Other error codes as defined for the ip_prepare_packet()
    992992 *                      function.
    993993 */
    994994static int
    995 ip_send_route(packet_t packet, ip_netif_ref netif, ip_route_ref route,
     995ip_send_route(packet_t packet, ip_netif_t *netif, ip_route_t *route,
    996996    in_addr_t *src, in_addr_t dest, services_t error)
    997997{
    998998        measured_string_t destination;
    999         measured_string_ref translation;
     999        measured_string_t *translation;
    10001000        char *data;
    10011001        int phone;
     
    10621062 *                      NULL.
    10631063 * @param[in] destination The destination address.
    1064  * @returns             The found route.
    1065  * @returns             NULL if no route was found.
    1066  */
    1067 static ip_route_ref
    1068 ip_netif_find_route(ip_netif_ref netif, in_addr_t destination)
     1064 * @return              The found route.
     1065 * @return              NULL if no route was found.
     1066 */
     1067static ip_route_t *
     1068ip_netif_find_route(ip_netif_t *netif, in_addr_t destination)
    10691069{
    10701070        int index;
    1071         ip_route_ref route;
     1071        ip_route_t *route;
    10721072
    10731073        if (!netif)
     
    10901090 *
    10911091 * @param[in] destination The destination address.
    1092  * @returns             The found route.
    1093  * @returns             NULL if no route was found.
    1094  */
    1095 static ip_route_ref ip_find_route(in_addr_t destination) {
     1092 * @return              The found route.
     1093 * @return              NULL if no route was found.
     1094 */
     1095static ip_route_t *ip_find_route(in_addr_t destination) {
    10961096        int index;
    1097         ip_route_ref route;
    1098         ip_netif_ref netif;
     1097        ip_route_t *route;
     1098        ip_netif_t *netif;
    10991099
    11001100        // start with the last netif - the newest one
     
    11161116 *
    11171117 * @param[in] netif     The network interface.
    1118  * @returns             The IP address.
    1119  * @returns             NULL if no IP address was found.
    1120  */
    1121 static in_addr_t *ip_netif_address(ip_netif_ref netif)
    1122 {
    1123         ip_route_ref route;
     1118 * @return              The IP address.
     1119 * @return              NULL if no IP address was found.
     1120 */
     1121static in_addr_t *ip_netif_address(ip_netif_t *netif)
     1122{
     1123        ip_route_t *route;
    11241124
    11251125        route = ip_routes_get_index(&netif->routes, 0);
     
    11361136 * @param[in] phone     The transport layer module phone.
    11371137 * @param[in] received_msg The receiving function.
    1138  * @returns             EOK on success.
    1139  * @returns             EINVAL if the protocol parameter and/or the service
     1138 * @return              EOK on success.
     1139 * @return              EINVAL if the protocol parameter and/or the service
    11401140 *                      parameter is zero.
    1141  * @returns             EINVAL if the phone parameter is not a positive number
     1141 * @return              EINVAL if the phone parameter is not a positive number
    11421142 *                      and the tl_receive_msg is NULL.
    1143  * @returns             ENOMEM if there is not enough memory left.
     1143 * @return              ENOMEM if there is not enough memory left.
    11441144 */
    11451145static int
     
    11471147    tl_received_msg_t received_msg)
    11481148{
    1149         ip_proto_ref proto;
     1149        ip_proto_t *proto;
    11501150        int index;
    11511151
     
    11531153                return EINVAL;
    11541154
    1155         proto = (ip_proto_ref) malloc(sizeof(ip_protos_t));
     1155        proto = (ip_proto_t *) malloc(sizeof(ip_protos_t));
    11561156        if (!proto)
    11571157                return ENOMEM;
     
    11801180ip_device_req_local(int il_phone, device_id_t device_id, services_t netif)
    11811181{
    1182         ip_netif_ref ip_netif;
    1183         ip_route_ref route;
     1182        ip_netif_t *ip_netif;
     1183        ip_route_t *route;
    11841184        int index;
    11851185        int rc;
    11861186
    1187         ip_netif = (ip_netif_ref) malloc(sizeof(ip_netif_t));
     1187        ip_netif = (ip_netif_t *) malloc(sizeof(ip_netif_t));
    11881188        if (!ip_netif)
    11891189                return ENOMEM;
     
    12511251{
    12521252        int addrlen;
    1253         ip_netif_ref netif;
    1254         ip_route_ref route;
     1253        ip_netif_t *netif;
     1254        ip_route_t *route;
    12551255        struct sockaddr *addr;
    12561256        struct sockaddr_in *address_in;
     
    13611361 * @param[out] content  The maximum content size.
    13621362 * @param[out] suffix   The minimum reserved suffix size.
    1363  * @returns             EOK on success.
     1363 * @return              EOK on success.
    13641364 */
    13651365static int
     
    13671367    size_t *content, size_t *suffix)
    13681368{
    1369         ip_netif_ref netif;
     1369        ip_netif_t *netif;
    13701370        int index;
    13711371
     
    14181418 *
    14191419 * @param[in] header    The packet IP header to be read.
    1420  * @returns             The packet destination address.
    1421  */
    1422 static in_addr_t ip_get_destination(ip_header_ref header)
     1420 * @return              The packet destination address.
     1421 */
     1422static in_addr_t ip_get_destination(ip_header_t *header)
    14231423{
    14241424        in_addr_t destination;
     
    14391439 * @param[in] header    The first packet IP header. May be NULL.
    14401440 * @param[in] error     The packet error service.
    1441  * @returns             EOK on success.
    1442  * @returns             ENOTSUP if the packet is a fragment.
    1443  * @returns             EAFNOSUPPORT if the address family is not supported.
    1444  * @returns             ENOENT if the target protocol is not found.
    1445  * @returns             Other error codes as defined for the packet_set_addr()
     1441 * @return              EOK on success.
     1442 * @return              ENOTSUP if the packet is a fragment.
     1443 * @return              EAFNOSUPPORT if the address family is not supported.
     1444 * @return              ENOENT if the target protocol is not found.
     1445 * @return              Other error codes as defined for the packet_set_addr()
    14461446 *                      function.
    1447  * @returns             Other error codes as defined for the packet_trim()
     1447 * @return              Other error codes as defined for the packet_trim()
    14481448 *                      function.
    1449  * @returns             Other error codes as defined for the protocol specific
     1449 * @return              Other error codes as defined for the protocol specific
    14501450 *                      tl_received_msg() function.
    14511451 */
    14521452static int
    1453 ip_deliver_local(device_id_t device_id, packet_t packet, ip_header_ref header,
     1453ip_deliver_local(device_id_t device_id, packet_t packet, ip_header_t *header,
    14541454    services_t error)
    14551455{
    1456         ip_proto_ref proto;
     1456        ip_proto_t *proto;
    14571457        int phone;
    14581458        services_t service;
     
    15441544 * @param[in] device_id The source device identifier.
    15451545 * @param[in] packet    The received packet to be processed.
    1546  * @returns             EOK on success.
    1547  * @returns             EINVAL if the TTL is less than two.
    1548  * @returns             EINVAL if the checksum is invalid.
    1549  * @returns             EAFNOSUPPORT if the address family is not supported.
    1550  * @returns             ENOENT if no route was found.
    1551  * @returns             ENOENT if the packet is for another host and the routing
     1546 * @return              EOK on success.
     1547 * @return              EINVAL if the TTL is less than two.
     1548 * @return              EINVAL if the checksum is invalid.
     1549 * @return              EAFNOSUPPORT if the address family is not supported.
     1550 * @return              ENOENT if no route was found.
     1551 * @return              ENOENT if the packet is for another host and the routing
    15521552 *                      is disabled.
    15531553 */
     
    15551555ip_process_packet(device_id_t device_id, packet_t packet)
    15561556{
    1557         ip_header_ref header;
     1557        ip_header_t *header;
    15581558        in_addr_t dest;
    1559         ip_route_ref route;
     1559        ip_route_t *route;
    15601560        int phone;
    15611561        struct sockaddr *addr;
     
    15641564        int rc;
    15651565
    1566         header = (ip_header_ref) packet_get_data(packet);
     1566        header = (ip_header_t *) packet_get_data(packet);
    15671567        if (!header)
    15681568                return ip_release_and_return(packet, ENOMEM);
     
    16471647    in_addr_t netmask, in_addr_t gateway)
    16481648{
    1649         ip_route_ref route;
    1650         ip_netif_ref netif;
     1649        ip_route_t *route;
     1650        ip_netif_t *netif;
    16511651        int index;
    16521652
     
    16591659        }
    16601660
    1661         route = (ip_route_ref) malloc(sizeof(ip_route_t));
     1661        route = (ip_route_t *) malloc(sizeof(ip_route_t));
    16621662        if (!route) {
    16631663                fibril_rwlock_write_unlock(&ip_globals.netifs_lock);
     
    16811681ip_set_gateway_req_local(int ip_phone, device_id_t device_id, in_addr_t gateway)
    16821682{
    1683         ip_netif_ref netif;
     1683        ip_netif_t *netif;
    16841684
    16851685        fibril_rwlock_write_lock(&ip_globals.netifs_lock);
     
    17211721        icmp_type_t type;
    17221722        icmp_code_t code;
    1723         ip_netif_ref netif;
     1723        ip_netif_t *netif;
    17241724        measured_string_t address;
    1725         ip_route_ref route;
    1726         ip_header_ref header;
     1725        ip_route_t *route;
     1726        ip_header_t *header;
    17271727
    17281728        switch (error) {
     
    17341734
    17351735                data = packet_get_data(packet);
    1736                 header = (ip_header_ref)(data + offset);
     1736                header = (ip_header_t *)(data + offset);
    17371737
    17381738                // destination host unreachable?
     
    17821782        in_addr_t *dest;
    17831783        in_addr_t *src;
    1784         ip_route_ref route;
    1785         ipv4_pseudo_header_ref header_in;
     1784        ip_route_t *route;
     1785        ipv4_pseudo_header_t *header_in;
    17861786
    17871787        if (!destination || (addrlen <= 0))
     
    18291829
    18301830        *headerlen = sizeof(*header_in);
    1831         header_in = (ipv4_pseudo_header_ref) malloc(*headerlen);
     1831        header_in = (ipv4_pseudo_header_t *) malloc(*headerlen);
    18321832        if (!header_in)
    18331833                return ENOMEM;
     
    18491849 * @param[in] device_id The source device identifier.
    18501850 * @param[in,out] packet The received packet.
    1851  * @returns             EOK on success and the packet is no longer needed.
    1852  * @returns             EINVAL if the packet is too small to carry the IP
     1851 * @return              EOK on success and the packet is no longer needed.
     1852 * @return              EINVAL if the packet is too small to carry the IP
    18531853 *                      packet.
    1854  * @returns             EINVAL if the received address lengths differs from the
     1854 * @return              EINVAL if the received address lengths differs from the
    18551855 *                      registered values.
    1856  * @returns             ENOENT if the device is not found in the cache.
    1857  * @returns             ENOENT if the protocol for the device is not found in
     1856 * @return              ENOENT if the device is not found in the cache.
     1857 * @return              ENOENT if the protocol for the device is not found in
    18581858 *                      the cache.
    1859  * @returns             ENOMEM if there is not enough memory left.
     1859 * @return              ENOMEM if there is not enough memory left.
    18601860 */
    18611861static int ip_receive_message(device_id_t device_id, packet_t packet)
     
    18791879 * @param[out] answer_count The last parameter for the actual answer in the
    18801880 *                      answer parameter.
    1881  * @returns             EOK on success.
    1882  * @returns             ENOTSUP if the message is not known.
     1881 * @return              EOK on success.
     1882 * @return              ENOTSUP if the message is not known.
    18831883 *
    18841884 * @see ip_interface.h
     
    20372037/** Starts the module.
    20382038 *
    2039  * @returns EOK on success.
    2040  * @returns Other error codes as defined for each specific module start function.
     2039 * @return EOK on success.
     2040 * @return Other error codes as defined for each specific module start function.
    20412041 */
    20422042int main(int argc, char *argv[])
  • uspace/srv/net/il/ip/ip.h

    rb4c9c61 rfdbc3ff  
    5959typedef struct ip_netif ip_netif_t;
    6060
    61 /** Type definition of the IP network interface specific data pointer.
    62  * @see ip_netif
    63  */
    64 typedef ip_netif_t *ip_netif_ref;
    65 
    6661/** Type definition of the IP protocol specific data.
    6762 * @see ip_proto
     
    6964typedef struct ip_proto ip_proto_t;
    7065
    71 /** Type definition of the IP protocol specific data pointer.
    72  * @see ip_proto
    73  */
    74 typedef ip_proto_t *ip_proto_ref;
    75 
    7666/** Type definition of the IP route specific data.
    7767 *  @see ip_route
    7868 */
    7969typedef struct ip_route ip_route_t;
    80 
    81 /** Type definition of the IP route specific data pointer.
    82  *  @see ip_route
    83  */
    84 typedef ip_route_t *ip_route_ref;
    8570
    8671/** IP network interfaces.
     
    10489struct ip_netif {
    10590        /** ARP module. Assigned if using ARP. */
    106         module_ref arp;
     91        module_t *arp;
    10792        /** Broadcast address. */
    10893        in_addr_t broadcast;
     
    146131        in_addr_t gateway;
    147132        /** Parent netif. */
    148         ip_netif_ref netif;
     133        ip_netif_t *netif;
    149134        /** Target network mask. */
    150135        in_addr_t netmask;
  • uspace/srv/net/net/net.c

    rb4c9c61 rfdbc3ff  
    7878DEVICE_MAP_IMPLEMENT(netifs, netif_t);
    7979
     80static int startup(void);
     81
    8082/** Add the configured setting to the configuration map.
    8183 *
     
    8486 * @param[in] value         The setting value.
    8587 *
    86  * @returns EOK on success.
    87  * @returns ENOMEM if there is not enough memory left.
    88  *
    89  */
    90 int add_configuration(measured_strings_ref configuration, const char *name,
     88 * @return EOK on success.
     89 * @return ENOMEM if there is not enough memory left.
     90 *
     91 */
     92int add_configuration(measured_strings_t *configuration, const char *name,
    9193    const char *value)
    9294{
    9395        int rc;
    9496       
    95         measured_string_ref setting =
     97        measured_string_t *setting =
    9698            measured_string_create_bulk(value, 0);
    9799        if (!setting)
     
    110112/** Generate new system-unique device identifier.
    111113 *
    112  * @returns             The system-unique devic identifier.
     114 * @return              The system-unique devic identifier.
    113115 */
    114116static device_id_t generate_new_device_id(void)
     
    117119}
    118120
    119 static int parse_line(measured_strings_ref configuration, char *line)
     121static int parse_line(measured_strings_t *configuration, char *line)
    120122{
    121123        int rc;
     
    163165       
    164166        /* Create a bulk measured string till the end */
    165         measured_string_ref setting =
     167        measured_string_t *setting =
    166168            measured_string_create_bulk(value, 0);
    167169        if (!setting)
     
    179181
    180182static int read_configuration_file(const char *directory, const char *filename,
    181     measured_strings_ref configuration)
     183    measured_strings_t *configuration)
    182184{
    183185        printf("%s: Reading configuration file %s/%s\n", NAME, directory, filename);
     
    235237 * @param[in,out] netif The network interface structure.
    236238 *
    237  * @returns EOK on success.
    238  * @returns Other error codes as defined for the add_configuration() function.
     239 * @return EOK on success.
     240 * @return Other error codes as defined for the add_configuration() function.
    239241 *
    240242 */
     
    246248/** Read the networking subsystem global configuration.
    247249 *
    248  * @returns EOK on success.
    249  * @returns Other error codes as defined for the add_configuration() function.
     250 * @return EOK on success.
     251 * @return Other error codes as defined for the add_configuration() function.
    250252 *
    251253 */
     
    262264 *                              its own one.
    263265 *
    264  * @returns EOK on success.
    265  * @returns ENOMEM if there is not enough memory left.
     266 * @return EOK on success.
     267 * @return ENOMEM if there is not enough memory left.
    266268 *
    267269 */
     
    313315 *                              its own one.
    314316 *
    315  * @returns EOK on successful module termination.
    316  * @returns Other error codes as defined for the net_initialize() function.
    317  * @returns Other error codes as defined for the REGISTER_ME() macro function.
     317 * @return EOK on successful module termination.
     318 * @return Other error codes as defined for the net_initialize() function.
     319 * @return Other error codes as defined for the REGISTER_ME() macro function.
    318320 *
    319321 */
     
    337339                goto out;
    338340       
     341        rc = startup();
     342        if (rc != EOK)
     343                goto out;
     344       
     345        task_retval(0);
    339346        async_manager();
    340347
     
    353360 * @param[out] data          The found configuration settings data.
    354361 *
    355  * @returns EOK.
    356  *
    357  */
    358 static int net_get_conf(measured_strings_ref netif_conf,
    359     measured_string_ref configuration, size_t count, char **data)
     362 * @return EOK.
     363 *
     364 */
     365static int net_get_conf(measured_strings_t *netif_conf,
     366    measured_string_t *configuration, size_t count, char **data)
    360367{
    361368        if (data)
     
    364371        size_t index;
    365372        for (index = 0; index < count; index++) {
    366                 measured_string_ref setting =
     373                measured_string_t *setting =
    367374                    measured_strings_find(netif_conf, configuration[index].value, 0);
    368375                if (!setting)
     
    382389}
    383390
    384 int net_get_conf_req(int net_phone, measured_string_ref *configuration,
     391int net_get_conf_req(int net_phone, measured_string_t **configuration,
    385392    size_t count, char **data)
    386393{
     
    392399
    393400int net_get_device_conf_req(int net_phone, device_id_t device_id,
    394     measured_string_ref *configuration, size_t count, char **data)
     401    measured_string_t **configuration, size_t count, char **data)
    395402{
    396403        if ((!configuration) || (count == 0))
     
    404411}
    405412
    406 void net_free_settings(measured_string_ref settings, char *data)
     413void net_free_settings(measured_string_t *settings, char *data)
    407414{
    408415}
     
    415422 * @param[in] netif The network interface specific data.
    416423 *
    417  * @returns EOK on success.
    418  * @returns EINVAL if there are some settings missing.
    419  * @returns ENOENT if the internet protocol module is not known.
    420  * @returns Other error codes as defined for the netif_probe_req() function.
    421  * @returns Other error codes as defined for the nil_device_req() function.
    422  * @returns Other error codes as defined for the needed internet layer
    423  *          registering function.
     424 * @return EOK on success.
     425 * @return EINVAL if there are some settings missing.
     426 * @return ENOENT if the internet protocol module is not known.
     427 * @return Other error codes as defined for the netif_probe_req() function.
     428 * @return Other error codes as defined for the nil_device_req() function.
     429 * @return Other error codes as defined for the needed internet layer
     430 *         registering function.
    424431 *
    425432 */
     
    429436       
    430437        /* Mandatory netif */
    431         measured_string_ref setting =
     438        measured_string_t *setting =
    432439            measured_strings_find(&netif->configuration, CONF_NETIF, 0);
    433440       
     
    507514/** Read the configuration and start all network interfaces.
    508515 *
    509  * @returns EOK on success.
    510  * @returns EXDEV if there is no available system-unique device identifier.
    511  * @returns EINVAL if any of the network interface names are not configured.
    512  * @returns ENOMEM if there is not enough memory left.
    513  * @returns Other error codes as defined for the read_configuration()
    514  *          function.
    515  * @returns Other error codes as defined for the read_netif_configuration()
    516  *          function.
    517  * @returns Other error codes as defined for the start_device() function.
     516 * @return EOK on success.
     517 * @return EXDEV if there is no available system-unique device identifier.
     518 * @return EINVAL if any of the network interface names are not configured.
     519 * @return ENOMEM if there is not enough memory left.
     520 * @return Other error codes as defined for the read_configuration()
     521 *         function.
     522 * @return Other error codes as defined for the read_netif_configuration()
     523 *         function.
     524 * @return Other error codes as defined for the start_device() function.
    518525 *
    519526 */
     
    550557               
    551558                /* Mandatory name */
    552                 measured_string_ref setting =
     559                measured_string_t *setting =
    553560                    measured_strings_find(&netif->configuration, CONF_NAME, 0);
    554561                if (!setting) {
     
    610617 *                          in the answer parameter.
    611618 *
    612  * @returns EOK on success.
    613  * @returns ENOTSUP if the message is not known.
     619 * @return EOK on success.
     620 * @return ENOTSUP if the message is not known.
    614621 *
    615622 * @see net_interface.h
     
    620627    int *answer_count)
    621628{
    622         measured_string_ref strings;
     629        measured_string_t *strings;
    623630        char *data;
    624631        int rc;
  • uspace/srv/net/net/net.h

    rb4c9c61 rfdbc3ff  
    103103       
    104104        /** Serving network interface driver module index. */
    105         module_ref driver;
     105        module_t *driver;
    106106       
    107         device_id_t id;  /**< System-unique network interface identifier. */
    108         module_ref il;   /**< Serving internet layer module index. */
    109         char *name;      /**< System-unique network interface name. */
    110         module_ref nil;  /**< Serving link layer module index. */
     107        device_id_t id; /**< System-unique network interface identifier. */
     108        module_t *il;   /**< Serving internet layer module index. */
     109        char *name;     /**< System-unique network interface name. */
     110        module_t *nil;  /**< Serving link layer module index. */
    111111} netif_t;
    112112
     
    133133} net_globals_t;
    134134
    135 extern int add_configuration(measured_strings_ref, const char *, const char *);
     135extern int add_configuration(measured_strings_t *, const char *, const char *);
    136136extern int net_module_message(ipc_callid_t, ipc_call_t *, ipc_call_t *, int *);
    137137extern int net_initialize_build(async_client_conn_t);
  • uspace/srv/net/netif/lo/lo.c

    rb4c9c61 rfdbc3ff  
    7070}
    7171
    72 int netif_get_addr_message(device_id_t device_id, measured_string_ref address)
     72int netif_get_addr_message(device_id_t device_id, measured_string_t *address)
    7373{
    7474        if (!address)
     
    8181}
    8282
    83 int netif_get_device_stats(device_id_t device_id, device_stats_ref stats)
     83int netif_get_device_stats(device_id_t device_id, device_stats_t *stats)
    8484{
    8585        netif_device_t *device;
     
    9393                return rc;
    9494
    95         memcpy(stats, (device_stats_ref) device->specific,
     95        memcpy(stats, (device_stats_t *) device->specific,
    9696            sizeof(device_stats_t));
    9797
     
    103103 * @param[in] device    The device structure.
    104104 * @param[in] state     The new device state.
    105  * @returns             The new state if changed.
    106  * @returns             EOK otherwise.
     105 * @return              The new state if changed.
     106 * @return              EOK otherwise.
    107107 */
    108108static int change_state_message(netif_device_t *device, device_state_t state)
     
    124124 * @param[in] device_id The new devce identifier.
    125125 * @param[out] device   The device structure.
    126  * @returns             EOK on success.
    127  * @returns             EXDEV if one loopback network interface already exists.
    128  * @returns             ENOMEM if there is not enough memory left.
     126 * @return              EOK on success.
     127 * @return              EXDEV if one loopback network interface already exists.
     128 * @return              ENOMEM if there is not enough memory left.
    129129 */
    130130static int create(device_id_t device_id, netif_device_t **device)
     
    145145        }
    146146
    147         null_device_stats((device_stats_ref) (*device)->specific);
     147        null_device_stats((device_stats_t *) (*device)->specific);
    148148        (*device)->device_id = device_id;
    149149        (*device)->nil_phone = -1;
     
    204204        next = packet;
    205205        do {
    206                 ((device_stats_ref) device->specific)->send_packets++;
    207                 ((device_stats_ref) device->specific)->receive_packets++;
     206                ((device_stats_t *) device->specific)->send_packets++;
     207                ((device_stats_t *) device->specific)->receive_packets++;
    208208                length = packet_get_data_length(next);
    209                 ((device_stats_ref) device->specific)->send_bytes += length;
    210                 ((device_stats_ref) device->specific)->receive_bytes += length;
     209                ((device_stats_t *) device->specific)->send_bytes += length;
     210                ((device_stats_t *) device->specific)->receive_bytes += length;
    211211                next = pq_next(next);
    212212        } while(next);
  • uspace/srv/net/nil/eth/eth.c

    rb4c9c61 rfdbc3ff  
    156156typedef enum eth_addr_type eth_addr_type_t;
    157157
    158 /** Type definition of the ethernet address type pointer.
    159  * @see eth_addr_type
    160  */
    161 typedef eth_addr_type_t *eth_addr_type_ref;
    162 
    163158/** Ethernet address type. */
    164159enum eth_addr_type {
     
    178173{
    179174        int index;
    180         eth_proto_ref proto;
     175        eth_proto_t *proto;
    181176
    182177        fibril_rwlock_read_lock(&eth_globals.protos_lock);
     
    273268 * @param[in] service   The device driver service.
    274269 * @param[in] mtu       The device maximum transmission unit.
    275  * @returns             EOK on success.
    276  * @returns             EEXIST if the device with the different service exists.
    277  * @returns             ENOMEM if there is not enough memory left.
    278  * @returns             Other error codes as defined for the
     270 * @return              EOK on success.
     271 * @return              EEXIST if the device with the different service exists.
     272 * @return              ENOMEM if there is not enough memory left.
     273 * @return              Other error codes as defined for the
    279274 *                      net_get_device_conf_req() function.
    280  * @returns             Other error codes as defined for the
     275 * @return              Other error codes as defined for the
    281276 *                      netif_bind_service() function.
    282  * @returns             Other error codes as defined for the
     277 * @return              Other error codes as defined for the
    283278 *                      netif_get_addr_req() function.
    284279 */
     
    286281    size_t mtu)
    287282{
    288         eth_device_ref device;
     283        eth_device_t *device;
    289284        int index;
    290285        measured_string_t names[2] = {
     
    298293                }
    299294        };
    300         measured_string_ref configuration;
     295        measured_string_t *configuration;
    301296        size_t count = sizeof(names) / sizeof(measured_string_t);
    302297        char *data;
    303         eth_proto_ref proto;
     298        eth_proto_t *proto;
    304299        int rc;
    305300
     
    342337       
    343338        /* Create a new device */
    344         device = (eth_device_ref) malloc(sizeof(eth_device_t));
     339        device = (eth_device_t *) malloc(sizeof(eth_device_t));
    345340        if (!device)
    346341                return ENOMEM;
     
    427422 * @param[in] flags     The device flags.
    428423 * @param[in] packet    The packet.
    429  * @returns             The target registered module.
    430  * @returns             NULL if the packet is not long enough.
    431  * @returns             NULL if the packet is too long.
    432  * @returns             NULL if the raw ethernet protocol is used.
    433  * @returns             NULL if the dummy device FCS checksum is invalid.
    434  * @returns             NULL if the packet address length is not big enough.
    435  */
    436 static eth_proto_ref eth_process_packet(int flags, packet_t packet)
    437 {
    438         eth_header_snap_ref header;
     424 * @return              The target registered module.
     425 * @return              NULL if the packet is not long enough.
     426 * @return              NULL if the packet is too long.
     427 * @return              NULL if the raw ethernet protocol is used.
     428 * @return              NULL if the dummy device FCS checksum is invalid.
     429 * @return              NULL if the packet address length is not big enough.
     430 */
     431static eth_proto_t *eth_process_packet(int flags, packet_t packet)
     432{
     433        eth_header_snap_t *header;
    439434        size_t length;
    440435        eth_type_t type;
    441436        size_t prefix;
    442437        size_t suffix;
    443         eth_fcs_ref fcs;
     438        eth_fcs_t *fcs;
    444439        uint8_t *data;
    445440        int rc;
     
    454449       
    455450        data = packet_get_data(packet);
    456         header = (eth_header_snap_ref) data;
     451        header = (eth_header_snap_t *) data;
    457452        type = ntohs(header->header.ethertype);
    458453       
     
    461456                prefix = sizeof(eth_header_t);
    462457                suffix = 0;
    463                 fcs = (eth_fcs_ref) data + length - sizeof(eth_fcs_t);
     458                fcs = (eth_fcs_t *) data + length - sizeof(eth_fcs_t);
    464459                length -= sizeof(eth_fcs_t);
    465460        } else if(type <= ETH_MAX_CONTENT) {
     
    487482
    488483                suffix = (type < ETH_MIN_CONTENT) ? ETH_MIN_CONTENT - type : 0U;
    489                 fcs = (eth_fcs_ref) data + prefix + type + suffix;
     484                fcs = (eth_fcs_t *) data + prefix + type + suffix;
    490485                suffix += length - prefix - type;
    491486                length = prefix + type + suffix;
     
    516511    packet_t packet, services_t target)
    517512{
    518         eth_proto_ref proto;
     513        eth_proto_t *proto;
    519514        packet_t next;
    520         eth_device_ref device;
     515        eth_device_t *device;
    521516        int flags;
    522517
     
    557552 * @param[out] content  The maximum content size.
    558553 * @param[out] suffix   The minimum reserved suffix size.
    559  * @returns             EOK on success.
    560  * @returns             EBADMEM if either one of the parameters is NULL.
    561  * @returns             ENOENT if there is no such device.
     554 * @return              EOK on success.
     555 * @return              EBADMEM if either one of the parameters is NULL.
     556 * @return              ENOENT if there is no such device.
    562557 */
    563558static int eth_packet_space_message(device_id_t device_id, size_t *addr_len,
    564559    size_t *prefix, size_t *content, size_t *suffix)
    565560{
    566         eth_device_ref device;
     561        eth_device_t *device;
    567562
    568563        if (!addr_len || !prefix || !content || !suffix)
     
    591586 * @param[in] type      Type of the desired address.
    592587 * @param[out] address  The device hardware address.
    593  * @returns             EOK on success.
    594  * @returns             EBADMEM if the address parameter is NULL.
    595  * @returns             ENOENT if there no such device.
     588 * @return              EOK on success.
     589 * @return              EBADMEM if the address parameter is NULL.
     590 * @return              ENOENT if there no such device.
    596591 */
    597592static int eth_addr_message(device_id_t device_id, eth_addr_type_t type,
    598     measured_string_ref *address)
    599 {
    600         eth_device_ref device;
     593    measured_string_t **address)
     594{
     595        eth_device_t *device;
    601596
    602597        if (!address)
     
    625620 * @param[in] service   The module service.
    626621 * @param[in] phone     The service phone.
    627  * @returns             EOK on success.
    628  * @returns             ENOENT if the service is not known.
    629  * @returns             ENOMEM if there is not enough memory left.
     622 * @return              EOK on success.
     623 * @return              ENOENT if the service is not known.
     624 * @return              ENOMEM if there is not enough memory left.
    630625 */
    631626static int eth_register_message(services_t service, int phone)
    632627{
    633         eth_proto_ref proto;
     628        eth_proto_t *proto;
    634629        int protocol;
    635630        int index;
     
    646641                return EOK;
    647642        } else {
    648                 proto = (eth_proto_ref) malloc(sizeof(eth_proto_t));
     643                proto = (eth_proto_t *) malloc(sizeof(eth_proto_t));
    649644                if (!proto) {
    650645                        fibril_rwlock_write_unlock(&eth_globals.protos_lock);
     
    678673 * @param[in] ethertype The ethernet protocol type.
    679674 * @param[in] mtu       The device maximum transmission unit.
    680  * @returns             EOK on success.
    681  * @returns             EINVAL if the packet addresses length is not long
     675 * @return              EOK on success.
     676 * @return              EINVAL if the packet addresses length is not long
    682677 *                      enough.
    683  * @returns             EINVAL if the packet is bigger than the device MTU.
    684  * @returns             ENOMEM if there is not enough memory in the packet.
     678 * @return              EINVAL if the packet is bigger than the device MTU.
     679 * @return              ENOMEM if there is not enough memory in the packet.
    685680 */
    686681static int
     
    688683    size_t mtu)
    689684{
    690         eth_header_snap_ref header;
    691         eth_header_lsap_ref header_lsap;
    692         eth_header_ref header_dix;
    693         eth_fcs_ref fcs;
     685        eth_header_snap_t *header;
     686        eth_header_lsap_t *header_lsap;
     687        eth_header_t *header_dix;
     688        eth_fcs_t *fcs;
    694689        uint8_t *src;
    695690        uint8_t *dest;
     
    697692        int i;
    698693        void *padding;
    699         eth_preamble_ref preamble;
     694        eth_preamble_t *preamble;
    700695
    701696        i = packet_get_addr(packet, &src, &dest);
     
    788783 * @param[in] packet    The packet queue.
    789784 * @param[in] sender    The sending module service.
    790  * @returns             EOK on success.
    791  * @returns             ENOENT if there no such device.
    792  * @returns             EINVAL if the service parameter is not known.
     785 * @return              EOK on success.
     786 * @return              ENOENT if there no such device.
     787 * @return              EINVAL if the service parameter is not known.
    793788 */
    794789static int eth_send_message(device_id_t device_id, packet_t packet,
    795790    services_t sender)
    796791{
    797         eth_device_ref device;
     792        eth_device_t *device;
    798793        packet_t next;
    799794        packet_t tmp;
     
    845840    ipc_call_t *call, ipc_call_t *answer, int *answer_count)
    846841{
    847         measured_string_ref address;
     842        measured_string_t *address;
    848843        packet_t packet;
    849844        size_t addrlen;
  • uspace/srv/net/nil/eth/eth.h

    rb4c9c61 rfdbc3ff  
    5454typedef struct eth_device eth_device_t;
    5555
    56 /** Type definition of the Ethernet device specific data pointer.
    57  * @see eth_device
    58  */
    59 typedef eth_device_t *eth_device_ref;
    60 
    6156/** Type definition of the Ethernet protocol specific data.
    6257 * @see eth_proto
    6358 */
    6459typedef struct eth_proto eth_proto_t;
    65 
    66 /** Type definition of the Ethernet protocol specific data pointer.
    67  * @see eth_proto
    68  */
    69 typedef eth_proto_t *eth_proto_ref;
    7060
    7161/** Ethernet device map.
     
    10090       
    10191        /** Actual device hardware address. */
    102         measured_string_ref addr;
     92        measured_string_t *addr;
    10393        /** Actual device hardware address data. */
    10494        char *addr_data;
     
    133123       
    134124        /** Broadcast device hardware address. */
    135         measured_string_ref broadcast_addr;
     125        measured_string_t *broadcast_addr;
    136126};
    137127
  • uspace/srv/net/nil/eth/eth_header.h

    rb4c9c61 rfdbc3ff  
    5858typedef struct eth_header_snap eth_header_snap_t;
    5959
    60 /** Type definition of the Ethernet header IEEE 802.3 + 802.2 + SNAP extensions
    61  * pointer.
    62  *
    63  * @see eth_header_snap
    64  */
    65 typedef eth_header_snap_t *eth_header_snap_ref;
    66 
    6760/** Type definition of the Ethernet header IEEE 802.3 + 802.2 + SNAP extensions.
    6861 * @see eth_header_lsap
    6962 */
    7063typedef struct eth_header_lsap eth_header_lsap_t;
    71 
    72 /** Type definition of the Ethernet header IEEE 802.3 + 802.2 extension pointer.
    73  * @see eth_header_lsap
    74  */
    75 typedef eth_header_lsap_t *eth_header_lsap_ref;
    7664
    7765/** Type definition of the Ethernet header LSAP extension.
     
    8068typedef struct eth_ieee_lsap eth_ieee_lsap_t;
    8169
    82 /** Type definition of the Ethernet header LSAP extension pointer.
    83  * @see eth_ieee_lsap
    84  */
    85 typedef eth_ieee_lsap_t *eth_ieee_lsap_ref;
    86 
    8770/** Type definition of the Ethernet header SNAP extension.
    8871 * @see eth_snap
    8972 */
    9073typedef struct eth_snap eth_snap_t;
    91 
    92 /** Type definition of the Ethernet header SNAP extension pointer.
    93  * @see eth_snap
    94  */
    95 typedef eth_snap_t *eth_snap_ref;
    9674
    9775/** Type definition of the Ethernet header preamble.
     
    10078typedef struct eth_preamble eth_preamble_t;
    10179
    102 /** Type definition of the Ethernet header preamble pointer.
    103  * @see eth_preamble
    104  */
    105 typedef eth_preamble_t *eth_preamble_ref;
    106 
    10780/** Type definition of the Ethernet header.
    10881 * @see eth_header
    10982 */
    11083typedef struct eth_header eth_header_t;
    111 
    112 /** Type definition of the Ethernet header pointer.
    113  * @see eth_header
    114  */
    115 typedef eth_header_t *eth_header_ref;
    11684
    11785/** Ethernet header Link Service Access Point extension. */
     
    219187typedef uint32_t eth_fcs_t;
    220188
    221 /** Ethernet Frame Check Sequence pointer. */
    222 typedef eth_fcs_t *eth_fcs_ref;
    223 
    224189#endif
    225190
  • uspace/srv/net/nil/nildummy/nildummy.c

    rb4c9c61 rfdbc3ff  
    142142 * @param[in] service   The device driver service.
    143143 * @param[in] mtu       The device maximum transmission unit.
    144  * @returns             EOK on success.
    145  * @returns             EEXIST if the device with the different service exists.
    146  * @returns             ENOMEM if there is not enough memory left.
    147  * @returns             Other error codes as defined for the
     144 * @return              EOK on success.
     145 * @return              EEXIST if the device with the different service exists.
     146 * @return              ENOMEM if there is not enough memory left.
     147 * @return              Other error codes as defined for the
    148148 *                      netif_bind_service() function.
    149  * @returns             Other error codes as defined for the
     149 * @return              Other error codes as defined for the
    150150 *                      netif_get_addr_req() function.
    151151 */
     
    153153    size_t mtu)
    154154{
    155         nildummy_device_ref device;
     155        nildummy_device_t *device;
    156156        int index;
    157157        int rc;
     
    192192       
    193193        /* Create a new device */
    194         device = (nildummy_device_ref) malloc(sizeof(nildummy_device_t));
     194        device = (nildummy_device_t *) malloc(sizeof(nildummy_device_t));
    195195        if (!device)
    196196                return ENOMEM;
     
    248248 */
    249249static int nildummy_addr_message(device_id_t device_id,
    250     measured_string_ref *address)
    251 {
    252         nildummy_device_ref device;
     250    measured_string_t **address)
     251{
     252        nildummy_device_t *device;
    253253
    254254        if (!address)
     
    282282    size_t *prefix, size_t *content, size_t *suffix)
    283283{
    284         nildummy_device_ref device;
     284        nildummy_device_t *device;
    285285
    286286        if (!addr_len || !prefix || !content || !suffix)
     
    357357    services_t sender)
    358358{
    359         nildummy_device_ref device;
     359        nildummy_device_t *device;
    360360
    361361        fibril_rwlock_read_lock(&nildummy_globals.devices_lock);
     
    377377    ipc_call_t *call, ipc_call_t *answer, int *answer_count)
    378378{
    379         measured_string_ref address;
     379        measured_string_t *address;
    380380        packet_t packet;
    381381        size_t addrlen;
  • uspace/srv/net/nil/nildummy/nildummy.h

    rb4c9c61 rfdbc3ff  
    5454typedef struct nildummy_device nildummy_device_t;
    5555
    56 /** Type definition of the dummy nil device specific data pointer.
    57  * @see nildummy_device
    58  */
    59 typedef nildummy_device_t *nildummy_device_ref;
    60 
    6156/** Type definition of the dummy nil protocol specific data.
    6257 * @see nildummy_proto
    6358 */
    6459typedef struct nildummy_proto nildummy_proto_t;
    65 
    66 /** Type definition of the dummy nil protocol specific data pointer.
    67  * @see nildummy_proto
    68  */
    69 typedef nildummy_proto_t *nildummy_proto_ref;
    7060
    7161/** Dummy nil device map.
     
    8676        size_t mtu;
    8777        /** Actual device hardware address. */
    88         measured_string_ref addr;
     78        measured_string_t *addr;
    8979        /** Actual device hardware address data. */
    9080        char *addr_data;
  • uspace/srv/net/tl/icmp/icmp.c

    rb4c9c61 rfdbc3ff  
    100100 * @param[in,out] header The ICMP datagram header.
    101101 * @param[in] length    The total datagram length.
    102  * @returns             The computed checksum.
     102 * @return              The computed checksum.
    103103 */
    104104#define ICMP_CHECKSUM(header, length) \
     
    112112 * @param[in] id        The message identifier.
    113113 * @param[in] sequence  The message sequence number.
    114  * @returns             The computed ICMP reply data key.
     114 * @return              The computed ICMP reply data key.
    115115 */
    116116#define ICMP_GET_REPLY_KEY(id, sequence) \
     
    128128 * @param[in] packet    The packet queue to be released.
    129129 * @param[in] result    The result to be returned.
    130  * @returns             The result parameter.
     130 * @return              The result parameter.
    131131 */
    132132static int icmp_release_and_return(packet_t packet, int result)
     
    152152 * @param[in] dont_fragment The value indicating whether the datagram must not
    153153 *                      be fragmented. Is used as a MTU discovery.
    154  * @returns             EOK on success.
    155  * @returns             EPERM if the error message is not allowed.
     154 * @return              EOK on success.
     155 * @return              EPERM if the error message is not allowed.
    156156 */
    157157static int icmp_send_packet(icmp_type_t type, icmp_code_t code, packet_t packet,
    158     icmp_header_ref header, services_t error, ip_ttl_t ttl, ip_tos_t tos,
     158    icmp_header_t *header, services_t error, ip_ttl_t ttl, ip_tos_t tos,
    159159    int dont_fragment)
    160160{
     
    186186 *
    187187 * @param[in,out] packet The original packet.
    188  * @returns The prefixed ICMP header.
    189  * @returns NULL on errors.
    190  */
    191 static icmp_header_ref icmp_prepare_packet(packet_t packet)
    192 {
    193         icmp_header_ref header;
     188 * @return The prefixed ICMP header.
     189 * @return NULL on errors.
     190 */
     191static icmp_header_t *icmp_prepare_packet(packet_t packet)
     192{
     193        icmp_header_t *header;
    194194        size_t header_length;
    195195        size_t total_length;
     
    234234 * @param[in] addr      The target host address.
    235235 * @param[in] addrlen   The torget host address length.
    236  * @returns             ICMP_ECHO on success.
    237  * @returns             ETIMEOUT if the reply has not arrived before the
     236 * @return              ICMP_ECHO on success.
     237 * @return              ETIMEOUT if the reply has not arrived before the
    238238 *                      timeout.
    239  * @returns             ICMP type of the received error notification.
    240  * @returns             EINVAL if the addrlen parameter is less or equal to
     239 * @return              ICMP type of the received error notification.
     240 * @return              EINVAL if the addrlen parameter is less or equal to
    241241 *                      zero.
    242  * @returns             ENOMEM if there is not enough memory left.
    243  * @returns             EPARTY if there was an internal error.
     242 * @return              ENOMEM if there is not enough memory left.
     243 * @return              EPARTY if there was an internal error.
    244244 */
    245245static int icmp_echo(icmp_param_t id, icmp_param_t sequence, size_t size,
     
    247247    const struct sockaddr * addr, socklen_t addrlen)
    248248{
    249         icmp_header_ref header;
     249        icmp_header_t *header;
    250250        packet_t packet;
    251251        size_t length;
    252252        uint8_t *data;
    253         icmp_reply_ref reply;
     253        icmp_reply_t *reply;
    254254        int reply_key;
    255255        int index;
     
    342342    icmp_code_t code, icmp_param_t mtu, packet_t packet)
    343343{
    344         icmp_header_ref header;
     344        icmp_header_t *header;
    345345
    346346        header = icmp_prepare_packet(packet);
     
    357357static int icmp_source_quench_msg_local(int icmp_phone, packet_t packet)
    358358{
    359         icmp_header_ref header;
     359        icmp_header_t *header;
    360360
    361361        header = icmp_prepare_packet(packet);
     
    370370    packet_t packet)
    371371{
    372         icmp_header_ref header;
     372        icmp_header_t *header;
    373373
    374374        header = icmp_prepare_packet(packet);
     
    383383    icmp_param_t pointer, packet_t packet)
    384384{
    385         icmp_header_ref header;
     385        icmp_header_t *header;
    386386
    387387        header = icmp_prepare_packet(packet);
     
    398398 * @param[in] client_connection The client connection processing function. The
    399399 *                      module skeleton propagates its own one.
    400  * @returns             EOK on success.
    401  * @returns             ENOMEM if there is not enough memory left.
     400 * @return              EOK on success.
     401 * @return              ENOMEM if there is not enough memory left.
    402402 */
    403403int icmp_initialize(async_client_conn_t client_connection)
     
    413413                }
    414414        };
    415         measured_string_ref configuration;
     415        measured_string_t *configuration;
    416416        size_t count = sizeof(names) / sizeof(measured_string_t);
    417417        char *data;
     
    479479 * @param[in] code      The received reply message code.
    480480 */
    481 static void  icmp_process_echo_reply(packet_t packet, icmp_header_ref header,
     481static void  icmp_process_echo_reply(packet_t packet, icmp_header_t *header,
    482482    icmp_type_t type, icmp_code_t code)
    483483{
    484484        int reply_key;
    485         icmp_reply_ref reply;
     485        icmp_reply_t *reply;
    486486
    487487        /* Compute the reply key */
     
    507507 * @param[in] error     The packet error reporting service. Prefixes the
    508508 *                      received packet.
    509  * @returns             EOK on success.
    510  * @returns             EINVAL if the packet is not valid.
    511  * @returns             EINVAL if the stored packet address is not the an_addr_t.
    512  * @returns             EINVAL if the packet does not contain any data.
    513  * @returns             NO_DATA if the packet content is shorter than the user
     509 * @return              EOK on success.
     510 * @return              EINVAL if the packet is not valid.
     511 * @return              EINVAL if the stored packet address is not the an_addr_t.
     512 * @return              EINVAL if the packet does not contain any data.
     513 * @return              NO_DATA if the packet content is shorter than the user
    514514 *                      datagram header.
    515  * @returns             ENOMEM if there is not enough memory left.
    516  * @returns             EADDRNOTAVAIL if the destination socket does not exist.
    517  * @returns             Other error codes as defined for the
     515 * @return              ENOMEM if there is not enough memory left.
     516 * @return              EADDRNOTAVAIL if the destination socket does not exist.
     517 * @return              Other error codes as defined for the
    518518 *                      ip_client_process_packet() function.
    519519 */
     
    525525        int result;
    526526        void *data;
    527         icmp_header_ref header;
     527        icmp_header_t *header;
    528528        icmp_type_t type;
    529529        icmp_code_t code;
     
    567567
    568568        /* Get ICMP header */
    569         header = (icmp_header_ref) data;
     569        header = (icmp_header_t *) data;
    570570
    571571        if (header->checksum) {
     
    654654 * @param[in] error     The packet error reporting service. Prefixes the
    655655 *                      received packet.
    656  * @returns             EOK on success.
    657  * @returns             Other error codes as defined for the
     656 * @return              EOK on success.
     657 * @return              Other error codes as defined for the
    658658 *                      icmp_process_packet() function.
    659659 */
     
    673673 *
    674674 * @param[in] call      The message parameters.
    675  * @returns             EOK on success.
    676  * @returns             ENOTSUP if the message is not known.
    677  * @returns             Other error codes as defined for the packet_translate()
     675 * @return              EOK on success.
     676 * @return              ENOTSUP if the message is not known.
     677 * @return              Other error codes as defined for the packet_translate()
    678678 *                      function.
    679  * @returns             Other error codes as defined for the
     679 * @return              Other error codes as defined for the
    680680 *                      icmp_destination_unreachable_msg_local() function.
    681  * @returns             Other error codes as defined for the
     681 * @return              Other error codes as defined for the
    682682 *                      icmp_source_quench_msg_local() function.
    683  * @returns             Other error codes as defined for the
     683 * @return              Other error codes as defined for the
    684684 *                      icmp_time_exceeded_msg_local() function.
    685  * @returns             Other error codes as defined for the
     685 * @return              Other error codes as defined for the
    686686 *                      icmp_parameter_problem_msg_local() function.
    687687 *
     
    731731 *
    732732 * @param[in,out] echo_data The echo data to be bound.
    733  * @returns             Index of the inserted echo data.
    734  * @returns             EBADMEM if the echo_data parameter is NULL.
    735  * @returns             ENOTCONN if no free identifier have been found.
    736  */
    737 static int icmp_bind_free_id(icmp_echo_ref echo_data)
     733 * @return              Index of the inserted echo data.
     734 * @return              EBADMEM if the echo_data parameter is NULL.
     735 * @return              ENOTCONN if no free identifier have been found.
     736 */
     737static int icmp_bind_free_id(icmp_echo_t *echo_data)
    738738{
    739739        icmp_param_t index;
     
    778778 * @param[in] callid    The message identifier.
    779779 * @param[in] call      The message parameters.
    780  * @returns EOK.
     780 * @return EOK.
    781781 *
    782782 * @see icmp_interface.h
     
    791791        struct sockaddr *addr;
    792792        ipc_callid_t data_callid;
    793         icmp_echo_ref echo_data;
     793        icmp_echo_t *echo_data;
    794794        int rc = EOK;
    795795
     
    800800        answer_count = 0;
    801801
    802         echo_data = (icmp_echo_ref) malloc(sizeof(*echo_data));
     802        echo_data = (icmp_echo_t *) malloc(sizeof(*echo_data));
    803803        if (!echo_data)
    804804                return ENOMEM;
     
    887887 * @param[out] answer_count The last parameter for the actual answer in the
    888888 *                      answer parameter.
    889  * @returns             EOK on success.
    890  * @returns             ENOTSUP if the message is not known.
     889 * @return              EOK on success.
     890 * @return              ENOTSUP if the message is not known.
    891891 *
    892892 * @see icmp_interface.h
     
    964964/** Starts the module.
    965965 *
    966  * @returns             EOK on success.
    967  * @returns             Other error codes as defined for each specific module
     966 * @return              EOK on success.
     967 * @return              Other error codes as defined for each specific module
    968968 *                      start function.
    969969 */
  • uspace/srv/net/tl/icmp/icmp.h

    rb4c9c61 rfdbc3ff  
    4949 */
    5050typedef struct icmp_reply icmp_reply_t;
    51 
    52 /** Type definition of the ICMP reply data pointer.
    53  * @see icmp_reply
    54  */
    55 typedef icmp_reply_t *icmp_reply_ref;
    5651
    5752/** Type definition of the ICMP global data.
  • uspace/srv/net/tl/tcp/tcp.c

    rb4c9c61 rfdbc3ff  
    127127typedef struct tcp_timeout tcp_timeout_t;
    128128
    129 /** Type definition of the TCP timeout pointer.
    130  *  @see tcp_timeout
    131  */
    132 typedef tcp_timeout_t *tcp_timeout_ref;
    133 
    134129/** TCP reply timeout data.
    135130 *  Used as a timeouting fibril argument.
     
    144139
    145140        /** Local sockets. */
    146         socket_cores_ref local_sockets;
     141        socket_cores_t *local_sockets;
    147142
    148143        /** Socket identifier. */
     
    166161
    167162static int tcp_release_and_return(packet_t, int);
    168 static void tcp_prepare_operation_header(socket_core_ref, tcp_socket_data_ref,
    169     tcp_header_ref, int synchronize, int);
    170 static int tcp_prepare_timeout(int (*)(void *), socket_core_ref,
    171     tcp_socket_data_ref, size_t, tcp_socket_state_t, suseconds_t, int);
    172 static void tcp_free_socket_data(socket_core_ref);
     163static void tcp_prepare_operation_header(socket_core_t *, tcp_socket_data_t *,
     164    tcp_header_t *, int synchronize, int);
     165static int tcp_prepare_timeout(int (*)(void *), socket_core_t *,
     166    tcp_socket_data_t *, size_t, tcp_socket_state_t, suseconds_t, int);
     167static void tcp_free_socket_data(socket_core_t *);
    173168
    174169static int tcp_timeout(void *);
     
    177172
    178173static int tcp_process_packet(device_id_t, packet_t, services_t);
    179 static int tcp_connect_core(socket_core_ref, socket_cores_ref,
     174static int tcp_connect_core(socket_core_t *, socket_cores_t *,
    180175    struct sockaddr *, socklen_t);
    181 static int tcp_queue_prepare_packet(socket_core_ref, tcp_socket_data_ref,
     176static int tcp_queue_prepare_packet(socket_core_t *, tcp_socket_data_t *,
    182177    packet_t, size_t);
    183 static int tcp_queue_packet(socket_core_ref, tcp_socket_data_ref, packet_t,
     178static int tcp_queue_packet(socket_core_t *, tcp_socket_data_t *, packet_t,
    184179    size_t);
    185 static packet_t tcp_get_packets_to_send(socket_core_ref, tcp_socket_data_ref);
     180static packet_t tcp_get_packets_to_send(socket_core_t *, tcp_socket_data_t *);
    186181static void tcp_send_packets(device_id_t, packet_t);
    187182
    188 static void tcp_process_acknowledgement(socket_core_ref, tcp_socket_data_ref,
    189     tcp_header_ref);
    190 static packet_t tcp_send_prepare_packet(socket_core_ref, tcp_socket_data_ref,
     183static void tcp_process_acknowledgement(socket_core_t *, tcp_socket_data_t *,
     184    tcp_header_t *);
     185static packet_t tcp_send_prepare_packet(socket_core_t *, tcp_socket_data_t *,
    191186    packet_t, size_t, size_t);
    192 static packet_t tcp_prepare_copy(socket_core_ref, tcp_socket_data_ref, packet_t,
     187static packet_t tcp_prepare_copy(socket_core_t *, tcp_socket_data_t *, packet_t,
    193188    size_t, size_t);
    194 /* static */ void tcp_retransmit_packet(socket_core_ref, tcp_socket_data_ref,
     189/* static */ void tcp_retransmit_packet(socket_core_t *, tcp_socket_data_t *,
    195190    size_t);
    196 static int tcp_create_notification_packet(packet_t *, socket_core_ref,
    197     tcp_socket_data_ref, int, int);
    198 static void tcp_refresh_socket_data(tcp_socket_data_ref);
    199 
    200 static void tcp_initialize_socket_data(tcp_socket_data_ref);
    201 
    202 static int tcp_process_listen(socket_core_ref, tcp_socket_data_ref,
    203     tcp_header_ref, packet_t, struct sockaddr *, struct sockaddr *, size_t);
    204 static int tcp_process_syn_sent(socket_core_ref, tcp_socket_data_ref,
    205     tcp_header_ref, packet_t);
    206 static int tcp_process_syn_received(socket_core_ref, tcp_socket_data_ref,
    207     tcp_header_ref, packet_t);
    208 static int tcp_process_established(socket_core_ref, tcp_socket_data_ref,
    209     tcp_header_ref, packet_t, int, size_t);
    210 static int tcp_queue_received_packet(socket_core_ref, tcp_socket_data_ref,
     191static int tcp_create_notification_packet(packet_t *, socket_core_t *,
     192    tcp_socket_data_t *, int, int);
     193static void tcp_refresh_socket_data(tcp_socket_data_t *);
     194
     195static void tcp_initialize_socket_data(tcp_socket_data_t *);
     196
     197static int tcp_process_listen(socket_core_t *, tcp_socket_data_t *,
     198    tcp_header_t *, packet_t, struct sockaddr *, struct sockaddr *, size_t);
     199static int tcp_process_syn_sent(socket_core_t *, tcp_socket_data_t *,
     200    tcp_header_t *, packet_t);
     201static int tcp_process_syn_received(socket_core_t *, tcp_socket_data_t *,
     202    tcp_header_t *, packet_t);
     203static int tcp_process_established(socket_core_t *, tcp_socket_data_t *,
     204    tcp_header_t *, packet_t, int, size_t);
     205static int tcp_queue_received_packet(socket_core_t *, tcp_socket_data_t *,
    211206    packet_t, int, size_t);
    212207
     
    214209static int tcp_process_client_messages(ipc_callid_t, ipc_call_t);
    215210
    216 static int tcp_listen_message(socket_cores_ref, int, int);
    217 static int tcp_connect_message(socket_cores_ref, int, struct sockaddr *,
     211static int tcp_listen_message(socket_cores_t *, int, int);
     212static int tcp_connect_message(socket_cores_t *, int, struct sockaddr *,
    218213    socklen_t);
    219 static int tcp_recvfrom_message(socket_cores_ref, int, int, size_t *);
    220 static int tcp_send_message(socket_cores_ref, int, int, size_t *, int);
    221 static int tcp_accept_message(socket_cores_ref, int, int, size_t *, size_t *);
    222 static int tcp_close_message(socket_cores_ref, int);
     214static int tcp_recvfrom_message(socket_cores_t *, int, int, size_t *);
     215static int tcp_send_message(socket_cores_t *, int, int, size_t *, int);
     216static int tcp_accept_message(socket_cores_t *, int, int, size_t *, size_t *);
     217static int tcp_close_message(socket_cores_t *, int);
    223218
    224219/** TCP global data. */
     
    229224 * @param[in] client_connection The client connection processing function. The
    230225 *                      module skeleton propagates its own one.
    231  * @returns             EOK on success.
    232  * @returns             ENOMEM if there is not enough memory left.
     226 * @return              EOK on success.
     227 * @return              ENOMEM if there is not enough memory left.
    233228 */
    234229int tcp_initialize(async_client_conn_t client_connection)
     
    290285        size_t offset;
    291286        int result;
    292         tcp_header_ref header;
    293         socket_core_ref socket;
    294         tcp_socket_data_ref socket_data;
     287        tcp_header_t *header;
     288        socket_core_t *socket;
     289        tcp_socket_data_t *socket_data;
    295290        packet_t next_packet;
    296291        size_t total_length;
     
    343338
    344339        /* Get tcp header */
    345         header = (tcp_header_ref) packet_get_data(packet);
     340        header = (tcp_header_t *) packet_get_data(packet);
    346341        if (!header)
    347342                return tcp_release_and_return(packet, NO_DATA);
     
    380375
    381376        printf("socket id %d\n", socket->socket_id);
    382         socket_data = (tcp_socket_data_ref) socket->specific_data;
     377        socket_data = (tcp_socket_data_t *) socket->specific_data;
    383378        assert(socket_data);
    384379
     
    497492}
    498493
    499 int tcp_process_established(socket_core_ref socket, tcp_socket_data_ref
    500     socket_data, tcp_header_ref header, packet_t packet, int fragments,
     494int tcp_process_established(socket_core_t *socket, tcp_socket_data_t *
     495    socket_data, tcp_header_t *header, packet_t packet, int fragments,
    501496    size_t total_length)
    502497{
     
    805800}
    806801
    807 int tcp_queue_received_packet(socket_core_ref socket,
    808     tcp_socket_data_ref socket_data, packet_t packet, int fragments,
     802int tcp_queue_received_packet(socket_core_t *socket,
     803    tcp_socket_data_t *socket_data, packet_t packet, int fragments,
    809804    size_t total_length)
    810805{
    811         packet_dimension_ref packet_dimension;
     806        packet_dimension_t *packet_dimension;
    812807        int rc;
    813808
     
    842837}
    843838
    844 int tcp_process_syn_sent(socket_core_ref socket, tcp_socket_data_ref
    845     socket_data, tcp_header_ref header, packet_t packet)
     839int tcp_process_syn_sent(socket_core_t *socket, tcp_socket_data_t *
     840    socket_data, tcp_header_t *header, packet_t packet)
    846841{
    847842        packet_t next_packet;
     
    900895}
    901896
    902 int tcp_process_listen(socket_core_ref listening_socket,
    903     tcp_socket_data_ref listening_socket_data, tcp_header_ref header,
     897int tcp_process_listen(socket_core_t *listening_socket,
     898    tcp_socket_data_t *listening_socket_data, tcp_header_t *header,
    904899    packet_t packet, struct sockaddr *src, struct sockaddr *dest,
    905900    size_t addrlen)
    906901{
    907902        packet_t next_packet;
    908         socket_core_ref socket;
    909         tcp_socket_data_ref socket_data;
     903        socket_core_t *socket;
     904        tcp_socket_data_t *socket_data;
    910905        int socket_id;
    911906        int listening_socket_id = listening_socket->socket_id;
     
    922917                return tcp_release_and_return(packet, EINVAL);
    923918
    924         socket_data = (tcp_socket_data_ref) malloc(sizeof(*socket_data));
     919        socket_data = (tcp_socket_data_t *) malloc(sizeof(*socket_data));
    925920        if (!socket_data)
    926921                return tcp_release_and_return(packet, ENOMEM);
     
    979974        }
    980975        listening_socket_data =
    981             (tcp_socket_data_ref) listening_socket->specific_data;
     976            (tcp_socket_data_t *) listening_socket->specific_data;
    982977        assert(listening_socket_data);
    983978
     
    991986                return ENOTSOCK;
    992987        }
    993         socket_data = (tcp_socket_data_ref) socket->specific_data;
     988        socket_data = (tcp_socket_data_t *) socket->specific_data;
    994989        assert(socket_data);
    995990
     
    10601055}
    10611056
    1062 int tcp_process_syn_received(socket_core_ref socket,
    1063     tcp_socket_data_ref socket_data, tcp_header_ref header, packet_t packet)
    1064 {
    1065         socket_core_ref listening_socket;
    1066         tcp_socket_data_ref listening_socket_data;
     1057int tcp_process_syn_received(socket_core_t *socket,
     1058    tcp_socket_data_t *socket_data, tcp_header_t *header, packet_t packet)
     1059{
     1060        socket_core_t *listening_socket;
     1061        tcp_socket_data_t *listening_socket_data;
    10671062        int rc;
    10681063
     
    10861081        if (listening_socket) {
    10871082                listening_socket_data =
    1088                     (tcp_socket_data_ref) listening_socket->specific_data;
     1083                    (tcp_socket_data_t *) listening_socket->specific_data;
    10891084                assert(listening_socket_data);
    10901085
     
    11271122}
    11281123
    1129 void tcp_process_acknowledgement(socket_core_ref socket,
    1130     tcp_socket_data_ref socket_data, tcp_header_ref header)
     1124void tcp_process_acknowledgement(socket_core_t *socket,
     1125    tcp_socket_data_t *socket_data, tcp_header_t *header)
    11311126{
    11321127        size_t number;
     
    12271222 * @param[out] answer_count The last parameter for the actual answer in the
    12281223 *                      answer parameter.
    1229  * @returns             EOK on success.
    1230  * @returns             ENOTSUP if the message is not known.
     1224 * @return              EOK on success.
     1225 * @return              ENOTSUP if the message is not known.
    12311226 *
    12321227 * @see tcp_interface.h
     
    12651260}
    12661261
    1267 void tcp_refresh_socket_data(tcp_socket_data_ref socket_data)
     1262void tcp_refresh_socket_data(tcp_socket_data_t *socket_data)
    12681263{
    12691264        assert(socket_data);
     
    12811276}
    12821277
    1283 void tcp_initialize_socket_data(tcp_socket_data_ref socket_data)
     1278void tcp_initialize_socket_data(tcp_socket_data_t *socket_data)
    12841279{
    12851280        assert(socket_data);
     
    13041299        ipc_call_t answer;
    13051300        int answer_count;
    1306         tcp_socket_data_ref socket_data;
    1307         socket_core_ref socket;
    1308         packet_dimension_ref packet_dimension;
     1301        tcp_socket_data_t *socket_data;
     1302        socket_core_t *socket;
     1303        packet_dimension_t *packet_dimension;
    13091304
    13101305        /*
     
    13361331                case NET_SOCKET:
    13371332                        socket_data =
    1338                             (tcp_socket_data_ref) malloc(sizeof(*socket_data));
     1333                            (tcp_socket_data_t *) malloc(sizeof(*socket_data));
    13391334                        if (!socket_data) {
    13401335                                res = ENOMEM;
     
    13831378                                    SOCKET_GET_SOCKET_ID(call));
    13841379                                if (socket) {
    1385                                         socket_data = (tcp_socket_data_ref)
     1380                                        socket_data = (tcp_socket_data_t *)
    13861381                                            socket->specific_data;
    13871382                                        assert(socket_data);
     
    15401535int tcp_timeout(void *data)
    15411536{
    1542         tcp_timeout_ref timeout = data;
     1537        tcp_timeout_t *timeout = data;
    15431538        int keep_write_lock = false;
    1544         socket_core_ref socket;
    1545         tcp_socket_data_ref socket_data;
     1539        socket_core_t *socket;
     1540        tcp_socket_data_t *socket_data;
    15461541
    15471542        assert(timeout);
     
    15611556                goto out;
    15621557       
    1563         socket_data = (tcp_socket_data_ref) socket->specific_data;
     1558        socket_data = (tcp_socket_data_t *) socket->specific_data;
    15641559        assert(socket_data);
    15651560        if (socket_data->local_sockets != timeout->local_sockets)
     
    16171612int tcp_release_after_timeout(void *data)
    16181613{
    1619         tcp_timeout_ref timeout = data;
    1620         socket_core_ref socket;
    1621         tcp_socket_data_ref socket_data;
     1614        tcp_timeout_t *timeout = data;
     1615        socket_core_t *socket;
     1616        tcp_socket_data_t *socket_data;
    16221617        fibril_rwlock_t *local_lock;
    16231618
     
    16351630
    16361631        if (socket && (socket->socket_id == timeout->socket_id)) {
    1637                 socket_data = (tcp_socket_data_ref) socket->specific_data;
     1632                socket_data = (tcp_socket_data_t *) socket->specific_data;
    16381633                assert(socket_data);
    16391634                if (socket_data->local_sockets == timeout->local_sockets) {
     
    16561651}
    16571652
    1658 void tcp_retransmit_packet(socket_core_ref socket, tcp_socket_data_ref
     1653void tcp_retransmit_packet(socket_core_t *socket, tcp_socket_data_t *
    16591654    socket_data, size_t sequence_number)
    16601655{
     
    16831678}
    16841679
    1685 int tcp_listen_message(socket_cores_ref local_sockets, int socket_id,
     1680int tcp_listen_message(socket_cores_t *local_sockets, int socket_id,
    16861681    int backlog)
    16871682{
    1688         socket_core_ref socket;
    1689         tcp_socket_data_ref socket_data;
     1683        socket_core_t *socket;
     1684        tcp_socket_data_t *socket_data;
    16901685
    16911686        assert(local_sockets);
     
    17001695       
    17011696        /* Get the socket specific data */
    1702         socket_data = (tcp_socket_data_ref) socket->specific_data;
     1697        socket_data = (tcp_socket_data_t *) socket->specific_data;
    17031698        assert(socket_data);
    17041699
     
    17091704}
    17101705
    1711 int tcp_connect_message(socket_cores_ref local_sockets, int socket_id,
     1706int tcp_connect_message(socket_cores_t *local_sockets, int socket_id,
    17121707    struct sockaddr *addr, socklen_t addrlen)
    17131708{
    1714         socket_core_ref socket;
     1709        socket_core_t *socket;
    17151710        int rc;
    17161711
     
    17371732}
    17381733
    1739 int tcp_connect_core(socket_core_ref socket, socket_cores_ref local_sockets,
     1734int tcp_connect_core(socket_core_t *socket, socket_cores_t *local_sockets,
    17401735    struct sockaddr *addr, socklen_t addrlen)
    17411736{
    1742         tcp_socket_data_ref socket_data;
     1737        tcp_socket_data_t *socket_data;
    17431738        packet_t packet;
    17441739        int rc;
     
    17491744
    17501745        /* Get the socket specific data */
    1751         socket_data = (tcp_socket_data_ref) socket->specific_data;
     1746        socket_data = (tcp_socket_data_t *) socket->specific_data;
    17521747        assert(socket_data);
    17531748        assert(socket->specific_data == socket_data);
     
    18281823}
    18291824
    1830 int tcp_queue_prepare_packet(socket_core_ref socket,
    1831     tcp_socket_data_ref socket_data, packet_t packet, size_t data_length)
    1832 {
    1833         tcp_header_ref header;
     1825int tcp_queue_prepare_packet(socket_core_t *socket,
     1826    tcp_socket_data_t *socket_data, packet_t packet, size_t data_length)
     1827{
     1828        tcp_header_t *header;
    18341829        int rc;
    18351830
     
    18391834
    18401835        /* Get TCP header */
    1841         header = (tcp_header_ref) packet_get_data(packet);
     1836        header = (tcp_header_t *) packet_get_data(packet);
    18421837        if (!header)
    18431838                return NO_DATA;
     
    18591854}
    18601855
    1861 int tcp_queue_packet(socket_core_ref socket, tcp_socket_data_ref socket_data,
     1856int tcp_queue_packet(socket_core_t *socket, tcp_socket_data_t *socket_data,
    18621857    packet_t packet, size_t data_length)
    18631858{
     
    18811876}
    18821877
    1883 packet_t tcp_get_packets_to_send(socket_core_ref socket, tcp_socket_data_ref
     1878packet_t tcp_get_packets_to_send(socket_core_t *socket, tcp_socket_data_t *
    18841879    socket_data)
    18851880{
     
    19411936}
    19421937
    1943 packet_t tcp_send_prepare_packet(socket_core_ref socket, tcp_socket_data_ref
     1938packet_t tcp_send_prepare_packet(socket_core_t *socket, tcp_socket_data_t *
    19441939    socket_data, packet_t packet, size_t data_length, size_t sequence_number)
    19451940{
    1946         tcp_header_ref header;
     1941        tcp_header_t *header;
    19471942        uint32_t checksum;
    19481943        int rc;
     
    19611956
    19621957        /* Get the header */
    1963         header = (tcp_header_ref) packet_get_data(packet);
     1958        header = (tcp_header_t *) packet_get_data(packet);
    19641959        if (!header) {
    19651960                pq_release_remote(tcp_globals.net_phone, packet_get_id(packet));
     
    20021997}
    20031998
    2004 packet_t tcp_prepare_copy(socket_core_ref socket, tcp_socket_data_ref
     1999packet_t tcp_prepare_copy(socket_core_t *socket, tcp_socket_data_t *
    20052000    socket_data, packet_t packet, size_t data_length, size_t sequence_number)
    20062001{
     
    20322027}
    20332028
    2034 void tcp_prepare_operation_header(socket_core_ref socket,
    2035     tcp_socket_data_ref socket_data, tcp_header_ref header, int synchronize,
     2029void tcp_prepare_operation_header(socket_core_t *socket,
     2030    tcp_socket_data_t *socket_data, tcp_header_t *header, int synchronize,
    20362031    int finalize)
    20372032{
     
    20502045
    20512046int tcp_prepare_timeout(int (*timeout_function)(void *tcp_timeout_t),
    2052     socket_core_ref socket, tcp_socket_data_ref socket_data,
     2047    socket_core_t *socket, tcp_socket_data_t *socket_data,
    20532048    size_t sequence_number, tcp_socket_state_t state, suseconds_t timeout,
    20542049    int globals_read_only)
    20552050{
    2056         tcp_timeout_ref operation_timeout;
     2051        tcp_timeout_t *operation_timeout;
    20572052        fid_t fibril;
    20582053
     
    20962091}
    20972092
    2098 int tcp_recvfrom_message(socket_cores_ref local_sockets, int socket_id,
     2093int tcp_recvfrom_message(socket_cores_t *local_sockets, int socket_id,
    20992094    int flags, size_t *addrlen)
    21002095{
    2101         socket_core_ref socket;
    2102         tcp_socket_data_ref socket_data;
     2096        socket_core_t *socket;
     2097        tcp_socket_data_t *socket_data;
    21032098        int packet_id;
    21042099        packet_t packet;
     
    21172112                return NO_DATA;
    21182113
    2119         socket_data = (tcp_socket_data_ref) socket->specific_data;
     2114        socket_data = (tcp_socket_data_t *) socket->specific_data;
    21202115
    21212116        /* Check state */
     
    21542149}
    21552150
    2156 int tcp_send_message(socket_cores_ref local_sockets, int socket_id,
     2151int tcp_send_message(socket_cores_t *local_sockets, int socket_id,
    21572152    int fragments, size_t *data_fragment_size, int flags)
    21582153{
    2159         socket_core_ref socket;
    2160         tcp_socket_data_ref socket_data;
    2161         packet_dimension_ref packet_dimension;
     2154        socket_core_t *socket;
     2155        tcp_socket_data_t *socket_data;
     2156        packet_dimension_t *packet_dimension;
    21622157        packet_t packet;
    21632158        size_t total_length;
    2164         tcp_header_ref header;
     2159        tcp_header_t *header;
    21652160        int index;
    21662161        int result;
     
    21792174                return NO_DATA;
    21802175
    2181         socket_data = (tcp_socket_data_ref) socket->specific_data;
     2176        socket_data = (tcp_socket_data_t *) socket->specific_data;
    21822177
    21832178        /* Check state */
     
    22302225
    22312226int
    2232 tcp_close_message(socket_cores_ref local_sockets, int socket_id)
    2233 {
    2234         socket_core_ref socket;
    2235         tcp_socket_data_ref socket_data;
     2227tcp_close_message(socket_cores_t *local_sockets, int socket_id)
     2228{
     2229        socket_core_t *socket;
     2230        tcp_socket_data_t *socket_data;
    22362231        packet_t packet;
    22372232        int rc;
     
    22432238
    22442239        /* Get the socket specific data */
    2245         socket_data = (tcp_socket_data_ref) socket->specific_data;
     2240        socket_data = (tcp_socket_data_t *) socket->specific_data;
    22462241        assert(socket_data);
    22472242
     
    22982293}
    22992294
    2300 int tcp_create_notification_packet(packet_t *packet, socket_core_ref socket,
    2301     tcp_socket_data_ref socket_data, int synchronize, int finalize)
    2302 {
    2303         packet_dimension_ref packet_dimension;
    2304         tcp_header_ref header;
     2295int tcp_create_notification_packet(packet_t *packet, socket_core_t *socket,
     2296    tcp_socket_data_t *socket_data, int synchronize, int finalize)
     2297{
     2298        packet_dimension_t *packet_dimension;
     2299        tcp_header_t *header;
    23052300        int rc;
    23062301
     
    23322327}
    23332328
    2334 int tcp_accept_message(socket_cores_ref local_sockets, int socket_id,
     2329int tcp_accept_message(socket_cores_t *local_sockets, int socket_id,
    23352330    int new_socket_id, size_t *data_fragment_size, size_t *addrlen)
    23362331{
    2337         socket_core_ref accepted;
    2338         socket_core_ref socket;
    2339         tcp_socket_data_ref socket_data;
    2340         packet_dimension_ref packet_dimension;
     2332        socket_core_t *accepted;
     2333        socket_core_t *socket;
     2334        tcp_socket_data_t *socket_data;
     2335        packet_dimension_t *packet_dimension;
    23412336        int rc;
    23422337
     
    23512346
    23522347        /* Get the socket specific data */
    2353         socket_data = (tcp_socket_data_ref) socket->specific_data;
     2348        socket_data = (tcp_socket_data_t *) socket->specific_data;
    23542349        assert(socket_data);
    23552350
     
    23692364
    23702365                /* Get the socket specific data */
    2371                 socket_data = (tcp_socket_data_ref) accepted->specific_data;
     2366                socket_data = (tcp_socket_data_t *) accepted->specific_data;
    23722367                assert(socket_data);
    23732368                /* TODO can it be in another state? */
     
    24052400}
    24062401
    2407 void tcp_free_socket_data(socket_core_ref socket)
    2408 {
    2409         tcp_socket_data_ref socket_data;
     2402void tcp_free_socket_data(socket_core_t *socket)
     2403{
     2404        tcp_socket_data_t *socket_data;
    24102405
    24112406        assert(socket);
     
    24142409
    24152410        /* Get the socket specific data */
    2416         socket_data = (tcp_socket_data_ref) socket->specific_data;
     2411        socket_data = (tcp_socket_data_t *) socket->specific_data;
    24172412        assert(socket_data);
    24182413
     
    24992494/** Starts the module.
    25002495 *
    2501  * @returns             EOK on success.
    2502  * @returns             Other error codes as defined for each specific module
     2496 * @return              EOK on success.
     2497 * @return              Other error codes as defined for each specific module
    25032498 *                      start function.
    25042499 */
  • uspace/srv/net/tl/tcp/tcp.h

    rb4c9c61 rfdbc3ff  
    5555typedef struct tcp_socket_data tcp_socket_data_t;
    5656
    57 /** Type definition of the TCP socket specific data pointer.
    58  * @see tcp_socket_data
    59  */
    60 typedef tcp_socket_data_t *tcp_socket_data_ref;
    61 
    6257/** Type definition of the TCP operation data.
    6358 * @see tcp_operation
    6459 */
    6560typedef struct tcp_operation tcp_operation_t;
    66 
    67 /** Type definition of the TCP operation data pointer.
    68  * @see tcp_operation
    69  */
    70 typedef tcp_operation_t *tcp_operation_ref;
    7161
    7262/** TCP socket state type definition.
     
    272262        uint16_t dest_port;
    273263        /** Parent local sockets. */
    274         socket_cores_ref local_sockets;
     264        socket_cores_t *local_sockets;
    275265       
    276266        /** Local sockets safety lock.
  • uspace/srv/net/tl/tcp/tcp_header.h

    rb4c9c61 rfdbc3ff  
    5959typedef struct tcp_header tcp_header_t;
    6060
    61 /** Type definition of the transmission datagram header pointer.
    62  * @see tcp_header
    63  */
    64 typedef tcp_header_t *tcp_header_ref;
    65 
    6661/** Type definition of the transmission datagram header option.
    6762 * @see tcp_option
     
    6964typedef struct tcp_option tcp_option_t;
    7065
    71 /** Type definition of the transmission datagram header option pointer.
    72  * @see tcp_option
    73  */
    74 typedef tcp_option_t *tcp_option_ref;
    75 
    7666/** Type definition of the Maximum segment size TCP option. */
    7767typedef struct tcp_max_segment_size_option tcp_max_segment_size_option_t;
    78 
    79 /** Type definition of the Maximum segment size TCP option pointer.
    80  * @see tcp_max_segment_size_option
    81  */
    82 typedef tcp_max_segment_size_option_t *tcp_max_segment_size_option_ref;
    8368
    8469/** Transmission datagram header. */
  • uspace/srv/net/tl/udp/udp.c

    rb4c9c61 rfdbc3ff  
    9797 * @param[in] client_connection The client connection processing function. The
    9898 *                      module skeleton propagates its own one.
    99  * @returns             EOK on success.
    100  * @returns             ENOMEM if there is not enough memory left.
     99 * @return              EOK on success.
     100 * @return              ENOMEM if there is not enough memory left.
    101101 */
    102102int udp_initialize(async_client_conn_t client_connection)
     
    112112                }
    113113        };
    114         measured_string_ref configuration;
     114        measured_string_t *configuration;
    115115        size_t count = sizeof(names) / sizeof(measured_string_t);
    116116        char *data;
     
    205205 * @param[in] error     The packet error reporting service. Prefixes the
    206206 *                      received packet.
    207  * @returns             EOK on success.
    208  * @returns             EINVAL if the packet is not valid.
    209  * @returns             EINVAL if the stored packet address is not the
     207 * @return              EOK on success.
     208 * @return              EINVAL if the packet is not valid.
     209 * @return              EINVAL if the stored packet address is not the
    210210 *                      an_addr_t.
    211  * @returns             EINVAL if the packet does not contain any data.
    212  * @returns             NO_DATA if the packet content is shorter than the user
     211 * @return              EINVAL if the packet does not contain any data.
     212 * @return              NO_DATA if the packet content is shorter than the user
    213213 *                      datagram header.
    214  * @returns             ENOMEM if there is not enough memory left.
    215  * @returns             EADDRNOTAVAIL if the destination socket does not exist.
    216  * @returns             Other error codes as defined for the
     214 * @return              ENOMEM if there is not enough memory left.
     215 * @return              EADDRNOTAVAIL if the destination socket does not exist.
     216 * @return              Other error codes as defined for the
    217217 *                      ip_client_process_packet() function.
    218218 */
     
    223223        size_t offset;
    224224        int result;
    225         udp_header_ref header;
    226         socket_core_ref socket;
     225        udp_header_t *header;
     226        socket_core_t *socket;
    227227        packet_t next_packet;
    228228        size_t total_length;
     
    235235        struct sockaddr *src;
    236236        struct sockaddr *dest;
    237         packet_dimension_ref packet_dimension;
     237        packet_dimension_t *packet_dimension;
    238238        int rc;
    239239
     
    277277
    278278        /* Get UDP header */
    279         header = (udp_header_ref) packet_get_data(packet);
     279        header = (udp_header_t *) packet_get_data(packet);
    280280        if (!header)
    281281                return udp_release_and_return(packet, NO_DATA);
     
    409409 * @param[in] error     The packet error reporting service. Prefixes the
    410410 *                      received packet.
    411  * @returns             EOK on success.
    412  * @returns             Other error codes as defined for the
     411 * @return              EOK on success.
     412 * @return              Other error codes as defined for the
    413413 *                      udp_process_packet() function.
    414414 */
     
    439439 * @param[out] data_fragment_size The data fragment size in bytes.
    440440 * @param[in] flags     Various send flags.
    441  * @returns             EOK on success.
    442  * @returns             EAFNOTSUPPORT if the address family is not supported.
    443  * @returns             ENOTSOCK if the socket is not found.
    444  * @returns             EINVAL if the address is invalid.
    445  * @returns             ENOTCONN if the sending socket is not and cannot be
     441 * @return              EOK on success.
     442 * @return              EAFNOTSUPPORT if the address family is not supported.
     443 * @return              ENOTSOCK if the socket is not found.
     444 * @return              EINVAL if the address is invalid.
     445 * @return              ENOTCONN if the sending socket is not and cannot be
    446446 *                      bound.
    447  * @returns             ENOMEM if there is not enough memory left.
    448  * @returns             Other error codes as defined for the
     447 * @return              ENOMEM if there is not enough memory left.
     448 * @return              Other error codes as defined for the
    449449 *                      socket_read_packet_data() function.
    450  * @returns             Other error codes as defined for the
     450 * @return              Other error codes as defined for the
    451451 *                      ip_client_prepare_packet() function.
    452  * @returns             Other error codes as defined for the ip_send_msg()
     452 * @return              Other error codes as defined for the ip_send_msg()
    453453 *                      function.
    454454 */
    455 static int udp_sendto_message(socket_cores_ref local_sockets, int socket_id,
     455static int udp_sendto_message(socket_cores_t *local_sockets, int socket_id,
    456456    const struct sockaddr *addr, socklen_t addrlen, int fragments,
    457457    size_t *data_fragment_size, int flags)
    458458{
    459         socket_core_ref socket;
     459        socket_core_t *socket;
    460460        packet_t packet;
    461461        packet_t next_packet;
    462         udp_header_ref header;
     462        udp_header_t *header;
    463463        int index;
    464464        size_t total_length;
     
    469469        size_t headerlen;
    470470        device_id_t device_id;
    471         packet_dimension_ref packet_dimension;
     471        packet_dimension_t *packet_dimension;
    472472        int rc;
    473473       
     
    599599 * @param[in] flags     Various receive flags.
    600600 * @param[out] addrlen  The source address length.
    601  * @returns             The number of bytes received.
    602  * @returns             ENOTSOCK if the socket is not found.
    603  * @returns             NO_DATA if there are no received packets or data.
    604  * @returns             ENOMEM if there is not enough memory left.
    605  * @returns             EINVAL if the received address is not an IP address.
    606  * @returns             Other error codes as defined for the packet_translate()
     601 * @return              The number of bytes received.
     602 * @return              ENOTSOCK if the socket is not found.
     603 * @return              NO_DATA if there are no received packets or data.
     604 * @return              ENOMEM if there is not enough memory left.
     605 * @return              EINVAL if the received address is not an IP address.
     606 * @return              Other error codes as defined for the packet_translate()
    607607 *                      function.
    608  * @returns             Other error codes as defined for the data_reply()
     608 * @return              Other error codes as defined for the data_reply()
    609609 *                      function.
    610610 */
    611 static int udp_recvfrom_message(socket_cores_ref local_sockets, int socket_id,
     611static int udp_recvfrom_message(socket_cores_t *local_sockets, int socket_id,
    612612    int flags, size_t *addrlen)
    613613{
    614         socket_core_ref socket;
     614        socket_core_t *socket;
    615615        int packet_id;
    616616        packet_t packet;
    617         udp_header_ref header;
     617        udp_header_t *header;
    618618        struct sockaddr *addr;
    619619        size_t length;
     
    644644                return udp_release_and_return(packet, NO_DATA);
    645645        }
    646         header = (udp_header_ref) data;
     646        header = (udp_header_t *) data;
    647647
    648648        /* Set the source address port */
     
    698698 * @param[in] callid    The message identifier.
    699699 * @param[in] call      The message parameters.
    700  * @returns             EOK on success.
     700 * @return              EOK on success.
    701701 *
    702702 * @see socket.h
     
    714714        ipc_call_t answer;
    715715        int answer_count;
    716         packet_dimension_ref packet_dimension;
     716        packet_dimension_t *packet_dimension;
    717717
    718718        /*
     
    852852 * @param[out] answer_count The last parameter for the actual answer in the
    853853 *                      answer parameter.
    854  * @returns             EOK on success.
    855  * @returns             ENOTSUP if the message is not known.
     854 * @return              EOK on success.
     855 * @return              ENOTSUP if the message is not known.
    856856 *
    857857 * @see udp_interface.h
     
    924924/** Starts the module.
    925925 *
    926  * @returns             EOK on success.
    927  * @returns             Other error codes as defined for each specific module
     926 * @return              EOK on success.
     927 * @return              Other error codes as defined for each specific module
    928928 *                      start function.
    929929 */
  • uspace/srv/net/tl/udp/udp_header.h

    rb4c9c61 rfdbc3ff  
    4949typedef struct udp_header udp_header_t;
    5050
    51 /** Type definition of the user datagram header pointer.
    52  * @see udp_header
    53  */
    54 typedef udp_header_t *udp_header_ref;
    55 
    5651/** User datagram header. */
    5752struct udp_header {
Note: See TracChangeset for help on using the changeset viewer.