Changeset 89c57b6 in mainline for uspace/lib/c/include/ipc/socket.h
- Timestamp:
- 2011-04-13T14:45:41Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 88634420
- Parents:
- cefb126 (diff), 17279ead (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. - File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/include/ipc/socket.h
rcefb126 r89c57b6 27 27 */ 28 28 29 /** @addtogroup socket30 * 29 /** @addtogroup libc 30 * @{ 31 31 */ 32 32 33 33 /** @file 34 * Socket messages. 35 * @see socket.h 36 */ 37 38 39 #ifndef __NET_SOCKET_MESSAGES_H__ 40 #define __NET_SOCKET_MESSAGES_H__ 41 42 #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 */ 34 * Socket messages. 35 */ 36 37 #ifndef LIBC_SOCKET_MESSAGES_H_ 38 #define LIBC_SOCKET_MESSAGES_H_ 39 40 #include <ipc/net.h> 41 42 /** Socket client messages. */ 43 typedef enum { 44 /** Creates a new socket. @see socket() */ 53 45 NET_SOCKET = NET_SOCKET_FIRST, 54 /** Binds the socket. 55 * @see bind() 56 */ 46 /** Binds the socket. @see bind() */ 57 47 NET_SOCKET_BIND, 58 /** Creates a new socket. 59 * @see socket() 60 */ 48 /** Creates a new socket. @see socket() */ 61 49 NET_SOCKET_LISTEN, 62 /** Accepts an incomming connection. 63 * @see accept() 64 */ 50 /** Accepts an incomming connection. @see accept() */ 65 51 NET_SOCKET_ACCEPT, 66 /** Connects the socket. 67 * @see connect() 68 */ 52 /** Connects the socket. @see connect() */ 69 53 NET_SOCKET_CONNECT, 70 /** Closes the socket. 71 * @see closesocket() 72 */ 54 /** Closes the socket. @see closesocket() */ 73 55 NET_SOCKET_CLOSE, 74 /** Sends data via the stream socket. 75 * @see send() 76 */ 56 /** Sends data via the stream socket. @see send() */ 77 57 NET_SOCKET_SEND, 78 /** Sends data via the datagram socket. 79 * @see sendto() 80 */ 58 /** Sends data via the datagram socket. @see sendto() */ 81 59 NET_SOCKET_SENDTO, 82 /** Receives data from the stream socket. 83 * @see socket() 84 */ 60 /** Receives data from the stream socket. @see socket() */ 85 61 NET_SOCKET_RECV, 86 /** Receives data from the datagram socket. 87 * @see socket() 88 */ 62 /** Receives data from the datagram socket. @see socket() */ 89 63 NET_SOCKET_RECVFROM, 90 /** Gets the socket option. 91 * @see getsockopt() 92 */ 64 /** Gets the socket option. @see getsockopt() */ 93 65 NET_SOCKET_GETSOCKOPT, 94 /** Sets the socket option. 95 * @see setsockopt() 96 */ 66 /** Sets the socket option. @see setsockopt() */ 97 67 NET_SOCKET_SETSOCKOPT, 98 /** New socket for acceptence notification message. 99 */ 68 /** New socket for acceptence notification message. */ 100 69 NET_SOCKET_ACCEPTED, 101 /** New data received notification message. 102 */ 70 /** New data received notification message. */ 103 71 NET_SOCKET_RECEIVED, 104 /** New socket data fragment size notification message. 105 */ 72 /** New socket data fragment size notification message. */ 106 73 NET_SOCKET_DATA_FRAGMENT_SIZE 107 74 } socket_messages; … … 112 79 113 80 /** Sets the socket identifier in the message answer. 114 * @param[out] answerThe message answer structure.81 * @param[out] answer The message answer structure. 115 82 */ 116 83 #define SOCKET_SET_SOCKET_ID(answer, value) \ 117 {ipcarg_t argument = (ipcarg_t) (value); IPC_SET_ARG1(answer, argument);} 84 do { \ 85 sysarg_t argument = (sysarg_t) (value); \ 86 IPC_SET_ARG1(answer, argument); \ 87 } while (0) 118 88 119 89 /** Returns the socket identifier message parameter. 120 * @param[in] callThe message call structure.90 * @param[in] call The message call structure. 121 91 */ 122 92 #define SOCKET_GET_SOCKET_ID(call) \ 123 ({int socket_id = (int) IPC_GET_ARG1(call); socket_id;}) 93 ({ \ 94 int socket_id = (int) IPC_GET_ARG1(call); \ 95 socket_id; \ 96 }) 124 97 125 98 /** Sets the read data length in the message answer. 126 * @param[out] answerThe message answer structure.99 * @param[out] answer The message answer structure. 127 100 */ 128 101 #define SOCKET_SET_READ_DATA_LENGTH(answer, value) \ 129 {ipcarg_t argument = (ipcarg_t) (value); IPC_SET_ARG1(answer, argument);} 102 do { \ 103 sysarg_t argument = (sysarg_t) (value); \ 104 IPC_SET_ARG1(answer, argument); \ 105 } while (0) 130 106 131 107 /** Returns the read data length message parameter. 132 * @param[in] callThe message call structure.108 * @param[in] call The message call structure. 133 109 */ 134 110 #define SOCKET_GET_READ_DATA_LENGTH(call) \ 135 ({int data_length = (int) IPC_GET_ARG1(call); data_length;}) 111 ({ \ 112 int data_length = (int) IPC_GET_ARG1(call); \ 113 data_length; \ 114 }) 136 115 137 116 /** Returns the backlog message parameter. 138 * @param[in] callThe message call structure.117 * @param[in] call The message call structure. 139 118 */ 140 119 #define SOCKET_GET_BACKLOG(call) \ 141 ({int backlog = (int) IPC_GET_ARG2(call); backlog;}) 120 ({ \ 121 int backlog = (int) IPC_GET_ARG2(call); \ 122 backlog; \ 123 }) 142 124 143 125 /** Returns the option level message parameter. 144 * @param[in] callThe message call structure.126 * @param[in] call The message call structure. 145 127 */ 146 128 #define SOCKET_GET_OPT_LEVEL(call) \ 147 ({int opt_level = (int) IPC_GET_ARG2(call); opt_level;}) 129 ({ \ 130 int opt_level = (int) IPC_GET_ARG2(call); \ 131 opt_level; \ 132 }) 148 133 149 134 /** Returns the data fragment size message parameter. 150 * @param[in] callThe message call structure.135 * @param[in] call The message call structure. 151 136 */ 152 137 #define SOCKET_GET_DATA_FRAGMENT_SIZE(call) \ 153 ({size_t size = (size_t) IPC_GET_ARG2(call); size;}) 138 ({ \ 139 size_t size = (size_t) IPC_GET_ARG2(call); \ 140 size; \ 141 }) 154 142 155 143 /** Sets the data fragment size in the message answer. 156 * @param[out] answerThe message answer structure.144 * @param[out] answer The message answer structure. 157 145 */ 158 146 #define SOCKET_SET_DATA_FRAGMENT_SIZE(answer, value) \ 159 {ipcarg_t argument = (ipcarg_t) (value); IPC_SET_ARG2(answer, argument);} 147 do { \ 148 sysarg_t argument = (sysarg_t) (value); \ 149 IPC_SET_ARG2(answer, argument); \ 150 } while (0) 160 151 161 152 /** Sets the address length in the message answer. 162 * @param[out] answerThe message answer structure.153 * @param[out] answer The message answer structure. 163 154 */ 164 155 #define SOCKET_SET_ADDRESS_LENGTH(answer, value) \ 165 {ipcarg_t argument = (ipcarg_t) (value); IPC_SET_ARG3(answer, argument);} 156 do { \ 157 sysarg_t argument = (sysarg_t) (value); \ 158 IPC_SET_ARG3(answer, argument);\ 159 } while (0) 166 160 167 161 /** Returns the address length message parameter. 168 * @param[in] callThe message call structure.162 * @param[in] call The message call structure. 169 163 */ 170 164 #define SOCKET_GET_ADDRESS_LENGTH(call) \ 171 ({socklen_t address_length = (socklen_t) IPC_GET_ARG3(call); address_length;}) 165 ({ \ 166 socklen_t address_length = (socklen_t) IPC_GET_ARG3(call); \ 167 address_length; \ 168 }) 172 169 173 170 /** Sets the header size in the message answer. 174 * @param[out] answerThe message answer structure.171 * @param[out] answer The message answer structure. 175 172 */ 176 173 #define SOCKET_SET_HEADER_SIZE(answer, value) \ 177 \ 178 {ipcarg_t argument = (ipcarg_t) (value); IPC_SET_ARG3(answer, argument);} 174 do { \ 175 sysarg_t argument = (sysarg_t) (value); \ 176 IPC_SET_ARG3(answer, argument); \ 177 } while (0) 179 178 180 179 /** Returns the header size message parameter. 181 * @param[in] call 180 * @param[in] call The message call structure. 182 181 */ 183 182 #define SOCKET_GET_HEADER_SIZE(call) \ 184 ({size_t size = (size_t) IPC_GET_ARG3(call); size;}) 183 ({ \ 184 size_t size = (size_t) IPC_GET_ARG3(call); \ 185 size; \ 186 }) 185 187 186 188 /** Returns the flags message parameter. 187 * @param[in] call 189 * @param[in] call The message call structure. 188 190 */ 189 191 #define SOCKET_GET_FLAGS(call) \ 190 ({int flags = (int) IPC_GET_ARG4(call); flags;}) 192 ({ \ 193 int flags = (int) IPC_GET_ARG4(call); \ 194 flags; \ 195 }) 191 196 192 197 /** Returns the option name message parameter. 193 * @param[in] call 198 * @param[in] call The message call structure. 194 199 */ 195 200 #define SOCKET_GET_OPT_NAME(call) \ 196 ({int opt_name = (int) IPC_GET_ARG4(call); opt_name;}) 201 ({ \ 202 int opt_name = (int) IPC_GET_ARG4(call); \ 203 opt_name; \ 204 }) 197 205 198 206 /** Returns the data fragments message parameter. 199 * @param[in] call 207 * @param[in] call The message call structure. 200 208 */ 201 209 #define SOCKET_GET_DATA_FRAGMENTS(call) \ 202 ({int fragments = (int) IPC_GET_ARG5(call); fragments;}) 210 ({ \ 211 int fragments = (int) IPC_GET_ARG5(call); \ 212 fragments; \ 213 }) 203 214 204 215 /** Returns the new socket identifier message parameter. 205 * @param[in] call 216 * @param[in] call The message call structure. 206 217 */ 207 218 #define SOCKET_GET_NEW_SOCKET_ID(call) \ 208 ({int socket_id = (int) IPC_GET_ARG5(call); socket_id;}) 219 ({ \ 220 int socket_id = (int) IPC_GET_ARG5(call); \ 221 socket_id; \ 222 }) 209 223 210 224 /*@}*/
Note:
See TracChangeset
for help on using the changeset viewer.