Changeset 88e127ee in mainline
- Timestamp:
- 2010-10-06T20:31:17Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c7a8442
- Parents:
- e4554d4
- Location:
- uspace
- Files:
-
- 3 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/include/ipc/socket.h
re4554d4 r88e127ee 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__ 34 * Socket messages. 35 */ 36 37 #ifndef LIBC_SOCKET_MESSAGES_H_ 38 #define LIBC_SOCKET_MESSAGES_H_ 41 39 42 40 #include <ipc/ipc.h> 43 41 #include <ipc/net.h> 44 42 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. */ 44 typedef enum { 45 /** Creates a new socket. @see socket() */ 53 46 NET_SOCKET = NET_SOCKET_FIRST, 54 /** Binds the socket. 55 * @see bind() 56 */ 47 /** Binds the socket. @see bind() */ 57 48 NET_SOCKET_BIND, 58 /** Creates a new socket. 59 * @see socket() 60 */ 49 /** Creates a new socket. @see socket() */ 61 50 NET_SOCKET_LISTEN, 62 /** Accepts an incomming connection. 63 * @see accept() 64 */ 51 /** Accepts an incomming connection. @see accept() */ 65 52 NET_SOCKET_ACCEPT, 66 /** Connects the socket. 67 * @see connect() 68 */ 53 /** Connects the socket. @see connect() */ 69 54 NET_SOCKET_CONNECT, 70 /** Closes the socket. 71 * @see closesocket() 72 */ 55 /** Closes the socket. @see closesocket() */ 73 56 NET_SOCKET_CLOSE, 74 /** Sends data via the stream socket. 75 * @see send() 76 */ 57 /** Sends data via the stream socket. @see send() */ 77 58 NET_SOCKET_SEND, 78 /** Sends data via the datagram socket. 79 * @see sendto() 80 */ 59 /** Sends data via the datagram socket. @see sendto() */ 81 60 NET_SOCKET_SENDTO, 82 /** Receives data from the stream socket. 83 * @see socket() 84 */ 61 /** Receives data from the stream socket. @see socket() */ 85 62 NET_SOCKET_RECV, 86 /** Receives data from the datagram socket. 87 * @see socket() 88 */ 63 /** Receives data from the datagram socket. @see socket() */ 89 64 NET_SOCKET_RECVFROM, 90 /** Gets the socket option. 91 * @see getsockopt() 92 */ 65 /** Gets the socket option. @see getsockopt() */ 93 66 NET_SOCKET_GETSOCKOPT, 94 /** Sets the socket option. 95 * @see setsockopt() 96 */ 67 /** Sets the socket option. @see setsockopt() */ 97 68 NET_SOCKET_SETSOCKOPT, 98 /** New socket for acceptence notification message. 99 */ 69 /** New socket for acceptence notification message. */ 100 70 NET_SOCKET_ACCEPTED, 101 /** New data received notification message. 102 */ 71 /** New data received notification message. */ 103 72 NET_SOCKET_RECEIVED, 104 /** New socket data fragment size notification message. 105 */ 73 /** New socket data fragment size notification message. */ 106 74 NET_SOCKET_DATA_FRAGMENT_SIZE 107 75 } socket_messages; … … 112 80 113 81 /** Sets the socket identifier in the message answer. 114 * @param[out] answerThe message answer structure.82 * @param[out] answer The message answer structure. 115 83 */ 116 84 #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) 118 89 119 90 /** Returns the socket identifier message parameter. 120 * @param[in] callThe message call structure.91 * @param[in] call The message call structure. 121 92 */ 122 93 #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 }) 124 98 125 99 /** Sets the read data length in the message answer. 126 * @param[out] answerThe message answer structure.100 * @param[out] answer The message answer structure. 127 101 */ 128 102 #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) 130 107 131 108 /** Returns the read data length message parameter. 132 * @param[in] callThe message call structure.109 * @param[in] call The message call structure. 133 110 */ 134 111 #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 }) 136 116 137 117 /** Returns the backlog message parameter. 138 * @param[in] callThe message call structure.118 * @param[in] call The message call structure. 139 119 */ 140 120 #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 }) 142 125 143 126 /** Returns the option level message parameter. 144 * @param[in] callThe message call structure.127 * @param[in] call The message call structure. 145 128 */ 146 129 #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 }) 148 134 149 135 /** Returns the data fragment size message parameter. 150 * @param[in] callThe message call structure.136 * @param[in] call The message call structure. 151 137 */ 152 138 #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 }) 154 143 155 144 /** Sets the data fragment size in the message answer. 156 * @param[out] answerThe message answer structure.145 * @param[out] answer The message answer structure. 157 146 */ 158 147 #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) 160 152 161 153 /** Sets the address length in the message answer. 162 * @param[out] answerThe message answer structure.154 * @param[out] answer The message answer structure. 163 155 */ 164 156 #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) 166 161 167 162 /** Returns the address length message parameter. 168 * @param[in] callThe message call structure.163 * @param[in] call The message call structure. 169 164 */ 170 165 #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 }) 172 170 173 171 /** Sets the header size in the message answer. 174 * @param[out] answerThe message answer structure.172 * @param[out] answer The message answer structure. 175 173 */ 176 174 #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) 179 179 180 180 /** Returns the header size message parameter. 181 * @param[in] call 181 * @param[in] call The message call structure. 182 182 */ 183 183 #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 }) 185 188 186 189 /** Returns the flags message parameter. 187 * @param[in] call 190 * @param[in] call The message call structure. 188 191 */ 189 192 #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 }) 191 197 192 198 /** Returns the option name message parameter. 193 * @param[in] call 199 * @param[in] call The message call structure. 194 200 */ 195 201 #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 }) 197 206 198 207 /** Returns the data fragments message parameter. 199 * @param[in] call 208 * @param[in] call The message call structure. 200 209 */ 201 210 #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 }) 203 215 204 216 /** Returns the new socket identifier message parameter. 205 * @param[in] call 217 * @param[in] call The message call structure. 206 218 */ 207 219 #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 }) 209 224 210 225 /*@}*/ -
uspace/lib/socket/generic/socket_client.c
re4554d4 r88e127ee 46 46 47 47 #include <ipc/services.h> 48 #include <ipc/socket.h> 48 49 49 50 #include <net_modules.h> … … 52 53 #include <adt/dynamic_fifo.h> 53 54 #include <adt/int_map.h> 54 #include <socket_messages.h>55 55 56 56 /** Initial received packet queue size. -
uspace/srv/net/tl/tcp/tcp.c
re4554d4 r88e127ee 47 47 #include <ipc/ipc.h> 48 48 #include <ipc/services.h> 49 #include <ipc/socket.h> 49 50 50 51 #include <net/socket_codes.h> … … 67 68 #include <tcp_codes.h> 68 69 #include <socket_core.h> 69 #include <socket_messages.h>70 70 #include <tl_common.h> 71 71 #include <tl_messages.h> -
uspace/srv/net/tl/udp/udp.c
re4554d4 r88e127ee 42 42 #include <ipc/ipc.h> 43 43 #include <ipc/services.h> 44 #include <ipc/socket.h> 44 45 #include <errno.h> 45 46 #include <err.h> … … 63 64 #include <net_interface.h> 64 65 #include <socket_core.h> 65 #include <socket_messages.h>66 66 #include <tl_common.h> 67 67 #include <tl_local.h>
Note:
See TracChangeset
for help on using the changeset viewer.