Changeset efedee77 in mainline for uspace/lib/c/include/ipc/socket.h


Ignore:
Timestamp:
2010-11-02T22:38:46Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
af894a21
Parents:
aab02fb (diff), e06ef614 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes

File:
1 moved

Legend:

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

    raab02fb refedee77  
    2727 */
    2828
    29 /** @addtogroup socket
    30  *  @{
     29/** @addtogroup libc
     30 * @{
    3131 */
    3232
    3333/** @file
    34  *  Socket messages.
    35  *  @see socket.h
    36  */
    37 
    38 
    39 #ifndef __NET_SOCKET_MESSAGES_H__
    40 #define __NET_SOCKET_MESSAGES_H__
     34 * Socket messages.
     35 */
     36
     37#ifndef LIBC_SOCKET_MESSAGES_H_
     38#define LIBC_SOCKET_MESSAGES_H_
    4139
    4240#include <ipc/ipc.h>
    43 
    44 #include <net_messages.h>
    45 #include <socket_codes.h>
    46 
    47 /** Socket client messages.
    48  */
    49 typedef enum{
    50         /** Creates a new socket.
    51          *  @see socket()
    52          */
     41#include <ipc/net.h>
     42
     43/** Socket client messages. */
     44typedef enum {
     45        /** Creates a new socket. @see socket() */
    5346        NET_SOCKET = NET_SOCKET_FIRST,
    54         /** Binds the socket.
    55          *  @see bind()
    56          */
     47        /** Binds the socket. @see bind() */
    5748        NET_SOCKET_BIND,
    58         /** Creates a new socket.
    59          *  @see socket()
    60          */
     49        /** Creates a new socket. @see socket() */
    6150        NET_SOCKET_LISTEN,
    62         /** Accepts an incomming connection.
    63          *  @see accept()
    64          */
     51        /** Accepts an incomming connection. @see accept() */
    6552        NET_SOCKET_ACCEPT,
    66         /** Connects the socket.
    67          *  @see connect()
    68          */
     53        /** Connects the socket. @see connect() */
    6954        NET_SOCKET_CONNECT,
    70         /** Closes the socket.
    71          *  @see closesocket()
    72          */
     55        /** Closes the socket. @see closesocket() */
    7356        NET_SOCKET_CLOSE,
    74         /** Sends data via the stream socket.
    75          *  @see send()
    76          */
     57        /** Sends data via the stream socket. @see send() */
    7758        NET_SOCKET_SEND,
    78         /** Sends data via the datagram socket.
    79          *  @see sendto()
    80          */
     59        /** Sends data via the datagram socket. @see sendto() */
    8160        NET_SOCKET_SENDTO,
    82         /** Receives data from the stream socket.
    83          *  @see socket()
    84          */
     61        /** Receives data from the stream socket. @see socket() */
    8562        NET_SOCKET_RECV,
    86         /** Receives data from the datagram socket.
    87          *  @see socket()
    88          */
     63        /** Receives data from the datagram socket. @see socket() */
    8964        NET_SOCKET_RECVFROM,
    90         /** Gets the socket option.
    91          *  @see getsockopt()
    92          */
     65        /** Gets the socket option. @see getsockopt() */
    9366        NET_SOCKET_GETSOCKOPT,
    94         /** Sets the socket option.
    95          *  @see setsockopt()
    96          */
     67        /** Sets the socket option. @see setsockopt() */
    9768        NET_SOCKET_SETSOCKOPT,
    98         /** New socket for acceptence notification message.
    99          */
     69        /** New socket for acceptence notification message. */
    10070        NET_SOCKET_ACCEPTED,
    101         /** New data received notification message.
    102          */
     71        /** New data received notification message. */
    10372        NET_SOCKET_RECEIVED,
    104         /** New socket data fragment size notification message.
    105          */
     73        /** New socket data fragment size notification message. */
    10674        NET_SOCKET_DATA_FRAGMENT_SIZE
    10775} socket_messages;
     
    11280
    11381/** Sets the socket identifier in the message answer.
    114  *  @param[out] answer The message answer structure.
     82 * @param[out] answer   The message answer structure.
    11583 */
    11684#define SOCKET_SET_SOCKET_ID(answer, value) \
    117         {ipcarg_t argument = (ipcarg_t) (value); IPC_SET_ARG1(answer, argument);}
     85        do { \
     86                ipcarg_t argument = (ipcarg_t) (value); \
     87                IPC_SET_ARG1(answer, argument); \
     88        } while (0)
    11889
    11990/** Returns the socket identifier message parameter.
    120  *  @param[in] call The message call structure.
     91 * @param[in] call      The message call structure.
    12192 */
    12293#define SOCKET_GET_SOCKET_ID(call) \
    123         ({int socket_id = (int) IPC_GET_ARG1(call); socket_id;})
     94        ({ \
     95                int socket_id = (int) IPC_GET_ARG1(call); \
     96                socket_id; \
     97        })
    12498
    12599/** Sets the read data length in the message answer.
    126  *  @param[out] answer The message answer structure.
     100 * @param[out] answer   The message answer structure.
    127101 */
    128102#define SOCKET_SET_READ_DATA_LENGTH(answer, value) \
    129         {ipcarg_t argument = (ipcarg_t) (value); IPC_SET_ARG1(answer, argument);}
     103        do { \
     104                ipcarg_t argument = (ipcarg_t) (value); \
     105                IPC_SET_ARG1(answer, argument); \
     106        } while (0)
    130107
    131108/** Returns the read data length message parameter.
    132  *  @param[in] call The message call structure.
     109 * @param[in] call      The message call structure.
    133110 */
    134111#define SOCKET_GET_READ_DATA_LENGTH(call) \
    135         ({int data_length = (int) IPC_GET_ARG1(call); data_length;})
     112        ({ \
     113                int data_length = (int) IPC_GET_ARG1(call); \
     114                data_length; \
     115        })
    136116
    137117/** Returns the backlog message parameter.
    138  *  @param[in] call The message call structure.
     118 * @param[in] call      The message call structure.
    139119 */
    140120#define SOCKET_GET_BACKLOG(call) \
    141         ({int backlog = (int) IPC_GET_ARG2(call); backlog;})
     121        ({ \
     122                int backlog = (int) IPC_GET_ARG2(call); \
     123                backlog; \
     124        })
    142125
    143126/** Returns the option level message parameter.
    144  *  @param[in] call The message call structure.
     127 * @param[in] call      The message call structure.
    145128 */
    146129#define SOCKET_GET_OPT_LEVEL(call) \
    147         ({int opt_level = (int) IPC_GET_ARG2(call); opt_level;})
     130        ({ \
     131                int opt_level = (int) IPC_GET_ARG2(call); \
     132                opt_level; \
     133        })
    148134
    149135/** Returns the data fragment size message parameter.
    150  *  @param[in] call The message call structure.
     136 * @param[in] call      The message call structure.
    151137 */
    152138#define SOCKET_GET_DATA_FRAGMENT_SIZE(call) \
    153         ({size_t size = (size_t) IPC_GET_ARG2(call); size;})
     139        ({ \
     140                size_t size = (size_t) IPC_GET_ARG2(call); \
     141                size; \
     142        })
    154143
    155144/** Sets the data fragment size in the message answer.
    156  *  @param[out] answer The message answer structure.
     145 * @param[out] answer   The message answer structure.
    157146 */
    158147#define SOCKET_SET_DATA_FRAGMENT_SIZE(answer, value) \
    159         {ipcarg_t argument = (ipcarg_t) (value); IPC_SET_ARG2(answer, argument);}
     148        do { \
     149                ipcarg_t argument = (ipcarg_t) (value); \
     150                IPC_SET_ARG2(answer, argument); \
     151        } while (0)
    160152
    161153/** Sets the address length in the message answer.
    162  *  @param[out] answer The message answer structure.
     154 * @param[out] answer   The message answer structure.
    163155 */
    164156#define SOCKET_SET_ADDRESS_LENGTH(answer, value) \
    165         {ipcarg_t argument = (ipcarg_t) (value); IPC_SET_ARG3(answer, argument);}
     157        do { \
     158                ipcarg_t argument = (ipcarg_t) (value); \
     159                IPC_SET_ARG3(answer, argument);\
     160        } while (0)
    166161
    167162/** Returns the address length message parameter.
    168  *  @param[in] call The message call structure.
     163 * @param[in] call      The message call structure.
    169164 */
    170165#define SOCKET_GET_ADDRESS_LENGTH(call) \
    171         ({socklen_t address_length = (socklen_t) IPC_GET_ARG3(call); address_length;})
     166        ({ \
     167                socklen_t address_length = (socklen_t) IPC_GET_ARG3(call); \
     168                address_length; \
     169        })
    172170
    173171/** Sets the header size in the message answer.
    174  *  @param[out] answer The message answer structure.
     172 * @param[out] answer   The message answer structure.
    175173 */
    176174#define SOCKET_SET_HEADER_SIZE(answer, value) \
    177         \
    178         {ipcarg_t argument = (ipcarg_t) (value); IPC_SET_ARG3(answer, argument);}
     175        do { \
     176                ipcarg_t argument = (ipcarg_t) (value); \
     177                IPC_SET_ARG3(answer, argument); \
     178        } while (0)
    179179
    180180/** Returns the header size message parameter.
    181  *  @param[in] call The message call structure.
     181 *  @param[in] call     The message call structure.
    182182 */
    183183#define SOCKET_GET_HEADER_SIZE(call) \
    184         ({size_t size = (size_t) IPC_GET_ARG3(call); size;})
     184        ({ \
     185                size_t size = (size_t) IPC_GET_ARG3(call); \
     186                size; \
     187        })
    185188
    186189/** Returns the flags message parameter.
    187  *  @param[in] call The message call structure.
     190 *  @param[in] call     The message call structure.
    188191 */
    189192#define SOCKET_GET_FLAGS(call) \
    190         ({int flags = (int) IPC_GET_ARG4(call); flags;})
     193        ({ \
     194                int flags = (int) IPC_GET_ARG4(call); \
     195                flags; \
     196        })
    191197
    192198/** Returns the option name message parameter.
    193  *  @param[in] call The message call structure.
     199 *  @param[in] call     The message call structure.
    194200 */
    195201#define SOCKET_GET_OPT_NAME(call) \
    196         ({int opt_name = (int) IPC_GET_ARG4(call); opt_name;})
     202        ({ \
     203                int opt_name = (int) IPC_GET_ARG4(call); \
     204                opt_name; \
     205        })
    197206
    198207/** Returns the data fragments message parameter.
    199  *  @param[in] call The message call structure.
     208 *  @param[in] call     The message call structure.
    200209 */
    201210#define SOCKET_GET_DATA_FRAGMENTS(call) \
    202         ({int fragments = (int) IPC_GET_ARG5(call); fragments;})
     211        ({ \
     212                int fragments = (int) IPC_GET_ARG5(call); \
     213                fragments; \
     214        })
    203215
    204216/** Returns the new socket identifier message parameter.
    205  *  @param[in] call The message call structure.
     217 *  @param[in] call     The message call structure.
    206218 */
    207219#define SOCKET_GET_NEW_SOCKET_ID(call) \
    208         ({int socket_id = (int) IPC_GET_ARG5(call); socket_id;})
     220        ({ \
     221                int socket_id = (int) IPC_GET_ARG5(call); \
     222                socket_id; \
     223        })
    209224
    210225/*@}*/
Note: See TracChangeset for help on using the changeset viewer.