00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00037 #ifndef LIBC_SOCKET_MESSAGES_H_
00038 #define LIBC_SOCKET_MESSAGES_H_
00039
00040 #include <ipc/net.h>
00041
00043 typedef enum {
00045 NET_SOCKET = NET_SOCKET_FIRST,
00047 NET_SOCKET_BIND,
00049 NET_SOCKET_LISTEN,
00051 NET_SOCKET_ACCEPT,
00053 NET_SOCKET_CONNECT,
00055 NET_SOCKET_CLOSE,
00057 NET_SOCKET_SEND,
00059 NET_SOCKET_SENDTO,
00061 NET_SOCKET_RECV,
00063 NET_SOCKET_RECVFROM,
00065 NET_SOCKET_GETSOCKOPT,
00067 NET_SOCKET_SETSOCKOPT,
00069 NET_SOCKET_ACCEPTED,
00071 NET_SOCKET_RECEIVED,
00073 NET_SOCKET_DATA_FRAGMENT_SIZE
00074 } socket_messages;
00075
00079
00083 #define SOCKET_SET_SOCKET_ID(answer, value) \
00084 do { \
00085 sysarg_t argument = (sysarg_t) (value); \
00086 IPC_SET_ARG1(answer, argument); \
00087 } while (0)
00088
00092 #define SOCKET_GET_SOCKET_ID(call) \
00093 ({ \
00094 int socket_id = (int) IPC_GET_ARG1(call); \
00095 socket_id; \
00096 })
00097
00101 #define SOCKET_SET_READ_DATA_LENGTH(answer, value) \
00102 do { \
00103 sysarg_t argument = (sysarg_t) (value); \
00104 IPC_SET_ARG1(answer, argument); \
00105 } while (0)
00106
00110 #define SOCKET_GET_READ_DATA_LENGTH(call) \
00111 ({ \
00112 int data_length = (int) IPC_GET_ARG1(call); \
00113 data_length; \
00114 })
00115
00119 #define SOCKET_GET_BACKLOG(call) \
00120 ({ \
00121 int backlog = (int) IPC_GET_ARG2(call); \
00122 backlog; \
00123 })
00124
00128 #define SOCKET_GET_OPT_LEVEL(call) \
00129 ({ \
00130 int opt_level = (int) IPC_GET_ARG2(call); \
00131 opt_level; \
00132 })
00133
00137 #define SOCKET_GET_DATA_FRAGMENT_SIZE(call) \
00138 ({ \
00139 size_t size = (size_t) IPC_GET_ARG2(call); \
00140 size; \
00141 })
00142
00146 #define SOCKET_SET_DATA_FRAGMENT_SIZE(answer, value) \
00147 do { \
00148 sysarg_t argument = (sysarg_t) (value); \
00149 IPC_SET_ARG2(answer, argument); \
00150 } while (0)
00151
00155 #define SOCKET_SET_ADDRESS_LENGTH(answer, value) \
00156 do { \
00157 sysarg_t argument = (sysarg_t) (value); \
00158 IPC_SET_ARG3(answer, argument);\
00159 } while (0)
00160
00164 #define SOCKET_GET_ADDRESS_LENGTH(call) \
00165 ({ \
00166 socklen_t address_length = (socklen_t) IPC_GET_ARG3(call); \
00167 address_length; \
00168 })
00169
00173 #define SOCKET_SET_HEADER_SIZE(answer, value) \
00174 do { \
00175 sysarg_t argument = (sysarg_t) (value); \
00176 IPC_SET_ARG3(answer, argument); \
00177 } while (0)
00178
00182 #define SOCKET_GET_HEADER_SIZE(call) \
00183 ({ \
00184 size_t size = (size_t) IPC_GET_ARG3(call); \
00185 size; \
00186 })
00187
00191 #define SOCKET_GET_FLAGS(call) \
00192 ({ \
00193 int flags = (int) IPC_GET_ARG4(call); \
00194 flags; \
00195 })
00196
00200 #define SOCKET_GET_OPT_NAME(call) \
00201 ({ \
00202 int opt_name = (int) IPC_GET_ARG4(call); \
00203 opt_name; \
00204 })
00205
00209 #define SOCKET_GET_DATA_FRAGMENTS(call) \
00210 ({ \
00211 int fragments = (int) IPC_GET_ARG5(call); \
00212 fragments; \
00213 })
00214
00218 #define SOCKET_GET_NEW_SOCKET_ID(call) \
00219 ({ \
00220 int socket_id = (int) IPC_GET_ARG5(call); \
00221 socket_id; \
00222 })
00223
00226 #endif
00227