Changeset a358279 in mainline for uspace/lib/c/include/ipc/net.h


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.

File:
1 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
Note: See TracChangeset for help on using the changeset viewer.