Changeset 88e127ee in mainline


Ignore:
Timestamp:
2010-10-06T20:31:17Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c7a8442
Parents:
e4554d4
Message:

Move socket_messages.h to libc's ipc/socket.h

Location:
uspace
Files:
3 edited
1 moved

Legend:

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

    re4554d4 r88e127ee  
    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>
    4341#include <ipc/net.h>
    4442
    45 #include <net/socket_codes.h>
    46 
    47 /** Socket client messages.
    48  */
    49 typedef enum{
    50         /** Creates a new socket.
    51          *  @see socket()
    52          */
     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/*@}*/
  • uspace/lib/socket/generic/socket_client.c

    re4554d4 r88e127ee  
    4646
    4747#include <ipc/services.h>
     48#include <ipc/socket.h>
    4849
    4950#include <net_modules.h>
     
    5253#include <adt/dynamic_fifo.h>
    5354#include <adt/int_map.h>
    54 #include <socket_messages.h>
    5555
    5656/** Initial received packet queue size.
  • uspace/srv/net/tl/tcp/tcp.c

    re4554d4 r88e127ee  
    4747#include <ipc/ipc.h>
    4848#include <ipc/services.h>
     49#include <ipc/socket.h>
    4950
    5051#include <net/socket_codes.h>
     
    6768#include <tcp_codes.h>
    6869#include <socket_core.h>
    69 #include <socket_messages.h>
    7070#include <tl_common.h>
    7171#include <tl_messages.h>
  • uspace/srv/net/tl/udp/udp.c

    re4554d4 r88e127ee  
    4242#include <ipc/ipc.h>
    4343#include <ipc/services.h>
     44#include <ipc/socket.h>
    4445#include <errno.h>
    4546#include <err.h>
     
    6364#include <net_interface.h>
    6465#include <socket_core.h>
    65 #include <socket_messages.h>
    6666#include <tl_common.h>
    6767#include <tl_local.h>
Note: See TracChangeset for help on using the changeset viewer.