Changeset a358279 in mainline


Ignore:
Timestamp:
2010-10-14T19:55:56Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
514ee46
Parents:
e526f08
Message:

Move macros to ipc/net.h.

Location:
uspace/lib
Files:
2 edited

Legend:

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

    re526f08 ra358279  
    4141#include <ipc/services.h>
    4242
     43#include <net/device.h>
     44#include <net/packet.h>
     45
    4346/** Returns a value indicating whether the value is in the interval.
    4447 * @param[in] item      The value to be checked.
     
    175178#define NET_PACKET_FIRST        (NET_SOCKET_LAST + 0)
    176179
    177 /** The last packet management system message.
    178  */
     180/** The last packet management system message. */
    179181#define NET_PACKET_LAST         (NET_PACKET_FIRST + NET_PACKET_COUNT)
    180182
     
    186188
    187189/** Returns a value indicating whether the IPC call is a generic networking
    188  *  message.
     190 * message.
    189191 * @param[in] call The IPC call to be checked.
    190192 */
     
    270272/*@}*/
    271273
     274/** @name Networking specific message arguments definitions */
     275/*@{*/
     276
     277/** Returns the device identifier message argument.
     278 * @param[in] call The message call structure.
     279 */
     280#define IPC_GET_DEVICE(call) \
     281        ({ \
     282                device_id_t device_id = (device_id_t) IPC_GET_ARG1(*call); \
     283                device_id; \
     284        })
     285
     286/** Returns the packet identifier message argument.
     287 * @param[in] call The message call structure.
     288 */
     289#define IPC_GET_PACKET(call) \
     290        ({ \
     291                packet_id_t packet_id = (packet_id_t) IPC_GET_ARG2(*call); \
     292                packet_id; \
     293        })
     294
     295/** Returns the count message argument.
     296 * @param[in] call The message call structure.
     297 */
     298#define IPC_GET_COUNT(call) \
     299        ({ \
     300                size_t size = (size_t) IPC_GET_ARG2(*call); \
     301                size; \
     302        })
     303
     304/** Returns the device state message argument.
     305 * @param[in] call The message call structure.
     306 */
     307#define IPC_GET_STATE(call) \
     308        ({ \
     309                device_state_t state = (device_state_t) IPC_GET_ARG2(*call); \
     310                state; \
     311        })
     312
     313/** Returns the maximum transmission unit message argument.
     314 * @param[in] call The message call structure.
     315 */
     316#define IPC_GET_MTU(call) \
     317        ({ \
     318                size_t size = (size_t) IPC_GET_ARG2(*call); \
     319                size; \
     320        })
     321
     322/** Returns the device driver service message argument.
     323 * @param[in] call The message call structure.
     324 */
     325#define IPC_GET_SERVICE(call) \
     326        ({ \
     327                services_t service = (services_t) IPC_GET_ARG3(*call); \
     328                service; \
     329        })
     330
     331/** Returns the target service message argument.
     332 * @param[in] call The message call structure.
     333 */
     334#define IPC_GET_TARGET(call) \
     335        ({ \
     336                services_t service = (services_t) IPC_GET_ARG3(*call); \
     337                service; \
     338        })
     339
     340/** Returns the sender service message argument.
     341 * @param[in] call The message call structure.
     342 */
     343#define IPC_GET_SENDER(call) \
     344        ({ \
     345                services_t service = (services_t) IPC_GET_ARG3(*call); \
     346                service; \
     347        })
     348
     349/** Returns the error service message argument.
     350 * @param[in] call The message call structure.
     351 */
     352#define IPC_GET_ERROR(call) \
     353        ({ \
     354                services_t service = (services_t) IPC_GET_ARG4(*call); \
     355                service; \
     356        })
     357
     358/** Returns the phone message argument.
     359 * @param[in] call The message call structure.
     360 */
     361#define IPC_GET_PHONE(call) \
     362        ({ \
     363                int phone = (int) IPC_GET_ARG5(*call); \
     364                phone; \
     365        })
     366
     367/** Sets the device identifier in the message answer.
     368 * @param[out] answer The message answer structure.
     369 */
     370#define IPC_SET_DEVICE(answer, value) \
     371        do { \
     372                ipcarg_t argument = (ipcarg_t) (value); \
     373                IPC_SET_ARG1(*answer, argument); \
     374        } while (0)
     375
     376/** Sets the minimum address length in the message answer.
     377 * @param[out] answer The message answer structure.
     378 */
     379#define IPC_SET_ADDR(answer, value) \
     380        do { \
     381                ipcarg_t argument = (ipcarg_t) (value); \
     382                IPC_SET_ARG1(*answer, argument); \
     383        } while (0)
     384
     385/** Sets the minimum prefix size in the message answer.
     386 * @param[out] answer The message answer structure.
     387 */
     388#define IPC_SET_PREFIX(answer, value) \
     389        do { \
     390                ipcarg_t argument = (ipcarg_t) (value); \
     391                IPC_SET_ARG2(*answer, argument); \
     392        } while (0)
     393
     394/** Sets the maximum content size in the message answer.
     395 * @param[out] answer The message answer structure.
     396 */
     397#define IPC_SET_CONTENT(answer, value) \
     398        do { \
     399                ipcarg_t argument = (ipcarg_t) (value); \
     400                IPC_SET_ARG3(*answer, argument); \
     401        } while (0)
     402
     403/** Sets the minimum suffix size in the message answer.
     404 * @param[out] answer The message answer structure.
     405 */
     406#define IPC_SET_SUFFIX(answer, value) \
     407        do { \
     408                ipcarg_t argument = (ipcarg_t) (value); \
     409                IPC_SET_ARG4(*answer, argument); \
     410        } while (0)
     411
     412/*@}*/
     413
    272414#endif
    273415
  • uspace/lib/socket/include/net_messages.h

    re526f08 ra358279  
    4545#include <adt/measured_strings.h>
    4646#include <net/packet.h>
    47 
    48 /** @name Networking specific message arguments definitions
    49  */
    50 /*@{*/
    51 
    52 /** @name First arguments
    53  */
    54 /*@{*/
    55 
    56 /** Returns the device identifier message argument.
    57  *  @param[in] call The message call structure.
    58  */
    59 #define IPC_GET_DEVICE(call) \
    60         ({device_id_t device_id = (device_id_t) IPC_GET_ARG1(*call); device_id;})
    61 
    62 /*@;})*/
    63 
    64 /** @name Second arguments
    65  */
    66 /*@({*/
    67 
    68 /** Returns the packet identifier message argument.
    69  *  @param[in] call The message call structure.
    70  */
    71 #define IPC_GET_PACKET(call) \
    72         ({packet_id_t packet_id = (packet_id_t) IPC_GET_ARG2(*call); packet_id;})
    73 
    74 /** Returns the count message argument.
    75  *  @param[in] call The message call structure.
    76  */
    77 #define IPC_GET_COUNT(call) \
    78         ({size_t size = (size_t) IPC_GET_ARG2(*call); size;})
    79 
    80 /** Returns the device state message argument.
    81  *  @param[in] call The message call structure.
    82  */
    83 #define IPC_GET_STATE(call) \
    84         ({device_state_t device_state = (device_state_t) IPC_GET_ARG2(*call); device_state;})
    85 
    86 /** Returns the maximum transmission unit message argument.
    87  *  @param[in] call The message call structure.
    88  */
    89 #define IPC_GET_MTU(call) \
    90         ({size_t size = (size_t) IPC_GET_ARG2(*call); size;})
    91 
    92 /*@;})*/
    93 
    94 /** @name Third arguments
    95  */
    96 /*@({*/
    97 
    98 /** Returns the device driver service message argument.
    99  *  @param[in] call The message call structure.
    100  */
    101  #define IPC_GET_SERVICE(call) \
    102         ({services_t service = (services_t) IPC_GET_ARG3(*call); service;})
    103 
    104 /** Returns the target service message argument.
    105  *  @param[in] call The message call structure.
    106  */
    107 #define IPC_GET_TARGET(call) \
    108         ({services_t service = (services_t) IPC_GET_ARG3(*call); service;})
    109 
    110 /** Returns the sender service message argument.
    111  *  @param[in] call The message call structure.
    112  */
    113 #define IPC_GET_SENDER(call) \
    114         ({services_t service = (services_t) IPC_GET_ARG3(*call); service;})
    115 
    116 /*@;})*/
    117 
    118 /** @name Fourth arguments
    119  */
    120 /*@({*/
    121 
    122 /** Returns the error service message argument.
    123  *  @param[in] call The message call structure.
    124  */
    125 #define IPC_GET_ERROR(call) \
    126         ({services_t service = (services_t) IPC_GET_ARG4(*call); service;})
    127 
    128 /*@;})*/
    129 
    130 /** @name Fifth arguments
    131  */
    132 /*@({*/
    133 
    134 /** Returns the phone message argument.
    135  *  @param[in] call The message call structure.
    136  */
    137 #define IPC_GET_PHONE(call) \
    138         ({int phone = (int) IPC_GET_ARG5(*call); phone;})
    139 
    140 /*@}*/
    141 
    142 /** @name First answers
    143  */
    144 /*@{*/
    145 
    146 /** Sets the device identifier in the message answer.
    147  *  @param[out] answer The message answer structure.
    148  */
    149 #define IPC_SET_DEVICE(answer, value) \
    150         {ipcarg_t argument = (ipcarg_t) (value); IPC_SET_ARG1(*answer, argument);}
    151 
    152 /** Sets the minimum address length in the message answer.
    153  *  @param[out] answer The message answer structure.
    154  */
    155 #define IPC_SET_ADDR(answer, value) \
    156         {ipcarg_t argument = (ipcarg_t) (value); IPC_SET_ARG1(*answer, argument);}
    157 
    158 /*@}*/
    159 
    160 /** @name Second answers
    161  */
    162 /*@{*/
    163 
    164 /** Sets the minimum prefix size in the message answer.
    165  *  @param[out] answer The message answer structure.
    166  */
    167 #define IPC_SET_PREFIX(answer, value) \
    168         {ipcarg_t argument = (ipcarg_t) (value); IPC_SET_ARG2(*answer, argument);}
    169 
    170 /*@}*/
    171 
    172 /** @name Third answers
    173  */
    174 /*@{*/
    175 
    176 /** Sets the maximum content size in the message answer.
    177  *  @param[out] answer The message answer structure.
    178  */
    179 #define IPC_SET_CONTENT(answer, value) \
    180         {ipcarg_t argument = (ipcarg_t) (value); IPC_SET_ARG3(*answer, argument);}
    181 
    182 /*@}*/
    183 
    184 /** @name Fourth answers
    185  */
    186 /*@{*/
    187 
    188 /** Sets the minimum suffix size in the message answer.
    189  *  @param[out] answer The message answer structure.
    190  */
    191 #define IPC_SET_SUFFIX(answer, value) \
    192         {ipcarg_t argument = (ipcarg_t) (value); IPC_SET_ARG4(*answer, argument);}
    193 
    194 /*@}*/
    195 
    196 /*@}*/
    19747
    19848/** Notify the module about the device state change.
Note: See TracChangeset for help on using the changeset viewer.