Changeset 32eceb4f in mainline for uspace/srv/net/il/ip/ip.c


Ignore:
Timestamp:
2010-11-20T22:30:36Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
cb59f787
Parents:
1b22bd4 (diff), 7e1f9b7 (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

File:
1 edited

Legend:

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

    r1b22bd4 r32eceb4f  
    129129 * @return              The result parameter.
    130130 */
    131 static int ip_release_and_return(packet_t packet, int result)
     131static int ip_release_and_return(packet_t *packet, int result)
    132132{
    133133        pq_release_remote(ip_globals.net_phone, packet_get_id(packet));
     
    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)
    173 {
    174         packet_t next;
     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)
     173{
     174        packet_t *next;
    175175        struct sockaddr *dest;
    176176        struct sockaddr_in dest_in;
     
    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
    235 ip_prepare_icmp_and_get_phone(services_t error, packet_t packet,
    236     ip_header_ref header)
     235ip_prepare_icmp_and_get_phone(services_t error, packet_t *packet,
     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
    624 ip_prepare_packet(in_addr_t *source, in_addr_t dest, packet_t packet,
    625     measured_string_ref destination)
     624ip_prepare_packet(in_addr_t *source, in_addr_t dest, packet_t *packet,
     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;
    631         packet_t next;
     628        ip_header_t *header;
     629        ip_header_t *last_header;
     630        ip_header_t *middle_header;
     631        packet_t *next;
    632632        int rc;
    633633
     
    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
    756 ip_fragment_packet_data(packet_t packet, packet_t new_packet,
    757     ip_header_ref header, ip_header_ref new_header, size_t length,
     756ip_fragment_packet_data(packet_t *packet, packet_t *new_packet,
     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 */
    817817static int
    818 ip_fragment_packet(packet_t packet, size_t length, size_t prefix, size_t suffix,
     818ip_fragment_packet(packet_t *packet, size_t length, size_t prefix, size_t suffix,
    819819    socklen_t addr_len)
    820820{
    821         packet_t new_packet;
    822         ip_header_ref header;
    823         ip_header_ref middle_header;
    824         ip_header_ref last_header;
     821        packet_t *new_packet;
     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.
    923  */
    924 static packet_t
    925 ip_split_packet(packet_t packet, size_t prefix, size_t content, size_t suffix,
     921 * @return              The packet or the packet queue of the allowed length.
     922 * @return              NULL if there are no packets left.
     923 */
     924static packet_t *
     925ip_split_packet(packet_t *packet, size_t prefix, size_t content, size_t suffix,
    926926    socklen_t addr_len, services_t error)
    927927{
    928928        size_t length;
    929         packet_t next;
    930         packet_t new_packet;
     929        packet_t *next;
     930        packet_t *new_packet;
    931931        int result;
    932932        int phone;
     
    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;
     
    12471247
    12481248static int
    1249 ip_send_msg_local(int il_phone, device_id_t device_id, packet_t packet,
     1249ip_send_msg_local(int il_phone, device_id_t device_id, packet_t *packet,
    12501250    services_t sender, services_t error)
    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 */
    15541554static int
    1555 ip_process_packet(device_id_t device_id, packet_t packet)
    1556 {
    1557         ip_header_ref header;
     1555ip_process_packet(device_id_t device_id, packet_t *packet)
     1556{
     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);
     
    17151715static int
    17161716ip_received_error_msg_local(int ip_phone, device_id_t device_id,
    1717     packet_t packet, services_t target, services_t error)
     1717    packet_t *packet, services_t target, services_t error)
    17181718{
    17191719        uint8_t *data;
     
    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.
    1860  */
    1861 static int ip_receive_message(device_id_t device_id, packet_t packet)
    1862 {
    1863         packet_t next;
     1859 * @return              ENOMEM if there is not enough memory left.
     1860 */
     1861static int ip_receive_message(device_id_t device_id, packet_t *packet)
     1862{
     1863        packet_t *next;
    18641864
    18651865        do {
     
    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
     
    18901890    int *answer_count)
    18911891{
    1892         packet_t packet;
     1892        packet_t *packet;
    18931893        struct sockaddr *addr;
    18941894        size_t addrlen;
     
    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[])
Note: See TracChangeset for help on using the changeset viewer.