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

Changeset 40e29f5 in mainline


Ignore:
Timestamp:
2010-03-24T18:54:50Z (12 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master
Children:
eaf22d4
Parents:
63f8966 (diff), 3db8889 (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 from lp:~lukasmejdrech/helenos/network.

Location:
uspace/srv/net
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/il/arp/arp_messages.h

    r63f8966 r40e29f5  
    7575 *  @param[in] call The message call structure.
    7676 */
    77 #define ARP_GET_NETIF(call)             (services_t) IPC_GET_ARG2(*call)
     77#define ARP_GET_NETIF(call) \
     78        ({services_t service = (services_t) IPC_GET_ARG2(*call); service;})
    7879
    7980/*@}*/
  • uspace/srv/net/il/ip/ip.c

    r63f8966 r40e29f5  
    893893        struct sockaddr * addr;
    894894        size_t addrlen;
     895        size_t prefix;
     896        size_t suffix;
     897        size_t content;
    895898        ip_pseudo_header_ref header;
    896899        size_t headerlen;
     
    924927                        ERROR_PROPAGATE(ip_get_route_req(0, IP_GET_PROTOCOL(call), addr, (socklen_t) addrlen,
    925928                            &device_id, &header, &headerlen));
    926                         *IPC_SET_DEVICE(answer) = device_id;
    927                         *IP_SET_HEADERLEN(answer) = headerlen;
     929                        IPC_SET_DEVICE(answer, device_id);
     930                        IP_SET_HEADERLEN(answer, headerlen);
    928931                        *answer_count = 2;
    929932                        if(! ERROR_OCCURRED(data_reply(&headerlen, sizeof(headerlen)))){
     
    933936                        return ERROR_CODE;
    934937                case NET_IL_PACKET_SPACE:
    935                         ERROR_PROPAGATE(ip_packet_size_message(IPC_GET_DEVICE(call), IPC_SET_ADDR(answer), IPC_SET_PREFIX(answer), IPC_SET_CONTENT(answer), IPC_SET_SUFFIX(answer)));
    936                         *answer_count = 3;
     938                        ERROR_PROPAGATE(ip_packet_size_message(IPC_GET_DEVICE(call), &addrlen, &prefix, &content, &suffix));
     939                        IPC_SET_ADDR(answer, addrlen);
     940                        IPC_SET_PREFIX(answer, prefix);
     941                        IPC_SET_CONTENT(answer, content);
     942                        IPC_SET_SUFFIX(answer, suffix);
     943                        *answer_count = 4;
    937944                        return EOK;
    938945                case NET_IL_MTU_CHANGED:
  • uspace/srv/net/il/ip/ip_messages.h

    r63f8966 r40e29f5  
    7272 *  @param[in] call The message call structure.
    7373 */
    74 #define IP_GET_ADDRESS(call)            ({in_addr_t addr; addr.s_addr = IPC_GET_ARG3(*call); addr;})
     74#define IP_GET_ADDRESS(call) \
     75        ({in_addr_t addr; addr.s_addr = IPC_GET_ARG3(*call); addr;})
    7576
    7677/** Returns the gateway message parameter.
    7778 *  @param[in] call The message call structure.
    7879 */
    79 #define IP_GET_GATEWAY(call)            ({in_addr_t addr; addr.s_addr = IPC_GET_ARG2(*call); addr;})
     80#define IP_GET_GATEWAY(call) \
     81        ({in_addr_t addr; addr.s_addr = IPC_GET_ARG2(*call); addr;})
    8082
    8183/** Sets the header length in the message answer.
    8284 *  @param[out] answer The message answer structure.
    8385 */
    84 #define IP_SET_HEADERLEN(answer)        (&IPC_GET_ARG2(*answer))
     86#define IP_SET_HEADERLEN(answer, value) \
     87        {ipcarg_t argument = (ipcarg_t) (value); IPC_SET_ARG2(*answer, argument);}
    8588
    8689/** Returns the network mask message parameter.
    8790 *  @param[in] call The message call structure.
    8891 */
    89 #define IP_GET_NETMASK(call)            ({in_addr_t addr; addr.s_addr = IPC_GET_ARG4(*call); addr;})
     92#define IP_GET_NETMASK(call) \
     93        ({in_addr_t addr; addr.s_addr = IPC_GET_ARG4(*call); addr;})
    9094
    9195/** Returns the protocol message parameter.
    9296 *  @param[in] call The message call structure.
    9397 */
    94 #define IP_GET_PROTOCOL(call)           ((ip_protocol_t) IPC_GET_ARG1(*call))
     98#define IP_GET_PROTOCOL(call) \
     99        ({ip_protocol_t protocol = (ip_protocol_t) IPC_GET_ARG1(*call); protocol;})
    95100
    96101/*@}*/
  • uspace/srv/net/messages.h

    r63f8966 r40e29f5  
    236236 *  @param[in] call The IPC call to be checked.
    237237 */
    238 #define IS_NET_MESSAGE(call)                    IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_FIRST, NET_LAST)
     238#define IS_NET_MESSAGE(call) \
     239        IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_FIRST, NET_LAST)
    239240
    240241/** Returns a value indicating whether the IPC call is an ARP message.
    241242 *  @param[in] call The IPC call to be checked.
    242243 */
    243 #define IS_NET_ARP_MESSAGE(call)                IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_ARP_FIRST, NET_ARP_LAST)
     244#define IS_NET_ARP_MESSAGE(call) \
     245        IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_ARP_FIRST, NET_ARP_LAST)
    244246
    245247/** Returns a value indicating whether the IPC call is an Ethernet message.
    246248 *  @param[in] call The IPC call to be checked.
    247249 */
    248 #define IS_NET_ETH_MESSAGE(call)                IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_ETH_FIRST, NET_ETH_LAST)
     250#define IS_NET_ETH_MESSAGE(call) \
     251        IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_ETH_FIRST, NET_ETH_LAST)
    249252
    250253/** Returns a value indicating whether the IPC call is an ICMP message.
    251254 *  @param[in] call The IPC call to be checked.
    252255 */
    253 #define IS_NET_ICMP_MESSAGE(call)               IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_ICMP_FIRST, NET_ICMP_LAST)
     256#define IS_NET_ICMP_MESSAGE(call) \
     257        IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_ICMP_FIRST, NET_ICMP_LAST)
    254258
    255259/** Returns a value indicating whether the IPC call is an inter-network layer message.
    256260 *  @param[in] call The IPC call to be checked.
    257261 */
    258 #define IS_NET_IL_MESSAGE(call)         IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_IL_FIRST, NET_IL_LAST)
     262#define IS_NET_IL_MESSAGE(call) \
     263        IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_IL_FIRST, NET_IL_LAST)
    259264
    260265/** Returns a value indicating whether the IPC call is an IP message.
    261266 *  @param[in] call The IPC call to be checked.
    262267 */
    263 #define IS_NET_IP_MESSAGE(call)         IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_IP_FIRST, NET_IP_LAST)
     268#define IS_NET_IP_MESSAGE(call) \
     269        IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_IP_FIRST, NET_IP_LAST)
    264270
    265271/** Returns a value indicating whether the IPC call is a generic networking message.
    266272 *  @param[in] call The IPC call to be checked.
    267273 */
    268 #define IS_NET_NET_MESSAGE(call)                IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_NET_FIRST, NET_NET_LAST)
     274#define IS_NET_NET_MESSAGE(call) \
     275        IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_NET_FIRST, NET_NET_LAST)
    269276
    270277/** Returns a value indicating whether the IPC call is a network interface layer message.
    271278 *  @param[in] call The IPC call to be checked.
    272279 */
    273 #define IS_NET_NIL_MESSAGE(call)                IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_NIL_FIRST, NET_NIL_LAST)
     280#define IS_NET_NIL_MESSAGE(call) \
     281        IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_NIL_FIRST, NET_NIL_LAST)
    274282
    275283/** Returns a value indicating whether the IPC call is a packet manaagement system message.
    276284 *  @param[in] call The IPC call to be checked.
    277285 */
    278 #define IS_NET_PACKET_MESSAGE(call)     IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_PACKET_FIRST, NET_PACKET_LAST)
     286#define IS_NET_PACKET_MESSAGE(call) \
     287        IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_PACKET_FIRST, NET_PACKET_LAST)
    279288
    280289/** Returns a value indicating whether the IPC call is a socket message.
    281290 *  @param[in] call The IPC call to be checked.
    282291 */
    283 #define IS_NET_SOCKET_MESSAGE(call)     IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_SOCKET_FIRST, NET_SOCKET_LAST)
     292#define IS_NET_SOCKET_MESSAGE(call) \
     293        IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_SOCKET_FIRST, NET_SOCKET_LAST)
    284294
    285295/** Returns a value indicating whether the IPC call is a TCP message.
    286296 *  @param[in] call The IPC call to be checked.
    287297 */
    288 #define IS_NET_TCP_MESSAGE(call)                IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_TCP_FIRST, NET_TCP_LAST)
     298#define IS_NET_TCP_MESSAGE(call) \
     299        IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_TCP_FIRST, NET_TCP_LAST)
    289300
    290301/** Returns a value indicating whether the IPC call is a transport layer message.
    291302 *  @param[in] call The IPC call to be checked.
    292303 */
    293 #define IS_NET_TL_MESSAGE(call)         IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_TL_FIRST, NET_TL_LAST)
     304#define IS_NET_TL_MESSAGE(call) \
     305        IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_TL_FIRST, NET_TL_LAST)
    294306
    295307/** Returns a value indicating whether the IPC call is a UDP message.
    296308 *  @param[in] call The IPC call to be checked.
    297309 */
    298 #define IS_NET_UDP_MESSAGE(call)                IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_UDP_FIRST, NET_UDP_LAST)
     310#define IS_NET_UDP_MESSAGE(call) \
     311        IS_IN_INTERVAL(IPC_GET_METHOD(*call), NET_UDP_FIRST, NET_UDP_LAST)
    299312
    300313/*@}*/
     
    311324 *  @param[in] call The message call structure.
    312325 */
    313 #define IPC_GET_DEVICE(call)            (device_id_t) IPC_GET_ARG1(*call)
    314 
    315 /*@}*/
     326#define IPC_GET_DEVICE(call) \
     327        ({device_id_t device_id = (device_id_t) IPC_GET_ARG1(*call); device_id;})
     328
     329/*@;})*/
    316330
    317331/** @name Second arguments
    318332 */
    319 /*@{*/
     333/*@({*/
    320334
    321335/** Returns the packet identifier message argument.
    322336 *  @param[in] call The message call structure.
    323337 */
    324 #define IPC_GET_PACKET(call)            (packet_id_t) IPC_GET_ARG2(*call)
     338#define IPC_GET_PACKET(call) \
     339        ({packet_id_t packet_id = (packet_id_t) IPC_GET_ARG2(*call); packet_id;})
    325340
    326341/** Returns the count message argument.
    327342 *  @param[in] call The message call structure.
    328343 */
    329 #define IPC_GET_COUNT(call)             (size_t) IPC_GET_ARG2(*call)
     344#define IPC_GET_COUNT(call) \
     345        ({size_t size = (size_t) IPC_GET_ARG2(*call); size;})
    330346
    331347/** Returns the device state message argument.
    332348 *  @param[in] call The message call structure.
    333349 */
    334 #define IPC_GET_STATE(call)             (device_state_t) IPC_GET_ARG2(*call)
     350#define IPC_GET_STATE(call) \
     351        ({device_state_t device_state = (device_state_t) IPC_GET_ARG2(*call); device_state;})
    335352
    336353/** Returns the maximum transmission unit message argument.
    337354 *  @param[in] call The message call structure.
    338355 */
    339 #define IPC_GET_MTU(call)                       (size_t) IPC_GET_ARG2(*call)
    340 
    341 /*@}*/
     356#define IPC_GET_MTU(call) \
     357        ({size_t size = (size_t) IPC_GET_ARG2(*call); size;})
     358
     359/*@;})*/
    342360
    343361/** @name Third arguments
    344362 */
    345 /*@{*/
     363/*@({*/
    346364
    347365/** Returns the device driver service message argument.
    348366 *  @param[in] call The message call structure.
    349367 */
    350 #define IPC_GET_SERVICE(call)           (services_t) IPC_GET_ARG3(*call)
     368 #define IPC_GET_SERVICE(call) \
     369        ({services_t service = (services_t) IPC_GET_ARG3(*call); service;})
    351370
    352371/** Returns the target service message argument.
    353372 *  @param[in] call The message call structure.
    354373 */
    355 #define IPC_GET_TARGET(call)            (services_t) IPC_GET_ARG3(*call)
     374#define IPC_GET_TARGET(call) \
     375        ({services_t service = (services_t) IPC_GET_ARG3(*call); service;})
    356376
    357377/** Returns the sender service message argument.
    358378 *  @param[in] call The message call structure.
    359379 */
    360 #define IPC_GET_SENDER(call)            (services_t) IPC_GET_ARG3(*call)
    361 
    362 /*@}*/
     380#define IPC_GET_SENDER(call) \
     381        ({services_t service = (services_t) IPC_GET_ARG3(*call); service;})
     382
     383/*@;})*/
    363384
    364385/** @name Fourth arguments
    365386 */
    366 /*@{*/
     387/*@({*/
    367388
    368389/** Returns the error service message argument.
    369390 *  @param[in] call The message call structure.
    370391 */
    371 #define IPC_GET_ERROR(call)             (services_t) IPC_GET_ARG4(*call)
    372 
    373 /*@}*/
     392#define IPC_GET_ERROR(call) \
     393        ({services_t service = (services_t) IPC_GET_ARG4(*call); service;})
     394
     395/*@;})*/
    374396
    375397/** @name Fifth arguments
    376398 */
    377 /*@{*/
     399/*@({*/
    378400
    379401/** Returns the phone message argument.
    380402 *  @param[in] call The message call structure.
    381403 */
    382 #define IPC_GET_PHONE(call)             (int) IPC_GET_ARG5(*call)
     404#define IPC_GET_PHONE(call) \
     405        ({int phone = (int) IPC_GET_ARG5(*call); phone;})
    383406
    384407/*@}*/
     
    391414 *  @param[out] answer The message answer structure.
    392415 */
    393 #define IPC_SET_DEVICE(answer)  (&IPC_GET_ARG1(*answer))
     416#define IPC_SET_DEVICE(answer, value) \
     417        {ipcarg_t argument = (ipcarg_t) (value); IPC_SET_ARG1(*answer, argument);}
    394418
    395419/** Sets the minimum address length in the message answer.
    396420 *  @param[out] answer The message answer structure.
    397421 */
    398 #define IPC_SET_ADDR(answer)            (&IPC_GET_ARG1(*answer))
     422#define IPC_SET_ADDR(answer, value) \
     423        {ipcarg_t argument = (ipcarg_t) (value); IPC_SET_ARG1(*answer, argument);}
    399424
    400425/*@}*/
     
    407432 *  @param[out] answer The message answer structure.
    408433 */
    409 #define IPC_SET_PREFIX(answer)  (&IPC_GET_ARG2(*answer))
     434#define IPC_SET_PREFIX(answer, value) \
     435        {ipcarg_t argument = (ipcarg_t) (value); IPC_SET_ARG2(*answer, argument);}
    410436
    411437/*@}*/
     
    418444 *  @param[out] answer The message answer structure.
    419445 */
    420 #define IPC_SET_CONTENT(answer) (&IPC_GET_ARG3(*answer))
     446#define IPC_SET_CONTENT(answer, value) \
     447        {ipcarg_t argument = (ipcarg_t) (value); IPC_SET_ARG3(*answer, argument);}
    421448
    422449/*@}*/
     
    429456 *  @param[out] answer The message answer structure.
    430457 */
    431 #define IPC_SET_SUFFIX(answer)  (&IPC_GET_ARG4(*answer))
     458#define IPC_SET_SUFFIX(answer, value) \
     459        {ipcarg_t argument = (ipcarg_t) (value); IPC_SET_ARG4(*answer, argument);}
    432460
    433461/*@}*/
  • uspace/srv/net/netif/netif_messages.h

    r63f8966 r40e29f5  
    7979 *  @param[in] call The message call structure.
    8080 */
    81 #define NETIF_GET_IRQ(call)             (int)   IPC_GET_ARG2(*call)
     81#define NETIF_GET_IRQ(call) \
     82        ({int irq = (int) IPC_GET_ARG2(*call); irq;})
    8283
    8384/** Returns the input/output address message parameter.
    8485 *  @param[in] call The message call structure.
    8586 */
    86 #define NETIF_GET_IO(call)              (int)   IPC_GET_ARG3(*call)
     87#define NETIF_GET_IO(call) \
     88        ({int io = (int) IPC_GET_ARG3(*call); io;})
    8789
    8890/*@}*/
  • uspace/srv/net/nil/eth/eth.c

    r63f8966 r40e29f5  
    709709        measured_string_ref address;
    710710        packet_t packet;
     711        size_t addrlen;
     712        size_t prefix;
     713        size_t suffix;
     714        size_t content;
    711715
    712716//      printf("message %d - %d\n", IPC_GET_METHOD(*call), NET_NIL_FIRST);
     
    721725                        return eth_send_message(IPC_GET_DEVICE(call), packet, IPC_GET_SERVICE(call));
    722726                case NET_NIL_PACKET_SPACE:
    723                         ERROR_PROPAGATE(eth_packet_space_message(IPC_GET_DEVICE(call), IPC_SET_ADDR(answer), IPC_SET_PREFIX(answer), IPC_SET_CONTENT(answer), IPC_SET_SUFFIX(answer)));
     727                        ERROR_PROPAGATE(eth_packet_space_message(IPC_GET_DEVICE(call), &addrlen, &prefix, &content, &suffix));
     728                        IPC_SET_ADDR(answer, addrlen);
     729                        IPC_SET_PREFIX(answer, prefix);
     730                        IPC_SET_CONTENT(answer, content);
     731                        IPC_SET_SUFFIX(answer, suffix);
    724732                        *answer_count = 4;
    725733                        return EOK;
  • uspace/srv/net/nil/nil_messages.h

    r63f8966 r40e29f5  
    8282/** Returns the protocol service message parameter.
    8383 */
    84 #define NIL_GET_PROTO(call)             (services_t) IPC_GET_ARG2(*call)
     84#define NIL_GET_PROTO(call) \
     85        ({services_t service = (services_t) IPC_GET_ARG2(*call); service;})
    8586
    8687/*@}*/
  • uspace/srv/net/nil/nildummy/nildummy.c

    r63f8966 r40e29f5  
    316316        measured_string_ref address;
    317317        packet_t packet;
     318        size_t addrlen;
     319        size_t prefix;
     320        size_t suffix;
     321        size_t content;
    318322
    319323//      printf("message %d - %d\n", IPC_GET_METHOD(*call), NET_NIL_FIRST);
     
    328332                        return nildummy_send_message(IPC_GET_DEVICE(call), packet, IPC_GET_SERVICE(call));
    329333                case NET_NIL_PACKET_SPACE:
    330                         ERROR_PROPAGATE(nildummy_packet_space_message(IPC_GET_DEVICE(call), IPC_SET_ADDR(answer), IPC_SET_PREFIX(answer), IPC_SET_CONTENT(answer), IPC_SET_SUFFIX(answer)));
     334                        ERROR_PROPAGATE(nildummy_packet_space_message(IPC_GET_DEVICE(call), &addrlen, &prefix, &content, &suffix));
     335                        IPC_SET_ADDR(answer, addrlen);
     336                        IPC_SET_PREFIX(answer, prefix);
     337                        IPC_SET_CONTENT(answer, content);
     338                        IPC_SET_SUFFIX(answer, suffix);
    331339                        *answer_count = 4;
    332340                        return EOK;
  • uspace/srv/net/socket/socket_client.c

    r63f8966 r40e29f5  
    421421        int socket_id;
    422422        services_t service;
     423        ipcarg_t fragment_size;
     424        ipcarg_t header_size;
    423425
    424426        // find the appropriate service
     
    478480                return socket_id;
    479481        }
    480         if(ERROR_OCCURRED((int) async_req_3_3(phone, NET_SOCKET, socket_id, 0, service, NULL, (ipcarg_t *) &socket->data_fragment_size, (ipcarg_t *) &socket->header_size))){
     482        if(ERROR_OCCURRED((int) async_req_3_3(phone, NET_SOCKET, socket_id, 0, service, NULL, &fragment_size, &header_size))){
    481483                fibril_rwlock_write_unlock(&socket_globals.lock);
    482484                free(socket);
    483485                return ERROR_CODE;
    484486        }
     487        socket->data_fragment_size = (size_t) fragment_size;
     488        socket->header_size = (size_t) header_size;
    485489        // finish the new socket initialization
    486490        socket_initialize(socket, socket_id, phone, service);
  • uspace/srv/net/socket/socket_messages.h

    r63f8966 r40e29f5  
    115115 *  @param[out] answer The message answer structure.
    116116 */
    117 #define SOCKET_SET_SOCKET_ID(answer)            &IPC_GET_ARG1(answer)
     117#define SOCKET_SET_SOCKET_ID(answer, value) \
     118        {ipcarg_t argument = (ipcarg_t) (value); IPC_SET_ARG1(answer, argument);}
    118119
    119120/** Returns the socket identifier message parameter.
    120121 *  @param[in] call The message call structure.
    121122 */
    122 #define SOCKET_GET_SOCKET_ID(call)              (int) IPC_GET_ARG1(call)
     123#define SOCKET_GET_SOCKET_ID(call) \
     124        ({int socket_id = (int) IPC_GET_ARG1(call); socket_id;})
    123125
    124126/** Sets the read data length in the message answer.
    125127 *  @param[out] answer The message answer structure.
    126128 */
    127 #define SOCKET_SET_READ_DATA_LENGTH(answer)     &IPC_GET_ARG1(answer)
     129#define SOCKET_SET_READ_DATA_LENGTH(answer, value) \
     130        {ipcarg_t argument = (ipcarg_t) (value); IPC_SET_ARG1(answer, argument);}
    128131
    129132/** Returns the read data length message parameter.
    130133 *  @param[in] call The message call structure.
    131134 */
    132 #define SOCKET_GET_READ_DATA_LENGTH(call)       (int) IPC_GET_ARG1(call)
     135#define SOCKET_GET_READ_DATA_LENGTH(call) \
     136        ({int data_length = (int) IPC_GET_ARG1(call); data_length;})
    133137
    134138/** Returns the backlog message parameter.
    135139 *  @param[in] call The message call structure.
    136140 */
    137 #define SOCKET_GET_BACKLOG(call)                (int) IPC_GET_ARG2(call)
     141#define SOCKET_GET_BACKLOG(call) \
     142        ({int backlog = (int) IPC_GET_ARG2(call); backlog;})
    138143
    139144/** Returns the option level message parameter.
    140145 *  @param[in] call The message call structure.
    141146 */
    142 #define SOCKET_GET_OPT_LEVEL(call)              (int) IPC_GET_ARG2(call)
     147#define SOCKET_GET_OPT_LEVEL(call) \
     148        ({int opt_level = (int) IPC_GET_ARG2(call); opt_level;})
    143149
    144150/** Returns the data fragment size message parameter.
    145151 *  @param[in] call The message call structure.
    146152 */
    147 #define SOCKET_GET_DATA_FRAGMENT_SIZE(call)     (size_t) IPC_GET_ARG2(call)
     153#define SOCKET_GET_DATA_FRAGMENT_SIZE(call) \
     154        ({size_t size = (size_t) IPC_GET_ARG2(call); size;})
    148155
    149156/** Sets the data fragment size in the message answer.
    150157 *  @param[out] answer The message answer structure.
    151158 */
    152 #define SOCKET_SET_DATA_FRAGMENT_SIZE(answer)   &IPC_GET_ARG2(answer)
     159#define SOCKET_SET_DATA_FRAGMENT_SIZE(answer, value) \
     160        {ipcarg_t argument = (ipcarg_t) (value); IPC_SET_ARG2(answer, argument);}
    153161
    154162/** Sets the address length in the message answer.
    155163 *  @param[out] answer The message answer structure.
    156164 */
    157 #define SOCKET_SET_ADDRESS_LENGTH(answer)       &IPC_GET_ARG3(answer)
     165#define SOCKET_SET_ADDRESS_LENGTH(answer, value) \
     166        {ipcarg_t argument = (ipcarg_t) (value); IPC_SET_ARG3(answer, argument);}
    158167
    159168/** Returns the address length message parameter.
    160169 *  @param[in] call The message call structure.
    161170 */
    162 #define SOCKET_GET_ADDRESS_LENGTH(call)         (socklen_t) IPC_GET_ARG3(call)
     171#define SOCKET_GET_ADDRESS_LENGTH(call) \
     172        ({socklen_t address_length = (socklen_t) IPC_GET_ARG3(call); address_length;})
    163173
    164174/** Sets the header size in the message answer.
    165175 *  @param[out] answer The message answer structure.
    166176 */
    167 #define SOCKET_SET_HEADER_SIZE(answer)          &IPC_GET_ARG3(answer)
     177#define SOCKET_SET_HEADER_SIZE(answer, value) \
     178        \
     179        {ipcarg_t argument = (ipcarg_t) (value); IPC_SET_ARG3(answer, argument);}
    168180
    169181/** Returns the header size message parameter.
    170182 *  @param[in] call The message call structure.
    171183 */
    172 #define SOCKET_GET_HEADER_SIZE(call)            (size_t) IPC_GET_ARG3(call)
     184#define SOCKET_GET_HEADER_SIZE(call) \
     185        ({size_t size = (size_t) IPC_GET_ARG3(call); size;})
    173186
    174187/** Returns the flags message parameter.
    175188 *  @param[in] call The message call structure.
    176189 */
    177 #define SOCKET_GET_FLAGS(call)                  (int) IPC_GET_ARG4(call)
     190#define SOCKET_GET_FLAGS(call) \
     191        ({int flags = (int) IPC_GET_ARG4(call); flags;})
    178192
    179193/** Returns the option name message parameter.
    180194 *  @param[in] call The message call structure.
    181195 */
    182 #define SOCKET_GET_OPT_NAME(call)               (int) IPC_GET_ARG4(call)
     196#define SOCKET_GET_OPT_NAME(call) \
     197        ({int opt_name = (int) IPC_GET_ARG4(call); opt_name;})
    183198
    184199/** Returns the data fragments message parameter.
    185200 *  @param[in] call The message call structure.
    186201 */
    187 #define SOCKET_GET_DATA_FRAGMENTS(call)         (int) IPC_GET_ARG5(call)
     202#define SOCKET_GET_DATA_FRAGMENTS(call) \
     203        ({int fragments = (int) IPC_GET_ARG5(call); fragments;})
    188204
    189205/** Returns the new socket identifier message parameter.
    190206 *  @param[in] call The message call structure.
    191207 */
    192 #define SOCKET_GET_NEW_SOCKET_ID(call)          (int) IPC_GET_ARG5(call)
     208#define SOCKET_GET_NEW_SOCKET_ID(call) \
     209        ({int socket_id = (int) IPC_GET_ARG5(call); socket_id;})
    193210
    194211/*@}*/
  • uspace/srv/net/structures/packet/packet_server.c

    r63f8966 r40e29f5  
    194194                        }
    195195                        *answer_count = 2;
    196                         IPC_SET_ARG1(*answer, packet->packet_id);
    197                         IPC_SET_ARG2(*answer, packet->length);
     196                        IPC_SET_ARG1(*answer, (ipcarg_t) packet->packet_id);
     197                        IPC_SET_ARG2(*answer, (ipcarg_t) packet->length);
    198198                        return EOK;
    199199                case NET_PACKET_CREATE_4:
     
    203203                        }
    204204                        *answer_count = 2;
    205                         IPC_SET_ARG1(*answer, packet->packet_id);
    206                         IPC_SET_ARG2(*answer, packet->length);
     205                        IPC_SET_ARG1(*answer, (ipcarg_t) packet->packet_id);
     206                        IPC_SET_ARG2(*answer, (ipcarg_t) packet->length);
    207207                        return EOK;
    208208                case NET_PACKET_GET:
     
    217217                                return ENOENT;
    218218                        }
    219                         IPC_SET_ARG1(*answer, packet->length);
     219                        IPC_SET_ARG1(*answer, (ipcarg_t) packet->length);
    220220                        *answer_count = 1;
    221221                        return EOK;
  • uspace/srv/net/tl/icmp/icmp_messages.h

    r63f8966 r40e29f5  
    8282 *  @param[in] call The message call structure.
    8383 */
    84 #define ICMP_GET_CODE(call)             (icmp_code_t) IPC_GET_ARG1(*call)
     84#define ICMP_GET_CODE(call) \
     85        ({icmp_code_t code = (icmp_code_t) IPC_GET_ARG1(*call); code;})
    8586
    8687/** Returns the ICMP link MTU message parameter.
    8788 *  @param[in] call The message call structure.
    8889 */
    89 #define ICMP_GET_MTU(call)              (icmp_param_t) IPC_GET_ARG3(*call)
     90#define ICMP_GET_MTU(call) \
     91        ({icmp_param_t mtu = (icmp_param_t) IPC_GET_ARG3(*call); mtu;})
    9092
    9193/** Returns the pointer message parameter.
    9294 *  @param[in] call The message call structure.
    9395 */
    94 #define ICMP_GET_POINTER(call)          (icmp_param_t) IPC_GET_ARG3(*call)
     96#define ICMP_GET_POINTER(call) \
     97        ({icmp_param_t pointer = (icmp_param_t) IPC_GET_ARG3(*call); pointer;})
    9598
    9699/** Returns the size message parameter.
    97100 *  @param[in] call The message call structure.
    98101 */
    99 #define ICMP_GET_SIZE(call)     (size_t) IPC_GET_ARG1(call)
     102#define ICMP_GET_SIZE(call) \
     103        ({size_t size = (size_t) IPC_GET_ARG1(call); size;})
    100104
    101105/** Returns the timeout message parameter.
    102106 *  @param[in] call The message call structure.
    103107 */
    104 #define ICMP_GET_TIMEOUT(call)  ((suseconds_t) IPC_GET_ARG2(call))
     108#define ICMP_GET_TIMEOUT(call) \
     109        (({suseconds_t timeout = (suseconds_t) IPC_GET_ARG2(call); timeout;}))
    105110
    106111/** Returns the time to live message parameter.
    107112 *  @param[in] call The message call structure.
    108113 */
    109 #define ICMP_GET_TTL(call)      (ip_ttl_t) IPC_GET_ARG3(call)
     114#define ICMP_GET_TTL(call) \
     115        ({ip_ttl_t ttl = (ip_ttl_t) IPC_GET_ARG3(call); ttl;})
    110116
    111117/** Returns the type of service message parameter.
    112118 *  @param[in] call The message call structure.
    113119 */
    114 #define ICMP_GET_TOS(call)      (ip_tos_t) IPC_GET_ARG4(call)
     120#define ICMP_GET_TOS(call) \
     121        ({ip_tos_t tos = (ip_tos_t) IPC_GET_ARG4(call); tos;})
    115122
    116123/** Returns the dont fragment message parameter.
    117124 *  @param[in] call The message call structure.
    118125 */
    119 #define ICMP_GET_DONT_FRAGMENT(call)            (int) IPC_GET_ARG5(call)
     126#define ICMP_GET_DONT_FRAGMENT(call) \
     127        ({int dont_fragment = (int) IPC_GET_ARG5(call); dont_fragment;})
    120128
    121129/*@}*/
  • uspace/srv/net/tl/tcp/tcp.c

    r63f8966 r40e29f5  
    10621062        int socket_id;
    10631063        size_t addrlen;
     1064        size_t size;
    10641065        fibril_rwlock_t lock;
    10651066        ipc_call_t answer;
     
    11071108                                        socket_id = SOCKET_GET_SOCKET_ID(call);
    11081109                                        res = socket_create(&local_sockets, app_phone, socket_data, &socket_id);
    1109                                         *SOCKET_SET_SOCKET_ID(answer) = socket_id;
     1110                                        SOCKET_SET_SOCKET_ID(answer, socket_id);
    11101111                                        fibril_rwlock_write_unlock(&lock);
    11111112                                        if(res == EOK){
    11121113                                                if(tl_get_ip_packet_dimension(tcp_globals.ip_phone, &tcp_globals.dimensions, DEVICE_INVALID_ID, &packet_dimension) == EOK){
    1113                                                         *SOCKET_SET_DATA_FRAGMENT_SIZE(answer) = ((packet_dimension->content < socket_data->data_fragment_size) ? packet_dimension->content : socket_data->data_fragment_size);
     1114                                                        SOCKET_SET_DATA_FRAGMENT_SIZE(answer, ((packet_dimension->content < socket_data->data_fragment_size) ? packet_dimension->content : socket_data->data_fragment_size));
    11141115                                                }
    1115 //                                              *SOCKET_SET_DATA_FRAGMENT_SIZE(answer) = MAX_TCP_FRAGMENT_SIZE;
    1116                                                 *SOCKET_SET_HEADER_SIZE(answer) = TCP_HEADER_SIZE;
     1116//                                              SOCKET_SET_DATA_FRAGMENT_SIZE(answer, MAX_TCP_FRAGMENT_SIZE);
     1117                                                SOCKET_SET_HEADER_SIZE(answer, TCP_HEADER_SIZE);
    11171118                                                answer_count = 3;
    11181119                                        }else{
     
    11661167                                fibril_rwlock_read_lock(&tcp_globals.lock);
    11671168                                fibril_rwlock_write_lock(&lock);
    1168                                 res = tcp_accept_message(&local_sockets, SOCKET_GET_SOCKET_ID(call), SOCKET_GET_NEW_SOCKET_ID(call), SOCKET_SET_DATA_FRAGMENT_SIZE(answer), &addrlen);
     1169                                res = tcp_accept_message(&local_sockets, SOCKET_GET_SOCKET_ID(call), SOCKET_GET_NEW_SOCKET_ID(call), &size, &addrlen);
     1170                                SOCKET_SET_DATA_FRAGMENT_SIZE(answer, size);
    11691171                                fibril_rwlock_write_unlock(&lock);
    11701172                                fibril_rwlock_read_unlock(&tcp_globals.lock);
    11711173                                if(res > 0){
    1172                                         *SOCKET_SET_SOCKET_ID(answer) = res;
    1173                                         *SOCKET_SET_ADDRESS_LENGTH(answer) = addrlen;
     1174                                        SOCKET_SET_SOCKET_ID(answer, res);
     1175                                        SOCKET_SET_ADDRESS_LENGTH(answer, addrlen);
    11741176                                        answer_count = 3;
    11751177                                }
     
    11781180                                fibril_rwlock_read_lock(&tcp_globals.lock);
    11791181                                fibril_rwlock_write_lock(&lock);
    1180                                 res = tcp_send_message(&local_sockets, SOCKET_GET_SOCKET_ID(call), SOCKET_GET_DATA_FRAGMENTS(call), SOCKET_SET_DATA_FRAGMENT_SIZE(answer), SOCKET_GET_FLAGS(call));
     1182                                res = tcp_send_message(&local_sockets, SOCKET_GET_SOCKET_ID(call), SOCKET_GET_DATA_FRAGMENTS(call), &size, SOCKET_GET_FLAGS(call));
     1183                                SOCKET_SET_DATA_FRAGMENT_SIZE(answer, size);
    11811184                                if(res != EOK){
    11821185                                        fibril_rwlock_write_unlock(&lock);
     
    11911194                                        fibril_rwlock_read_lock(&tcp_globals.lock);
    11921195                                        fibril_rwlock_write_lock(&lock);
    1193                                         res = tcp_send_message(&local_sockets, SOCKET_GET_SOCKET_ID(call), SOCKET_GET_DATA_FRAGMENTS(call), SOCKET_SET_DATA_FRAGMENT_SIZE(answer), SOCKET_GET_FLAGS(call));
     1196                                        res = tcp_send_message(&local_sockets, SOCKET_GET_SOCKET_ID(call), SOCKET_GET_DATA_FRAGMENTS(call), &size, SOCKET_GET_FLAGS(call));
     1197                                        SOCKET_SET_DATA_FRAGMENT_SIZE(answer, size);
    11941198                                        if(res != EOK){
    11951199                                                fibril_rwlock_write_unlock(&lock);
     
    12081212                                fibril_rwlock_read_unlock(&tcp_globals.lock);
    12091213                                if(res > 0){
    1210                                         *SOCKET_SET_READ_DATA_LENGTH(answer) = res;
     1214                                        SOCKET_SET_READ_DATA_LENGTH(answer, res);
    12111215                                        answer_count = 1;
    12121216                                        res = EOK;
     
    12201224                                fibril_rwlock_read_unlock(&tcp_globals.lock);
    12211225                                if(res > 0){
    1222                                         *SOCKET_SET_READ_DATA_LENGTH(answer) = res;
    1223                                         *SOCKET_SET_ADDRESS_LENGTH(answer) = addrlen;
     1226                                        SOCKET_SET_READ_DATA_LENGTH(answer, res);
     1227                                        SOCKET_SET_ADDRESS_LENGTH(answer, addrlen);
    12241228                                        answer_count = 3;
    12251229                                        res = EOK;
  • uspace/srv/net/tl/udp/udp.c

    r63f8966 r40e29f5  
    419419        int socket_id;
    420420        size_t addrlen;
     421        size_t size;
    421422        ipc_call_t answer;
    422423        int answer_count;
     
    454455                                socket_id = SOCKET_GET_SOCKET_ID(call);
    455456                                res = socket_create(&local_sockets, app_phone, NULL, &socket_id);
    456                                 *SOCKET_SET_SOCKET_ID(answer) = socket_id;
    457                                
     457                                SOCKET_SET_SOCKET_ID(answer, socket_id);
     458
    458459                                if(res == EOK){
    459460                                        if(tl_get_ip_packet_dimension(udp_globals.ip_phone, &udp_globals.dimensions, DEVICE_INVALID_ID, &packet_dimension) == EOK){
    460                                                 *SOCKET_SET_DATA_FRAGMENT_SIZE(answer) = packet_dimension->content;
     461                                                SOCKET_SET_DATA_FRAGMENT_SIZE(answer, packet_dimension->content);
    461462                                        }
    462 //                                      *SOCKET_SET_DATA_FRAGMENT_SIZE(answer) = MAX_UDP_FRAGMENT_SIZE;
    463                                         *SOCKET_SET_HEADER_SIZE(answer) = UDP_HEADER_SIZE;
     463//                                      SOCKET_SET_DATA_FRAGMENT_SIZE(answer, MAX_UDP_FRAGMENT_SIZE);
     464                                        SOCKET_SET_HEADER_SIZE(answer, UDP_HEADER_SIZE);
    464465                                        answer_count = 3;
    465466                                }
     
    478479                                if(res == EOK){
    479480                                        fibril_rwlock_write_lock(&udp_globals.lock);
    480                                         res = udp_sendto_message(&local_sockets, SOCKET_GET_SOCKET_ID(call), addr, addrlen, SOCKET_GET_DATA_FRAGMENTS(call), SOCKET_SET_DATA_FRAGMENT_SIZE(answer), SOCKET_GET_FLAGS(call));
     481                                        res = udp_sendto_message(&local_sockets, SOCKET_GET_SOCKET_ID(call), addr, addrlen, SOCKET_GET_DATA_FRAGMENTS(call), &size, SOCKET_GET_FLAGS(call));
     482                                        SOCKET_SET_DATA_FRAGMENT_SIZE(answer, size);
    481483                                        if(res != EOK){
    482484                                                fibril_rwlock_write_unlock(&udp_globals.lock);
     
    492494                                fibril_rwlock_write_unlock(&udp_globals.lock);
    493495                                if(res > 0){
    494                                         *SOCKET_SET_READ_DATA_LENGTH(answer) = res;
    495                                         *SOCKET_SET_ADDRESS_LENGTH(answer) = addrlen;
     496                                        SOCKET_SET_READ_DATA_LENGTH(answer, res);
     497                                        SOCKET_SET_ADDRESS_LENGTH(answer, addrlen);
    496498                                        answer_count = 3;
    497499                                        res = EOK;
Note: See TracChangeset for help on using the changeset viewer.