Changeset 774e6d1a in mainline for uspace/srv/net


Ignore:
Timestamp:
2011-01-09T23:24:53Z (15 years ago)
Author:
martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
4b86dac
Parents:
3c106e88
Message:

partial networking stack overhaul

  • a lot of coding style changes (comments, indentation, etc.)
  • convert several ints to unsigned ints or size_t values
  • streamline many of the IPC-related macros (they no longer dereference the call structure by themselves)
  • get rid of netif_interface.h (containing only aliases for remote functions and not serving any purpose)
  • rename netif_local.{c|h} to netif_skel.{c|h} (it is really just a skeleton)
  • drop the "_remote" and "_standalone" suffixes from most of the netif_ functions (they do not serve any purpose anymore)
  • implement netif_client_connection() as a common framework function for all netif modules
    • update the lo module accordingly
  • ip module now reports the default gateway to the user whenever it is being set
Location:
uspace/srv/net
Files:
24 edited

Legend:

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

    r3c106e88 r774e6d1a  
    457457        uint8_t *des_proto;
    458458        int rc;
    459 
     459       
    460460        length = packet_get_data_length(packet);
    461461        if (length <= sizeof(arp_header_t))
     
    677677int
    678678arp_message_standalone(ipc_callid_t callid, ipc_call_t *call,
    679     ipc_call_t *answer, int *answer_count)
     679    ipc_call_t *answer, size_t *answer_count)
    680680{
    681681        measured_string_t *address;
     
    696696                        return rc;
    697697               
    698                 rc = arp_device_message(IPC_GET_DEVICE(call),
    699                     IPC_GET_SERVICE(call), ARP_GET_NETIF(call), address);
     698                rc = arp_device_message(IPC_GET_DEVICE(*call),
     699                    IPC_GET_SERVICE(*call), ARP_GET_NETIF(*call), address);
    700700                if (rc != EOK) {
    701701                        free(address);
     
    710710               
    711711                fibril_mutex_lock(&arp_globals.lock);
    712                 rc = arp_translate_message(IPC_GET_DEVICE(call),
    713                     IPC_GET_SERVICE(call), address, &translation);
     712                rc = arp_translate_message(IPC_GET_DEVICE(*call),
     713                    IPC_GET_SERVICE(*call), address, &translation);
    714714                free(address);
    715715                free(data);
     
    727727
    728728        case NET_ARP_CLEAR_DEVICE:
    729                 return arp_clear_device_req(0, IPC_GET_DEVICE(call));
     729                return arp_clear_device_req(0, IPC_GET_DEVICE(*call));
    730730
    731731        case NET_ARP_CLEAR_ADDRESS:
     
    734734                        return rc;
    735735               
    736                 arp_clear_address_req(0, IPC_GET_DEVICE(call),
    737                     IPC_GET_SERVICE(call), address);
     736                arp_clear_address_req(0, IPC_GET_DEVICE(*call),
     737                    IPC_GET_SERVICE(*call), address);
    738738                free(address);
    739739                free(data);
     
    750750               
    751751                rc = packet_translate_remote(arp_globals.net_phone, &packet,
    752                     IPC_GET_PACKET(call));
     752                    IPC_GET_PACKET(*call));
    753753                if (rc != EOK)
    754754                        return rc;
     
    757757                do {
    758758                        next = pq_detach(packet);
    759                         rc = arp_receive_message(IPC_GET_DEVICE(call), packet);
     759                        rc = arp_receive_message(IPC_GET_DEVICE(*call), packet);
    760760                        if (rc != 1) {
    761761                                pq_release_remote(arp_globals.net_phone,
     
    769769       
    770770        case NET_IL_MTU_CHANGED:
    771                 return arp_mtu_changed_message(IPC_GET_DEVICE(call),
    772                     IPC_GET_MTU(call));
     771                return arp_mtu_changed_message(IPC_GET_DEVICE(*call),
     772                    IPC_GET_MTU(*call));
    773773        }
    774774       
     
    791791        while (true) {
    792792                ipc_call_t answer;
    793                 int answer_count;
     793                size_t count;
    794794               
    795795                /* Clear the answer structure */
    796                 refresh_answer(&answer, &answer_count);
     796                refresh_answer(&answer, &count);
    797797               
    798798                /* Fetch the next message */
     
    802802                /* Process the message */
    803803                int res = il_module_message_standalone(callid, &call, &answer,
    804                     &answer_count);
     804                    &count);
    805805               
    806806                /*
     
    813813               
    814814                /* Answer the message */
    815                 answer_call(callid, res, &answer, answer_count);
     815                answer_call(callid, res, &answer, count);
    816816        }
    817817}
  • uspace/srv/net/il/arp/arp_module.c

    r3c106e88 r774e6d1a  
    5858
    5959int il_module_message_standalone(ipc_callid_t callid, ipc_call_t *call,
    60     ipc_call_t *answer, int *answer_count)
     60    ipc_call_t *answer, size_t *count)
    6161{
    62         return arp_message_standalone(callid, call, answer, answer_count);
     62        return arp_message_standalone(callid, call, answer, count);
    6363}
    6464
  • uspace/srv/net/il/arp/arp_module.h

    r3c106e88 r774e6d1a  
    4444extern int arp_initialize(async_client_conn_t);
    4545extern int arp_message_standalone(ipc_callid_t, ipc_call_t *, ipc_call_t *,
    46     int *);
     46    size_t *);
    4747
    4848#endif
  • uspace/srv/net/il/ip/ip.c

    r3c106e88 r774e6d1a  
    477477                ip_globals.gateway.gateway.s_addr = gateway.s_addr;
    478478                ip_globals.gateway.netif = ip_netif;
     479               
     480                char defgateway[INET_ADDRSTRLEN];
     481                inet_ntop(AF_INET, (uint8_t *) &gateway.s_addr,
     482                    defgateway, INET_ADDRSTRLEN);
     483                printf("%s: Default gateway (%s)\n", NAME, defgateway);
    479484        }
    480485
     
    10691074        int index;
    10701075        ip_route_t *route;
    1071 
     1076       
    10721077        if (!netif)
    10731078                return NULL;
    1074 
    1075         // start with the first one - the direct route
     1079       
     1080        /* Start with the first one (the direct route) */
    10761081        for (index = 0; index < ip_routes_count(&netif->routes); index++) {
    10771082                route = ip_routes_get_index(&netif->routes, index);
    1078                 if (route &&
     1083                if ((route) &&
    10791084                    ((route->address.s_addr & route->netmask.s_addr) ==
    1080                     (destination.s_addr & route->netmask.s_addr))) {
     1085                    (destination.s_addr & route->netmask.s_addr)))
    10811086                        return route;
    1082                 }
    10831087        }
    10841088
     
    12881292        if (device_id > 0) {
    12891293                netif = ip_netifs_find(&ip_globals.netifs, device_id);
    1290                 route = ip_netif_find_route(netif, * dest);
     1294                route = ip_netif_find_route(netif, *dest);
    12911295                if (netif && !route && (ip_globals.gateway.netif == netif))
    12921296                        route = &ip_globals.gateway;
     
    13181322                }
    13191323        }
    1320 
     1324       
    13211325        // if the local host is the destination
    13221326        if ((route->address.s_addr == dest->s_addr) &&
     
    15621566        socklen_t addrlen;
    15631567        int rc;
    1564 
     1568       
    15651569        header = (ip_header_t *) packet_get_data(packet);
    15661570        if (!header)
     
    15881592                return EINVAL;
    15891593        }
    1590 
     1594       
    15911595        // process ipopt and get destination
    15921596        dest = ip_get_destination(header);
     
    16091613        if (rc != EOK)
    16101614                return rc;
    1611 
     1615       
    16121616        route = ip_find_route(dest);
    16131617        if (!route) {
     
    18861890int
    18871891ip_message_standalone(ipc_callid_t callid, ipc_call_t *call, ipc_call_t *answer,
    1888     int *answer_count)
     1892    size_t *answer_count)
    18891893{
    18901894        packet_t *packet;
     
    19051909       
    19061910        case IPC_M_CONNECT_TO_ME:
    1907                 return ip_register(IL_GET_PROTO(call), IL_GET_SERVICE(call),
    1908                     IPC_GET_PHONE(call), NULL);
     1911                return ip_register(IL_GET_PROTO(*call), IL_GET_SERVICE(*call),
     1912                    IPC_GET_PHONE(*call), NULL);
    19091913       
    19101914        case NET_IL_DEVICE:
    1911                 return ip_device_req_local(0, IPC_GET_DEVICE(call),
    1912                     IPC_GET_SERVICE(call));
     1915                return ip_device_req_local(0, IPC_GET_DEVICE(*call),
     1916                    IPC_GET_SERVICE(*call));
    19131917       
    19141918        case NET_IL_SEND:
    19151919                rc = packet_translate_remote(ip_globals.net_phone, &packet,
    1916                     IPC_GET_PACKET(call));
     1920                    IPC_GET_PACKET(*call));
    19171921                if (rc != EOK)
    19181922                        return rc;
    1919                 return ip_send_msg_local(0, IPC_GET_DEVICE(call), packet, 0,
    1920                     IPC_GET_ERROR(call));
     1923                return ip_send_msg_local(0, IPC_GET_DEVICE(*call), packet, 0,
     1924                    IPC_GET_ERROR(*call));
    19211925       
    19221926        case NET_IL_DEVICE_STATE:
    1923                 return ip_device_state_message(IPC_GET_DEVICE(call),
    1924                     IPC_GET_STATE(call));
     1927                return ip_device_state_message(IPC_GET_DEVICE(*call),
     1928                    IPC_GET_STATE(*call));
    19251929       
    19261930        case NET_IL_RECEIVED:
    19271931                rc = packet_translate_remote(ip_globals.net_phone, &packet,
    1928                     IPC_GET_PACKET(call));
     1932                    IPC_GET_PACKET(*call));
    19291933                if (rc != EOK)
    19301934                        return rc;
    1931                 return ip_receive_message(IPC_GET_DEVICE(call), packet);
     1935                return ip_receive_message(IPC_GET_DEVICE(*call), packet);
    19321936       
    19331937        case NET_IP_RECEIVED_ERROR:
    19341938                rc = packet_translate_remote(ip_globals.net_phone, &packet,
    1935                     IPC_GET_PACKET(call));
     1939                    IPC_GET_PACKET(*call));
    19361940                if (rc != EOK)
    19371941                        return rc;
    1938                 return ip_received_error_msg_local(0, IPC_GET_DEVICE(call),
    1939                     packet, IPC_GET_TARGET(call), IPC_GET_ERROR(call));
     1942                return ip_received_error_msg_local(0, IPC_GET_DEVICE(*call),
     1943                    packet, IPC_GET_TARGET(*call), IPC_GET_ERROR(*call));
    19401944       
    19411945        case NET_IP_ADD_ROUTE:
    1942                 return ip_add_route_req_local(0, IPC_GET_DEVICE(call),
    1943                     IP_GET_ADDRESS(call), IP_GET_NETMASK(call),
    1944                     IP_GET_GATEWAY(call));
     1946                return ip_add_route_req_local(0, IPC_GET_DEVICE(*call),
     1947                    IP_GET_ADDRESS(*call), IP_GET_NETMASK(*call),
     1948                    IP_GET_GATEWAY(*call));
    19451949
    19461950        case NET_IP_SET_GATEWAY:
    1947                 return ip_set_gateway_req_local(0, IPC_GET_DEVICE(call),
    1948                     IP_GET_GATEWAY(call));
     1951                return ip_set_gateway_req_local(0, IPC_GET_DEVICE(*call),
     1952                    IP_GET_GATEWAY(*call));
    19491953
    19501954        case NET_IP_GET_ROUTE:
     
    19541958                        return rc;
    19551959               
    1956                 rc = ip_get_route_req_local(0, IP_GET_PROTOCOL(call), addr,
     1960                rc = ip_get_route_req_local(0, IP_GET_PROTOCOL(*call), addr,
    19571961                    (socklen_t) addrlen, &device_id, &header, &headerlen);
    19581962                if (rc != EOK)
    19591963                        return rc;
    19601964               
    1961                 IPC_SET_DEVICE(answer, device_id);
    1962                 IP_SET_HEADERLEN(answer, headerlen);
     1965                IPC_SET_DEVICE(*answer, device_id);
     1966                IP_SET_HEADERLEN(*answer, headerlen);
    19631967               
    19641968                *answer_count = 2;
     
    19721976       
    19731977        case NET_IL_PACKET_SPACE:
    1974                 rc = ip_packet_size_message(IPC_GET_DEVICE(call), &addrlen,
     1978                rc = ip_packet_size_message(IPC_GET_DEVICE(*call), &addrlen,
    19751979                    &prefix, &content, &suffix);
    19761980                if (rc != EOK)
    19771981                        return rc;
    19781982               
    1979                 IPC_SET_ADDR(answer, addrlen);
    1980                 IPC_SET_PREFIX(answer, prefix);
    1981                 IPC_SET_CONTENT(answer, content);
    1982                 IPC_SET_SUFFIX(answer, suffix);
     1983                IPC_SET_ADDR(*answer, addrlen);
     1984                IPC_SET_PREFIX(*answer, prefix);
     1985                IPC_SET_CONTENT(*answer, content);
     1986                IPC_SET_SUFFIX(*answer, suffix);
    19831987                *answer_count = 4;
    19841988                return EOK;
    19851989       
    19861990        case NET_IL_MTU_CHANGED:
    1987                 return ip_mtu_changed_message(IPC_GET_DEVICE(call),
    1988                     IPC_GET_MTU(call));
     1991                return ip_mtu_changed_message(IPC_GET_DEVICE(*call),
     1992                    IPC_GET_MTU(*call));
    19891993        }
    19901994       
     
    20072011        while (true) {
    20082012                ipc_call_t answer;
    2009                 int answer_count;
     2013                size_t count;
    20102014               
    20112015                /* Clear the answer structure */
    2012                 refresh_answer(&answer, &answer_count);
     2016                refresh_answer(&answer, &count);
    20132017               
    20142018                /* Fetch the next message */
     
    20182022                /* Process the message */
    20192023                int res = il_module_message_standalone(callid, &call, &answer,
    2020                     &answer_count);
     2024                    &count);
    20212025               
    20222026                /*
     
    20302034               
    20312035                /* Answer the message */
    2032                 answer_call(callid, res, &answer, answer_count);
     2036                answer_call(callid, res, &answer, count);
    20332037        }
    20342038}
  • uspace/srv/net/il/ip/ip_module.c

    r3c106e88 r774e6d1a  
    5959int
    6060il_module_message_standalone(ipc_callid_t callid, ipc_call_t *call,
    61     ipc_call_t *answer, int *answer_count)
     61    ipc_call_t *answer, size_t *count)
    6262{
    63         return ip_message_standalone(callid, call, answer, answer_count);
     63        return ip_message_standalone(callid, call, answer, count);
    6464}
    6565
  • uspace/srv/net/il/ip/ip_module.h

    r3c106e88 r774e6d1a  
    4343extern int ip_initialize(async_client_conn_t);
    4444extern int ip_message_standalone(ipc_callid_t, ipc_call_t *, ipc_call_t *,
    45     int *);
     45    size_t *);
    4646
    4747#endif
  • uspace/srv/net/net/net.c

    r3c106e88 r774e6d1a  
    474474       
    475475        setting = measured_strings_find(&netif->configuration, (uint8_t *) CONF_IO, 0);
    476         int io = setting ? strtol((char *) setting->value, NULL, 16) : 0;
    477        
    478         rc = netif_probe_req_remote(netif->driver->phone, netif->id, irq, io);
     476        uintptr_t io = setting ? strtol((char *) setting->value, NULL, 16) : 0;
     477       
     478        rc = netif_probe_req(netif->driver->phone, netif->id, irq, (void *) io);
    479479        if (rc != EOK)
    480480                return rc;
     
    511511        }
    512512       
    513         return netif_start_req_remote(netif->driver->phone, netif->id);
     513        return netif_start_req(netif->driver->phone, netif->id);
    514514}
    515515
     
    613613/** Process the networking message.
    614614 *
    615  * @param[in] callid        The message identifier.
    616  * @param[in] call          The message parameters.
     615 * @param[in]  callid       The message identifier.
     616 * @param[in]  call         The message parameters.
    617617 * @param[out] answer       The message answer parameters.
    618618 * @param[out] answer_count The last parameter for the actual answer
     
    627627 */
    628628int net_message(ipc_callid_t callid, ipc_call_t *call, ipc_call_t *answer,
    629     int *answer_count)
     629    size_t *answer_count)
    630630{
    631631        measured_string_t *strings;
     
    639639        case NET_NET_GET_DEVICE_CONF:
    640640                rc = measured_strings_receive(&strings, &data,
    641                     IPC_GET_COUNT(call));
     641                    IPC_GET_COUNT(*call));
    642642                if (rc != EOK)
    643643                        return rc;
    644                 net_get_device_conf_req(0, IPC_GET_DEVICE(call), &strings,
    645                     IPC_GET_COUNT(call), NULL);
     644                net_get_device_conf_req(0, IPC_GET_DEVICE(*call), &strings,
     645                    IPC_GET_COUNT(*call), NULL);
    646646               
    647647                /* Strings should not contain received data anymore */
    648648                free(data);
    649649               
    650                 rc = measured_strings_reply(strings, IPC_GET_COUNT(call));
     650                rc = measured_strings_reply(strings, IPC_GET_COUNT(*call));
    651651                free(strings);
    652652                return rc;
    653653        case NET_NET_GET_CONF:
    654654                rc = measured_strings_receive(&strings, &data,
    655                     IPC_GET_COUNT(call));
     655                    IPC_GET_COUNT(*call));
    656656                if (rc != EOK)
    657657                        return rc;
    658                 net_get_conf_req(0, &strings, IPC_GET_COUNT(call), NULL);
     658                net_get_conf_req(0, &strings, IPC_GET_COUNT(*call), NULL);
    659659               
    660660                /* Strings should not contain received data anymore */
    661661                free(data);
    662662               
    663                 rc = measured_strings_reply(strings, IPC_GET_COUNT(call));
     663                rc = measured_strings_reply(strings, IPC_GET_COUNT(*call));
    664664                free(strings);
    665665                return rc;
     
    688688                /* Clear the answer structure */
    689689                ipc_call_t answer;
    690                 int answer_count;
     690                size_t answer_count;
    691691                refresh_answer(&answer, &answer_count);
    692692               
  • uspace/srv/net/net/net.h

    r3c106e88 r774e6d1a  
    135135extern int add_configuration(measured_strings_t *, const uint8_t *,
    136136    const uint8_t *);
    137 extern int net_module_message(ipc_callid_t, ipc_call_t *, ipc_call_t *, int *);
     137extern int net_module_message(ipc_callid_t, ipc_call_t *, ipc_call_t *, size_t *);
    138138extern int net_initialize_build(async_client_conn_t);
    139 extern int net_message(ipc_callid_t, ipc_call_t *, ipc_call_t *, int *);
     139extern int net_message(ipc_callid_t, ipc_call_t *, ipc_call_t *, size_t *);
    140140
    141141#endif
  • uspace/srv/net/net/net_standalone.c

    r3c106e88 r774e6d1a  
    100100 */
    101101int net_module_message(ipc_callid_t callid, ipc_call_t *call,
    102     ipc_call_t *answer, int *answer_count)
     102    ipc_call_t *answer, size_t *count)
    103103{
    104         if (IS_NET_PACKET_MESSAGE(call))
    105                 return packet_server_message(callid, call, answer, answer_count);
     104        if (IS_NET_PACKET_MESSAGE(*call))
     105                return packet_server_message(callid, call, answer, count);
    106106       
    107         return net_message(callid, call, answer, answer_count);
     107        return net_message(callid, call, answer, count);
    108108}
    109109
  • uspace/srv/net/netif/lo/lo.c

    r3c106e88 r774e6d1a  
    4949#include <net/device.h>
    5050#include <nil_interface.h>
    51 #include <netif_interface.h>
    52 #include <netif_local.h>
     51#include <netif_skel.h>
    5352
    5453/** Default hardware address. */
     
    6564
    6665int netif_specific_message(ipc_callid_t callid, ipc_call_t *call,
    67     ipc_call_t *answer, int *answer_count)
     66    ipc_call_t *answer, size_t *count)
    6867{
    6968        return ENOTSUP;
     
    172171}
    173172
    174 int netif_probe_message(device_id_t device_id, int irq, uintptr_t io)
     173int netif_probe_message(device_id_t device_id, int irq, void *io)
    175174{
    176175        netif_device_t *device;
     
    233232}
    234233
    235 /** Default thread for new connections.
    236  *
    237  * @param[in] iid       The initial message identifier.
    238  * @param[in] icall     The initial message call structure.
    239  */
    240 static void netif_client_connection(ipc_callid_t iid, ipc_call_t *icall)
    241 {
    242         /*
    243          * Accept the connection
    244          *  - Answer the first IPC_M_CONNECT_ME_TO call.
    245          */
    246         ipc_answer_0(iid, EOK);
    247        
    248         while (true) {
    249                 ipc_call_t answer;
    250                 int answer_count;
    251                
    252                 /* Clear the answer structure */
    253                 refresh_answer(&answer, &answer_count);
    254                
    255                 /* Fetch the next message */
    256                 ipc_call_t call;
    257                 ipc_callid_t callid = async_get_call(&call);
    258                
    259                 /* Process the message */
    260                 int res = netif_module_message(NAME, callid, &call, &answer,
    261                     &answer_count);
    262                
    263                 /*
    264                  * End if told to either by the message or the processing
    265                  * result.
    266                  */
    267                 if ((IPC_GET_IMETHOD(call) == IPC_M_PHONE_HUNGUP) ||
    268                     (res == EHANGUP))
    269                         return;
    270                
    271                 /* Answer the message */
    272                 answer_call(callid, res, &answer, answer_count);
    273         }
    274 }
    275 
    276234int main(int argc, char *argv[])
    277235{
    278         int rc;
    279        
    280236        /* Start the module */
    281         rc = netif_module_start(netif_client_connection);
    282         return rc;
     237        return netif_module_start();
    283238}
    284239
  • uspace/srv/net/nil/eth/eth.c

    r3c106e88 r774e6d1a  
    5454#include <protocol_map.h>
    5555#include <net/device.h>
    56 #include <netif_interface.h>
     56#include <netif_remote.h>
    5757#include <net_interface.h>
    5858#include <nil_interface.h>
     
    239239                switch (IPC_GET_IMETHOD(*icall)) {
    240240                case NET_NIL_DEVICE_STATE:
    241                         nil_device_state_msg_local(0, IPC_GET_DEVICE(icall),
    242                             IPC_GET_STATE(icall));
     241                        nil_device_state_msg_local(0, IPC_GET_DEVICE(*icall),
     242                            IPC_GET_STATE(*icall));
    243243                        ipc_answer_0(iid, EOK);
    244244                        break;
    245245                case NET_NIL_RECEIVED:
    246246                        rc = packet_translate_remote(eth_globals.net_phone,
    247                             &packet, IPC_GET_PACKET(icall));
     247                            &packet, IPC_GET_PACKET(*icall));
    248248                        if (rc == EOK) {
    249249                                rc = nil_received_msg_local(0,
    250                                     IPC_GET_DEVICE(icall), packet, 0);
     250                                    IPC_GET_DEVICE(*icall), packet, 0);
    251251                        }
    252252                        ipc_answer_0(iid, (sysarg_t) rc);
     
    837837
    838838int nil_message_standalone(const char *name, ipc_callid_t callid,
    839     ipc_call_t *call, ipc_call_t *answer, int *answer_count)
     839    ipc_call_t *call, ipc_call_t *answer, size_t *answer_count)
    840840{
    841841        measured_string_t *address;
     
    853853       
    854854        case NET_NIL_DEVICE:
    855                 return eth_device_message(IPC_GET_DEVICE(call),
    856                     IPC_GET_SERVICE(call), IPC_GET_MTU(call));
     855                return eth_device_message(IPC_GET_DEVICE(*call),
     856                    IPC_GET_SERVICE(*call), IPC_GET_MTU(*call));
    857857        case NET_NIL_SEND:
    858858                rc = packet_translate_remote(eth_globals.net_phone, &packet,
    859                     IPC_GET_PACKET(call));
     859                    IPC_GET_PACKET(*call));
    860860                if (rc != EOK)
    861861                        return rc;
    862                 return eth_send_message(IPC_GET_DEVICE(call), packet,
    863                     IPC_GET_SERVICE(call));
     862                return eth_send_message(IPC_GET_DEVICE(*call), packet,
     863                    IPC_GET_SERVICE(*call));
    864864        case NET_NIL_PACKET_SPACE:
    865                 rc = eth_packet_space_message(IPC_GET_DEVICE(call), &addrlen,
     865                rc = eth_packet_space_message(IPC_GET_DEVICE(*call), &addrlen,
    866866                    &prefix, &content, &suffix);
    867867                if (rc != EOK)
    868868                        return rc;
    869                 IPC_SET_ADDR(answer, addrlen);
    870                 IPC_SET_PREFIX(answer, prefix);
    871                 IPC_SET_CONTENT(answer, content);
    872                 IPC_SET_SUFFIX(answer, suffix);
     869                IPC_SET_ADDR(*answer, addrlen);
     870                IPC_SET_PREFIX(*answer, prefix);
     871                IPC_SET_CONTENT(*answer, content);
     872                IPC_SET_SUFFIX(*answer, suffix);
    873873                *answer_count = 4;
    874874                return EOK;
    875875        case NET_NIL_ADDR:
    876                 rc = eth_addr_message(IPC_GET_DEVICE(call), ETH_LOCAL_ADDR,
     876                rc = eth_addr_message(IPC_GET_DEVICE(*call), ETH_LOCAL_ADDR,
    877877                    &address);
    878878                if (rc != EOK)
     
    880880                return measured_strings_reply(address, 1);
    881881        case NET_NIL_BROADCAST_ADDR:
    882                 rc = eth_addr_message(IPC_GET_DEVICE(call), ETH_BROADCAST_ADDR,
     882                rc = eth_addr_message(IPC_GET_DEVICE(*call), ETH_BROADCAST_ADDR,
    883883                    &address);
    884884                if (rc != EOK)
     
    886886                return measured_strings_reply(address, 1);
    887887        case IPC_M_CONNECT_TO_ME:
    888                 return eth_register_message(NIL_GET_PROTO(call),
    889                     IPC_GET_PHONE(call));
     888                return eth_register_message(NIL_GET_PROTO(*call),
     889                    IPC_GET_PHONE(*call));
    890890        }
    891891       
     
    908908        while (true) {
    909909                ipc_call_t answer;
    910                 int answer_count;
     910                size_t count;
    911911               
    912912                /* Clear the answer structure */
    913                 refresh_answer(&answer, &answer_count);
     913                refresh_answer(&answer, &count);
    914914               
    915915                /* Fetch the next message */
     
    919919                /* Process the message */
    920920                int res = nil_module_message_standalone(NAME, callid, &call,
    921                     &answer, &answer_count);
     921                    &answer, &count);
    922922               
    923923                /*
     
    930930               
    931931                /* Answer the message */
    932                 answer_call(callid, res, &answer, answer_count);
     932                answer_call(callid, res, &answer, count);
    933933        }
    934934}
  • uspace/srv/net/nil/eth/eth_header.h

    r3c106e88 r774e6d1a  
    4242
    4343/** Ethernet address length. */
    44 #define ETH_ADDR        6
     44#define ETH_ADDR  6
    4545
    4646/** Ethernet header preamble value. */
    47 #define ETH_PREAMBLE    0x55
     47#define ETH_PREAMBLE  0x55
    4848
    4949/** Ethernet header start of frame value. */
    50 #define ETH_SFD         0xD5
     50#define ETH_SFD  0xD5
    5151
    5252/** IEEE 802.2 unordered information control field. */
    53 #define IEEE_8023_2_UI  0x03
     53#define IEEE_8023_2_UI  0x03
    5454
    5555/** Type definition of the Ethernet header IEEE 802.3 + 802.2 + SNAP extensions.
  • uspace/srv/net/nil/eth/eth_module.c

    r3c106e88 r774e6d1a  
    7878
    7979int nil_module_message_standalone(const char *name, ipc_callid_t callid,
    80     ipc_call_t *call, ipc_call_t *answer, int *answer_count)
     80    ipc_call_t *call, ipc_call_t *answer, size_t *count)
    8181{
    82         return nil_message_standalone(name, callid, call, answer, answer_count);
     82        return nil_message_standalone(name, callid, call, answer, count);
    8383}
    8484
  • uspace/srv/net/nil/nildummy/nildummy.c

    r3c106e88 r774e6d1a  
    4747#include <net/modules.h>
    4848#include <net/device.h>
    49 #include <netif_interface.h>
    5049#include <nil_interface.h>
    5150#include <il_interface.h>
     
    5352#include <net/packet.h>
    5453#include <packet_remote.h>
     54#include <netif_remote.h>
    5555#include <nil_local.h>
    5656
     
    113113                case NET_NIL_DEVICE_STATE:
    114114                        rc = nil_device_state_msg_local(0,
    115                             IPC_GET_DEVICE(icall), IPC_GET_STATE(icall));
     115                            IPC_GET_DEVICE(*icall), IPC_GET_STATE(*icall));
    116116                        ipc_answer_0(iid, (sysarg_t) rc);
    117117                        break;
     
    119119                case NET_NIL_RECEIVED:
    120120                        rc = packet_translate_remote(nildummy_globals.net_phone,
    121                             &packet, IPC_GET_PACKET(icall));
     121                            &packet, IPC_GET_PACKET(*icall));
    122122                        if (rc == EOK) {
    123123                                rc = nil_received_msg_local(0,
    124                                     IPC_GET_DEVICE(icall), packet, 0);
     124                                    IPC_GET_DEVICE(*icall), packet, 0);
    125125                        }
    126126                        ipc_answer_0(iid, (sysarg_t) rc);
     
    375375
    376376int nil_message_standalone(const char *name, ipc_callid_t callid,
    377     ipc_call_t *call, ipc_call_t *answer, int *answer_count)
     377    ipc_call_t *call, ipc_call_t *answer, size_t *answer_count)
    378378{
    379379        measured_string_t *address;
     
    391391       
    392392        case NET_NIL_DEVICE:
    393                 return nildummy_device_message(IPC_GET_DEVICE(call),
    394                     IPC_GET_SERVICE(call), IPC_GET_MTU(call));
     393                return nildummy_device_message(IPC_GET_DEVICE(*call),
     394                    IPC_GET_SERVICE(*call), IPC_GET_MTU(*call));
    395395       
    396396        case NET_NIL_SEND:
    397397                rc = packet_translate_remote(nildummy_globals.net_phone,
    398                     &packet, IPC_GET_PACKET(call));
     398                    &packet, IPC_GET_PACKET(*call));
    399399                if (rc != EOK)
    400400                        return rc;
    401                 return nildummy_send_message(IPC_GET_DEVICE(call), packet,
    402                     IPC_GET_SERVICE(call));
     401                return nildummy_send_message(IPC_GET_DEVICE(*call), packet,
     402                    IPC_GET_SERVICE(*call));
    403403       
    404404        case NET_NIL_PACKET_SPACE:
    405                 rc = nildummy_packet_space_message(IPC_GET_DEVICE(call),
     405                rc = nildummy_packet_space_message(IPC_GET_DEVICE(*call),
    406406                    &addrlen, &prefix, &content, &suffix);
    407407                if (rc != EOK)
    408408                        return rc;
    409                 IPC_SET_ADDR(answer, addrlen);
    410                 IPC_SET_PREFIX(answer, prefix);
    411                 IPC_SET_CONTENT(answer, content);
    412                 IPC_SET_SUFFIX(answer, suffix);
     409                IPC_SET_ADDR(*answer, addrlen);
     410                IPC_SET_PREFIX(*answer, prefix);
     411                IPC_SET_CONTENT(*answer, content);
     412                IPC_SET_SUFFIX(*answer, suffix);
    413413                *answer_count = 4;
    414414                return EOK;
    415415       
    416416        case NET_NIL_ADDR:
    417                 rc = nildummy_addr_message(IPC_GET_DEVICE(call), &address);
     417                rc = nildummy_addr_message(IPC_GET_DEVICE(*call), &address);
    418418                if (rc != EOK)
    419419                        return rc;
     
    421421       
    422422        case NET_NIL_BROADCAST_ADDR:
    423                 rc = nildummy_addr_message(IPC_GET_DEVICE(call), &address);
     423                rc = nildummy_addr_message(IPC_GET_DEVICE(*call), &address);
    424424                if (rc != EOK)
    425425                        return rc;
     
    427427       
    428428        case IPC_M_CONNECT_TO_ME:
    429                 return nildummy_register_message(NIL_GET_PROTO(call),
    430                     IPC_GET_PHONE(call));
     429                return nildummy_register_message(NIL_GET_PROTO(*call),
     430                    IPC_GET_PHONE(*call));
    431431        }
    432432       
     
    449449        while (true) {
    450450                ipc_call_t answer;
    451                 int answer_count;
     451                size_t count;
    452452               
    453453                /* Clear the answer structure */
    454                 refresh_answer(&answer, &answer_count);
     454                refresh_answer(&answer, &count);
    455455               
    456456                /* Fetch the next message */
     
    460460                /* Process the message */
    461461                int res = nil_module_message_standalone(NAME, callid, &call,
    462                     &answer, &answer_count);
     462                    &answer, &count);
    463463               
    464464                /*
     
    471471               
    472472                /* Answer the message */
    473                 answer_call(callid, res, &answer, answer_count);
     473                answer_call(callid, res, &answer, count);
    474474        }
    475475}
  • uspace/srv/net/nil/nildummy/nildummy_module.c

    r3c106e88 r774e6d1a  
    7979
    8080int nil_module_message_standalone(const char *name, ipc_callid_t callid,
    81     ipc_call_t *call, ipc_call_t *answer, int *answer_count)
     81    ipc_call_t *call, ipc_call_t *answer, size_t *count)
    8282{
    83         return nil_message_standalone(name, callid, call, answer, answer_count);
     83        return nil_message_standalone(name, callid, call, answer, count);
    8484}
    8585
  • uspace/srv/net/tl/icmp/icmp.c

    r3c106e88 r774e6d1a  
    696696        case NET_ICMP_DEST_UNREACH:
    697697                rc = packet_translate_remote(icmp_globals.net_phone, &packet,
    698                     IPC_GET_PACKET(call));
     698                    IPC_GET_PACKET(*call));
    699699                if (rc != EOK)
    700700                        return rc;
    701701                return icmp_destination_unreachable_msg_local(0,
    702                     ICMP_GET_CODE(call), ICMP_GET_MTU(call), packet);
     702                    ICMP_GET_CODE(*call), ICMP_GET_MTU(*call), packet);
    703703        case NET_ICMP_SOURCE_QUENCH:
    704704                rc = packet_translate_remote(icmp_globals.net_phone, &packet,
    705                     IPC_GET_PACKET(call));
     705                    IPC_GET_PACKET(*call));
    706706                if (rc != EOK)
    707707                        return rc;
     
    709709        case NET_ICMP_TIME_EXCEEDED:
    710710                rc = packet_translate_remote(icmp_globals.net_phone, &packet,
    711                     IPC_GET_PACKET(call));
     711                    IPC_GET_PACKET(*call));
    712712                if (rc != EOK)
    713713                        return rc;
    714                 return icmp_time_exceeded_msg_local(0, ICMP_GET_CODE(call),
     714                return icmp_time_exceeded_msg_local(0, ICMP_GET_CODE(*call),
    715715                    packet);
    716716        case NET_ICMP_PARAMETERPROB:
    717717                rc = packet_translate_remote(icmp_globals.net_phone, &packet,
    718                     IPC_GET_PACKET(call));
     718                    IPC_GET_PACKET(*call));
    719719                if (rc != EOK)
    720720                        return rc;
    721                 return icmp_parameter_problem_msg_local(0, ICMP_GET_CODE(call),
    722                     ICMP_GET_POINTER(call), packet);
     721                return icmp_parameter_problem_msg_local(0, ICMP_GET_CODE(*call),
     722                    ICMP_GET_POINTER(*call), packet);
    723723        default:
    724724                return ENOTSUP;
     
    787787        bool keep_on_going = true;
    788788        ipc_call_t answer;
    789         int answer_count;
     789        size_t answer_count;
    790790        size_t length;
    791791        struct sockaddr *addr;
     
    894894 */
    895895int icmp_message_standalone(ipc_callid_t callid, ipc_call_t *call,
    896     ipc_call_t *answer, int *answer_count)
     896    ipc_call_t *answer, size_t *answer_count)
    897897{
    898898        packet_t *packet;
     
    903903        case NET_TL_RECEIVED:
    904904                rc = packet_translate_remote(icmp_globals.net_phone, &packet,
    905                     IPC_GET_PACKET(call));
     905                    IPC_GET_PACKET(*call));
    906906                if (rc != EOK)
    907907                        return rc;
    908                 return icmp_received_msg_local(IPC_GET_DEVICE(call), packet,
    909                     SERVICE_ICMP, IPC_GET_ERROR(call));
     908                return icmp_received_msg_local(IPC_GET_DEVICE(*call), packet,
     909                    SERVICE_ICMP, IPC_GET_ERROR(*call));
    910910       
    911911        case NET_ICMP_INIT:
    912                 return icmp_process_client_messages(callid, * call);
     912                return icmp_process_client_messages(callid, *call);
    913913       
    914914        default:
     
    936936        while (true) {
    937937                ipc_call_t answer;
    938                 int answer_count;
     938                size_t answer_count;
    939939               
    940940                /* Clear the answer structure */
  • uspace/srv/net/tl/icmp/icmp_module.c

    r3c106e88 r774e6d1a  
    8686
    8787int tl_module_message_standalone(ipc_callid_t callid, ipc_call_t *call,
    88     ipc_call_t *answer, int *answer_count)
     88    ipc_call_t *answer, size_t *count)
    8989{
    90         return icmp_message_standalone(callid, call, answer, answer_count);
     90        return icmp_message_standalone(callid, call, answer, count);
    9191}
    9292
  • uspace/srv/net/tl/icmp/icmp_module.h

    r3c106e88 r774e6d1a  
    4444extern int icmp_initialize(async_client_conn_t);
    4545extern int icmp_message_standalone(ipc_callid_t, ipc_call_t *, ipc_call_t *,
    46     int *);
     46    size_t *);
    4747
    4848#endif
  • uspace/srv/net/tl/tcp/tcp.c

    r3c106e88 r774e6d1a  
    12621262int
    12631263tcp_message_standalone(ipc_callid_t callid, ipc_call_t *call,
    1264     ipc_call_t *answer, int *answer_count)
     1264    ipc_call_t *answer, size_t *answer_count)
    12651265{
    12661266        packet_t *packet;
     
    12761276//              fibril_rwlock_read_lock(&tcp_globals.lock);
    12771277                rc = packet_translate_remote(tcp_globals.net_phone, &packet,
    1278                     IPC_GET_PACKET(call));
     1278                    IPC_GET_PACKET(*call));
    12791279                if (rc != EOK) {
    12801280//                      fibril_rwlock_read_unlock(&tcp_globals.lock);
    12811281                        return rc;
    12821282                }
    1283                 rc = tcp_received_msg(IPC_GET_DEVICE(call), packet, SERVICE_TCP,
    1284                     IPC_GET_ERROR(call));
     1283                rc = tcp_received_msg(IPC_GET_DEVICE(*call), packet, SERVICE_TCP,
     1284                    IPC_GET_ERROR(*call));
    12851285//              fibril_rwlock_read_unlock(&tcp_globals.lock);
    12861286                return rc;
     
    13231323        bool keep_on_going = true;
    13241324        socket_cores_t local_sockets;
    1325         int app_phone = IPC_GET_PHONE(&call);
     1325        int app_phone = IPC_GET_PHONE(call);
    13261326        struct sockaddr *addr;
    13271327        int socket_id;
     
    13301330        fibril_rwlock_t lock;
    13311331        ipc_call_t answer;
    1332         int answer_count;
     1332        size_t answer_count;
    13331333        tcp_socket_data_t *socket_data;
    13341334        socket_core_t *socket;
     
    25022502        while (true) {
    25032503                ipc_call_t answer;
    2504                 int answer_count;
     2504                size_t answer_count;
    25052505
    25062506                /* Clear the answer structure */
  • uspace/srv/net/tl/tcp/tcp_module.c

    r3c106e88 r774e6d1a  
    8787
    8888int tl_module_message_standalone(ipc_callid_t callid, ipc_call_t *call,
    89     ipc_call_t *answer, int *answer_count)
     89    ipc_call_t *answer, size_t *count)
    9090{
    91         return tcp_message_standalone(callid, call, answer, answer_count);
     91        return tcp_message_standalone(callid, call, answer, count);
    9292}
    9393
  • uspace/srv/net/tl/tcp/tcp_module.h

    r3c106e88 r774e6d1a  
    4444extern int tcp_initialize(async_client_conn_t);
    4545extern int tcp_message_standalone(ipc_callid_t, ipc_call_t *, ipc_call_t *,
    46     int *);
     46    size_t *);
    4747
    4848#endif
  • uspace/srv/net/tl/udp/udp.c

    r3c106e88 r774e6d1a  
    707707        bool keep_on_going = true;
    708708        socket_cores_t local_sockets;
    709         int app_phone = IPC_GET_PHONE(&call);
     709        int app_phone = IPC_GET_PHONE(call);
    710710        struct sockaddr *addr;
    711711        int socket_id;
     
    713713        size_t size;
    714714        ipc_call_t answer;
    715         int answer_count;
     715        size_t answer_count;
    716716        packet_dimension_t *packet_dimension;
    717717
     
    861861 */
    862862int udp_message_standalone(ipc_callid_t callid, ipc_call_t *call,
    863     ipc_call_t *answer, int *answer_count)
     863    ipc_call_t *answer, size_t *answer_count)
    864864{
    865865        packet_t *packet;
     
    871871        case NET_TL_RECEIVED:
    872872                rc = packet_translate_remote(udp_globals.net_phone, &packet,
    873                     IPC_GET_PACKET(call));
     873                    IPC_GET_PACKET(*call));
    874874                if (rc != EOK)
    875875                        return rc;
    876                 return udp_received_msg(IPC_GET_DEVICE(call), packet,
    877                     SERVICE_UDP, IPC_GET_ERROR(call));
     876                return udp_received_msg(IPC_GET_DEVICE(*call), packet,
     877                    SERVICE_UDP, IPC_GET_ERROR(*call));
    878878        case IPC_M_CONNECT_TO_ME:
    879                 return udp_process_client_messages(callid, * call);
     879                return udp_process_client_messages(callid, *call);
    880880        }
    881881
     
    898898        while (true) {
    899899                ipc_call_t answer;
    900                 int answer_count;
     900                size_t answer_count;
    901901               
    902902                /* Clear the answer structure */
  • uspace/srv/net/tl/udp/udp_module.c

    r3c106e88 r774e6d1a  
    8787
    8888int tl_module_message_standalone(ipc_callid_t callid, ipc_call_t *call,
    89     ipc_call_t *answer, int *answer_count)
     89    ipc_call_t *answer, size_t *count)
    9090{
    91         return udp_message_standalone(callid, call, answer, answer_count);
     91        return udp_message_standalone(callid, call, answer, count);
    9292}
    9393
  • uspace/srv/net/tl/udp/udp_module.h

    r3c106e88 r774e6d1a  
    4444extern int udp_initialize(async_client_conn_t);
    4545extern int udp_message_standalone(ipc_callid_t, ipc_call_t *, ipc_call_t *,
    46     int *);
     46    size_t *);
    4747
    4848#endif
Note: See TracChangeset for help on using the changeset viewer.