Rev 4603 | Rev 4712 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 4603 | Rev 4701 | ||
|---|---|---|---|
| Line 43... | Line 43... | ||
| 43 | 43 | ||
| 44 | #include "byteorder.h" |
44 | #include "byteorder.h" |
| 45 | #include "in.h" |
45 | #include "in.h" |
| 46 | #include "inet.h" |
46 | #include "inet.h" |
| 47 | 47 | ||
| 48 | /* Supported address families. */ |
48 | /** @name Address families definitions |
| - | 49 | */ |
|
| - | 50 | /*@{*/ |
|
| 49 | /** Unspecified address family. |
51 | /** Unspecified address family. |
| 50 | */ |
52 | */ |
| 51 | #define AF_UNSPEC 0 |
53 | #define AF_UNSPEC 0 |
| 52 | 54 | ||
| 53 | /** Unix domain sockets address family. |
55 | /** Unix domain sockets address family. |
| Line 175... | Line 177... | ||
| 175 | #define AF_RXRPC 33 |
177 | #define AF_RXRPC 33 |
| 176 | 178 | ||
| 177 | /** Maximum address family. |
179 | /** Maximum address family. |
| 178 | */ |
180 | */ |
| 179 | #define AF_MAX 34 |
181 | #define AF_MAX 34 |
| - | 182 | /*@}*/ |
|
| 180 | 183 | ||
| - | 184 | /** @name Protocol families definitions |
|
| 181 | /* Protocol families, same as address families. */ |
185 | * Same as address families. |
| 182 | 186 | */ |
|
| - | 187 | /*@{*/ |
|
| - | 188 | /** Unspecified protocol family. |
|
| - | 189 | */ |
|
| 183 | #define PF_UNSPEC AF_UNSPEC |
190 | #define PF_UNSPEC AF_UNSPEC |
| - | 191 | ||
| - | 192 | /** Unix domain sockets protocol family. |
|
| - | 193 | */ |
|
| 184 | #define PF_UNIX AF_UNIX |
194 | #define PF_UNIXL AF_UNIXL |
| - | 195 | ||
| - | 196 | /** POSIX name for AF_UNIX protocol family. |
|
| - | 197 | */ |
|
| 185 | #define PF_LOCAL AF_LOCAL |
198 | #define PF_LOCAL AF_LOCAL |
| - | 199 | ||
| - | 200 | /** Internet IP Protocol protocol family. |
|
| - | 201 | */ |
|
| 186 | #define PF_INET AF_INET |
202 | #define PF_INET AF_INET |
| - | 203 | ||
| - | 204 | /** Amateur Radio AX.25 protocol family. |
|
| - | 205 | */ |
|
| 187 | #define PF_AX25 AF_AX25 |
206 | #define PF_AX25 AF_AX25 |
| - | 207 | ||
| - | 208 | /** Novell IPX protocol family. |
|
| - | 209 | */ |
|
| 188 | #define PF_IPX AF_IPX |
210 | #define PF_IPX AF_IPX |
| - | 211 | ||
| - | 212 | /** AppleTalk DDP protocol family. |
|
| - | 213 | */ |
|
| 189 | #define PF_APPLETALK AF_APPLETALK |
214 | #define PF_APPLETALK AF_APPLETALK |
| - | 215 | ||
| - | 216 | /** Amateur Radio NET/ROM protocol family. |
|
| - | 217 | */ |
|
| 190 | #define PF_NETROM AF_NETROM |
218 | #define PF_NETROM AF_NETROM |
| - | 219 | ||
| - | 220 | /** Multiprotocol bridge protocol family. |
|
| - | 221 | */ |
|
| 191 | #define PF_BRIDGE AF_BRIDGE |
222 | #define PF_BRIDGE AF_BRIDGE |
| - | 223 | ||
| - | 224 | /** ATM PVCs protocol family. |
|
| - | 225 | */ |
|
| 192 | #define PF_ATMPVC AF_ATMPVC |
226 | #define PF_ATMPVC AF_ATMPVC |
| - | 227 | ||
| - | 228 | /** Reserved for X.25 project protocol family. |
|
| - | 229 | */ |
|
| 193 | #define PF_X25 AF_X25 |
230 | #define PF_X25 AF_X25 |
| - | 231 | ||
| - | 232 | /** IP version 6 protocol family. |
|
| - | 233 | */ |
|
| 194 | #define PF_INET6 AF_INET6 |
234 | #define PF_INET6 AF_INET6 |
| - | 235 | ||
| - | 236 | /** Amateur Radio X.25 PLP protocol family. |
|
| - | 237 | */ |
|
| 195 | #define PF_ROSE AF_ROSE |
238 | #define PF_ROSE AF_ROSE |
| - | 239 | ||
| - | 240 | /** Reserved for DECnet project protocol family. |
|
| - | 241 | */ |
|
| 196 | #define PF_DECnet AF_DECnet |
242 | #define PF_DECnet AF_DECnet |
| - | 243 | ||
| - | 244 | /** Reserved for 802.2LLC project protocol family. |
|
| - | 245 | */ |
|
| 197 | #define PF_NETBEUI AF_NETBEUI |
246 | #define PF_NETBEUI AF_NETBEUI |
| - | 247 | ||
| - | 248 | /** Security callback pseudo AF protocol family. |
|
| - | 249 | */ |
|
| 198 | #define PF_SECURITY AF_SECURITY |
250 | #define PF_SECURITY AF_SECURITY |
| - | 251 | ||
| - | 252 | /** PF_KEY key management API protocol family. |
|
| - | 253 | */ |
|
| 199 | #define PF_KEY AF_KEY |
254 | #define PF_KEY AF_KEY |
| - | 255 | ||
| - | 256 | /** Alias to emulate 4.4BSD protocol family. |
|
| - | 257 | */ |
|
| 200 | #define PF_NETLINK AF_NETLINK |
258 | #define PF_NETLINK AF_NETLINK |
| - | 259 | ||
| 201 | #define PF_ROUTE AF_ROUTE |
260 | /** Packet family protocol family. |
| - | 261 | */ |
|
| 202 | #define PF_PACKET AF_PACKET |
262 | #define PF_PACKET AF_PACKET |
| - | 263 | ||
| - | 264 | /** Ash protocol family. |
|
| - | 265 | */ |
|
| 203 | #define PF_ASH AF_ASH |
266 | #define PF_ASH AF_ASH |
| - | 267 | ||
| - | 268 | /** Acorn Econet protocol family. |
|
| - | 269 | */ |
|
| 204 | #define PF_ECONET AF_ECONET |
270 | #define PF_ECONET AF_ECONET |
| - | 271 | ||
| - | 272 | /** ATM SVCs protocol family. |
|
| - | 273 | */ |
|
| 205 | #define PF_ATMSVC AF_ATMSVC |
274 | #define PF_ATMSVC AF_ATMSVC |
| - | 275 | ||
| - | 276 | /** Linux SNA Project (nutters!) protocol family. |
|
| - | 277 | */ |
|
| 206 | #define PF_SNA AF_SNA |
278 | #define PF_SNA AF_SNA |
| - | 279 | ||
| - | 280 | /** IRDA sockets protocol family. |
|
| - | 281 | */ |
|
| 207 | #define PF_IRDA AF_IRDA |
282 | #define PF_IRDA AF_IRDA |
| - | 283 | ||
| - | 284 | /** PPPoX sockets protocol family. |
|
| - | 285 | */ |
|
| 208 | #define PF_PPPOX AF_PPPOX |
286 | #define PF_PPPOX AF_PPPOX |
| - | 287 | ||
| - | 288 | /** Wanpipe API Sockets protocol family. |
|
| - | 289 | */ |
|
| 209 | #define PF_WANPIPE AF_WANPIPE |
290 | #define PF_WANPIPE AF_WANPIPE |
| - | 291 | ||
| - | 292 | /** Linux LLC protocol family. |
|
| - | 293 | */ |
|
| 210 | #define PF_LLC AF_LLC |
294 | #define PF_LLC AF_LLC |
| - | 295 | ||
| - | 296 | /** Controller Area Network protocol family. |
|
| - | 297 | */ |
|
| 211 | #define PF_CAN AF_CAN |
298 | #define PF_CAN AF_CAN |
| - | 299 | ||
| - | 300 | /** TIPC sockets protocol family. |
|
| - | 301 | */ |
|
| 212 | #define PF_TIPC AF_TIPC |
302 | #define PF_TIPC AF_TIPC |
| - | 303 | ||
| - | 304 | /** Bluetooth sockets protocol family. |
|
| - | 305 | */ |
|
| 213 | #define PF_BLUETOOTH AF_BLUETOOTH |
306 | #define PF_BLUETOOTH AF_BLUETOOTH |
| - | 307 | ||
| - | 308 | /** IUCV sockets protocol family. |
|
| - | 309 | */ |
|
| 214 | #define PF_IUCV AF_IUCV |
310 | #define PF_IUCV AF_IUCV |
| - | 311 | ||
| - | 312 | /** RxRPC sockets protocol family. |
|
| - | 313 | */ |
|
| 215 | #define PF_RXRPC AF_RXRPC |
314 | #define PF_RXRPC AF_RXRPC |
| - | 315 | ||
| - | 316 | /** Maximum protocol family. |
|
| - | 317 | */ |
|
| 216 | #define PF_MAX AF_MAX |
318 | #define PF_MAX AF_MAX |
| - | 319 | /*@}*/ |
|
| 217 | 320 | ||
| - | 321 | /** @name Socket option levels definitions |
|
| 218 | /* Setsockoptions(2) level. Thanks to BSD these must match IPPROTO_xxx */ |
322 | * Thanks to BSD these must match IPPROTO_xxx |
| - | 323 | */ |
|
| - | 324 | /*@{*/ |
|
| - | 325 | ||
| - | 326 | /** IP socket option level. |
|
| - | 327 | */ |
|
| 219 | #define SOL_IP 0 |
328 | #define SOL_IP 0 |
| - | 329 | ||
| - | 330 | /** ICMP socket option level. |
|
| - | 331 | */ |
|
| 220 | #define SOL_ICMP 1 |
332 | #define SOL_ICMP 1 |
| - | 333 | ||
| - | 334 | /** TCP socket option level. |
|
| - | 335 | */ |
|
| 221 | #define SOL_TCP 6 |
336 | #define SOL_TCP 6 |
| - | 337 | ||
| - | 338 | /** UDP socket option level. |
|
| - | 339 | */ |
|
| 222 | #define SOL_UDP 17 |
340 | #define SOL_UDP 17 |
| - | 341 | ||
| - | 342 | /** IPV socket option level. |
|
| - | 343 | */ |
|
| 223 | #define SOL_IPV6 41 |
344 | #define SOL_IPV6 41 |
| - | 345 | ||
| - | 346 | /** ICMPV socket option level. |
|
| - | 347 | */ |
|
| 224 | #define SOL_ICMPV6 58 |
348 | #define SOL_ICMPV6 58 |
| - | 349 | ||
| - | 350 | /** SCTP socket option level. |
|
| - | 351 | */ |
|
| 225 | #define SOL_SCTP 132 |
352 | #define SOL_SCTP 132 |
| - | 353 | ||
| - | 354 | /** UDP-Lite (RFC 3828) socket option level. |
|
| - | 355 | */ |
|
| 226 | #define SOL_UDPLITE 136 /* UDP-Lite (RFC 3828) */ |
356 | #define SOL_UDPLITE 136 |
| - | 357 | ||
| - | 358 | /** RAW socket option level. |
|
| - | 359 | */ |
|
| 227 | #define SOL_RAW 255 |
360 | #define SOL_RAW 255 |
| - | 361 | ||
| - | 362 | /** IPX socket option level. |
|
| - | 363 | */ |
|
| 228 | #define SOL_IPX 256 |
364 | #define SOL_IPX 256 |
| - | 365 | ||
| - | 366 | /** AX socket option level. |
|
| - | 367 | */ |
|
| 229 | #define SOL_AX25 257 |
368 | #define SOL_AX25 257 |
| - | 369 | ||
| - | 370 | /** ATALK socket option level. |
|
| - | 371 | */ |
|
| 230 | #define SOL_ATALK 258 |
372 | #define SOL_ATALK 258 |
| - | 373 | ||
| - | 374 | /** NETROM socket option level. |
|
| - | 375 | */ |
|
| 231 | #define SOL_NETROM 259 |
376 | #define SOL_NETROM 259 |
| - | 377 | ||
| - | 378 | /** ROSE socket option level. |
|
| - | 379 | */ |
|
| 232 | #define SOL_ROSE 260 |
380 | #define SOL_ROSE 260 |
| - | 381 | ||
| - | 382 | /** DECNET socket option level. |
|
| - | 383 | */ |
|
| 233 | #define SOL_DECNET 261 |
384 | #define SOL_DECNET 261 |
| - | 385 | ||
| - | 386 | /** X25 socket option level. |
|
| - | 387 | */ |
|
| 234 | #define SOL_X25 262 |
388 | #define SOL_X25 262 |
| - | 389 | ||
| - | 390 | /** PACKET socket option level. |
|
| - | 391 | */ |
|
| 235 | #define SOL_PACKET 263 |
392 | #define SOL_PACKET 263 |
| - | 393 | ||
| - | 394 | /** ATM layer (cell level) socket option level. |
|
| - | 395 | */ |
|
| 236 | #define SOL_ATM 264 /* ATM layer (cell level) */ |
396 | #define SOL_ATM 264 |
| - | 397 | ||
| 237 | #define SOL_AAL 265 /* ATM Adaption Layer (packet level) */ |
398 | /** ATM Adaption Layer (packet level) socket option level. |
| - | 399 | */ |
|
| - | 400 | #define SOL_AAL 265 |
|
| - | 401 | ||
| - | 402 | /** IRDA socket option level. |
|
| - | 403 | */ |
|
| 238 | #define SOL_IRDA 266 |
404 | #define SOL_IRDA 266 |
| - | 405 | ||
| - | 406 | /** NETBEUI socket option level. |
|
| - | 407 | */ |
|
| 239 | #define SOL_NETBEUI 267 |
408 | #define SOL_NETBEUI 267 |
| - | 409 | ||
| - | 410 | /** LLC socket option level. |
|
| - | 411 | */ |
|
| 240 | #define SOL_LLC 268 |
412 | #define SOL_LLC 268 |
| - | 413 | ||
| - | 414 | /** DCCP socket option level. |
|
| - | 415 | */ |
|
| 241 | #define SOL_DCCP 269 |
416 | #define SOL_DCCP 269 |
| - | 417 | ||
| - | 418 | /** NETLINK socket option level. |
|
| - | 419 | */ |
|
| 242 | #define SOL_NETLINK 270 |
420 | #define SOL_NETLINK 270 |
| - | 421 | ||
| - | 422 | /** TIPC socket option level. |
|
| - | 423 | */ |
|
| 243 | #define SOL_TIPC 271 |
424 | #define SOL_TIPC 271 |
| - | 425 | ||
| - | 426 | /** RXRPC socket option level. |
|
| - | 427 | */ |
|
| 244 | #define SOL_RXRPC 272 |
428 | #define SOL_RXRPC 272 |
| - | 429 | ||
| - | 430 | /** PPPOL socket option level. |
|
| - | 431 | */ |
|
| 245 | #define SOL_PPPOL2TP 273 |
432 | #define SOL_PPPOL2TP 273 |
| - | 433 | ||
| - | 434 | /** BLUETOOTH socket option level. |
|
| - | 435 | */ |
|
| 246 | #define SOL_BLUETOOTH 274 |
436 | #define SOL_BLUETOOTH 274 |
| 247 | 437 | ||
| - | 438 | /*@}*/ |
|
| - | 439 | ||
| 248 | // |
440 | // |
| 249 | /* * IPX options. |
441 | /* * IPX options. |
| 250 | */ |
442 | */ |
| 251 | //#define IPX_TYPE 1 |
443 | //#define IPX_TYPE 1 |
| 252 | 444 | ||
| 253 | /** Socket type type definition. |
445 | /** Socket types. |
| 254 | */ |
446 | */ |
| 255 | typedef enum sock_type{ |
447 | typedef enum sock_type{ |
| 256 | /** Stream (connection oriented) socket. |
448 | /** Stream (connection oriented) socket. |
| 257 | */ |
449 | */ |
| 258 | SOCK_STREAM = 1, |
450 | SOCK_STREAM = 1, |
| Line 262... | Line 454... | ||
| 262 | /** Raw socket. |
454 | /** Raw socket. |
| 263 | */ |
455 | */ |
| 264 | SOCK_RAW = 3 |
456 | SOCK_RAW = 3 |
| 265 | } sock_type_t; |
457 | } sock_type_t; |
| 266 | 458 | ||
| - | 459 | /** Type definition of the socket length. |
|
| - | 460 | */ |
|
| 267 | typedef int32_t socklen_t; |
461 | typedef int32_t socklen_t; |
| 268 | 462 | ||
| - | 463 | /** @name Socket application programming interface |
|
| - | 464 | */ |
|
| - | 465 | /*@{*/ |
|
| - | 466 | ||
| - | 467 | /** Creates a new socket. |
|
| - | 468 | * @param domain The socket protocol family. Input parameter. |
|
| - | 469 | * @param type Socket type. Input parameter. |
|
| - | 470 | * @param protocol Socket protocol. Input parameter. |
|
| - | 471 | * @returns The socket identifier on success. |
|
| - | 472 | * @returns EPFNOTSUPPORT if the protocol family is not supported. |
|
| - | 473 | * @returns ESOCKNOTSUPPORT if the socket type is not supported. |
|
| - | 474 | * @returns EPROTONOSUPPORT if the protocol is not supported. |
|
| - | 475 | * @returns ENOMEM if there is not enough memory left. |
|
| - | 476 | * @returns Other error codes as defined for the NET_SOCKET message. |
|
| - | 477 | */ |
|
| 269 | int socket( int domain, int type, int protocol ); |
478 | int socket( int domain, int type, int protocol ); |
| - | 479 | ||
| - | 480 | /** Binds the socket to a port address. |
|
| - | 481 | * @param socket_id Socket identifier. Input parameter. |
|
| - | 482 | * @param my_addr The port address. Input parameter. |
|
| - | 483 | * @param addrlen The address length. Input parameter. |
|
| - | 484 | * @returns EOK on success. |
|
| - | 485 | * @returns ENOTSOCK if the socket is not found. |
|
| - | 486 | * @returns EBADMEM if the my_addr parameter is NULL. |
|
| - | 487 | * @returns NO_DATA if the addlen parameter is zero (0). |
|
| - | 488 | * @returns Other error codes as defined for the NET_SOCKET_BIND message. |
|
| - | 489 | */ |
|
| 270 | int bind( int socket_id, const struct sockaddr * my_addr, socklen_t addrlen ); |
490 | int bind( int socket_id, const struct sockaddr * my_addr, socklen_t addrlen ); |
| - | 491 | ||
| - | 492 | /** Sets the number of connections waiting to be accepted. |
|
| - | 493 | * @param socket_id Socket identifier. Input parameter. |
|
| - | 494 | * @param backlog The maximum number of waiting sockets to be accepted. Input parameter. |
|
| - | 495 | * @returns EOK on success. |
|
| - | 496 | * @returns EINVAL if the backlog parameter is not positive (<=0). |
|
| - | 497 | * @returns ENOTSOCK if the socket is not found. |
|
| - | 498 | * @returns Other error codes as defined for the NET_SOCKET_LISTEN message. |
|
| - | 499 | */ |
|
| 271 | int listen( int socket_id, int backlog ); |
500 | int listen( int socket_id, int backlog ); |
| - | 501 | ||
| - | 502 | /** Accepts waiting socket. |
|
| - | 503 | * Blocks until such a socket exists. |
|
| - | 504 | * @param socket_id Socket identifier. Input parameter. |
|
| - | 505 | * @param cliaddr The remote client address. Output parameter. |
|
| - | 506 | * @param addrlen The address length. Input parameter. |
|
| - | 507 | * @returns EOK on success. |
|
| - | 508 | * @returns EBADMEM if the cliaddr or addrlen parameter is NULL. |
|
| - | 509 | * @returns EINVAL if the backlog parameter is not positive (<=0). |
|
| - | 510 | * @returns ENOTSOCK if the socket is not found. |
|
| - | 511 | * @returns Other error codes as defined for the NET_SOCKET_ACCEPT message. |
|
| - | 512 | */ |
|
| 272 | int accept( int socket_id, struct sockaddr * cliaddr, socklen_t * addrlen ); |
513 | int accept( int socket_id, struct sockaddr * cliaddr, socklen_t * addrlen ); |
| - | 514 | ||
| - | 515 | /** Connects socket to the remote server. |
|
| - | 516 | * @param socket_id Socket identifier. Input parameter. |
|
| - | 517 | * @param serv_addr The remote server address. Input parameter. |
|
| - | 518 | * @param addrlen The address length. Input parameter. |
|
| - | 519 | * @returns EOK on success. |
|
| - | 520 | * @returns EBADMEM if the serv_addr parameter is NULL. |
|
| - | 521 | * @returns NO_DATA if the addlen parameter is zero (0). |
|
| - | 522 | * @returns ENOTSOCK if the socket is not found. |
|
| - | 523 | * @returns Other error codes as defined for the NET_SOCKET_CONNECT message. |
|
| - | 524 | */ |
|
| 273 | int connect( int socket_id, const struct sockaddr * serv_addr, socklen_t addrlen ); |
525 | int connect( int socket_id, const struct sockaddr * serv_addr, socklen_t addrlen ); |
| 274 | 526 | ||
| - | 527 | /** Closes the socket. |
|
| - | 528 | * @param socket_id Socket identifier. Input parameter. |
|
| - | 529 | * @returns EOK on success. |
|
| - | 530 | * @returns ENOTSOCK if the socket is not found. |
|
| - | 531 | * @returns Other error codes as defined for the NET_SOCKET_CLOSE message. |
|
| - | 532 | */ |
|
| 275 | int closesocket( int socket_id ); |
533 | int closesocket( int socket_id ); |
| 276 | 534 | ||
| - | 535 | /** Sends data via the socket. |
|
| - | 536 | * @param socket_id Socket identifier. Input parameter. |
|
| - | 537 | * @param data The data to be sent. Input parameter. |
|
| - | 538 | * @param datalength The data length. Input parameter. |
|
| - | 539 | * @param flags Various send flags. Input parameter. |
|
| - | 540 | * @returns EOK on success. |
|
| - | 541 | * @returns ENOTSOCK if the socket is not found. |
|
| - | 542 | * @returns EBADMEM if the data parameter is NULL. |
|
| - | 543 | * @returns NO_DATA if the datalength parameter is zero (0). |
|
| - | 544 | * @returns Other error codes as defined for the NET_SOCKET_SEND message. |
|
| - | 545 | */ |
|
| 277 | int send( int socket_id, void * data, size_t datalength, int flags ); |
546 | int send( int socket_id, void * data, size_t datalength, int flags ); |
| - | 547 | ||
| - | 548 | /** Sends data via the socket to the remote address. |
|
| - | 549 | * Binds the socket to a free port if not already connected/bound. |
|
| - | 550 | * @param socket_id Socket identifier. Input parameter. |
|
| - | 551 | * @param data The data to be sent. Input parameter. |
|
| - | 552 | * @param datalength The data length. Input parameter. |
|
| - | 553 | * @param flags Various send flags. Input parameter. |
|
| - | 554 | * @param toaddr The destination address. Input parameter. |
|
| - | 555 | * @param addrlen The address length. Input parameter. |
|
| - | 556 | * @returns EOK on success. |
|
| - | 557 | * @returns ENOTSOCK if the socket is not found. |
|
| - | 558 | * @returns EBADMEM if the data or toaddr parameter is NULL. |
|
| - | 559 | * @returns NO_DATA if the datalength or the addrlen parameter is zero (0). |
|
| - | 560 | * @returns Other error codes as defined for the NET_SOCKET_SENDTO message. |
|
| - | 561 | */ |
|
| 278 | int sendto( int socket_id, const void * data, size_t datalength, int flags, const struct sockaddr * toaddr, socklen_t addrlen ); |
562 | int sendto( int socket_id, const void * data, size_t datalength, int flags, const struct sockaddr * toaddr, socklen_t addrlen ); |
| 279 | 563 | ||
| - | 564 | /** Receives data via the socket. |
|
| - | 565 | * @param socket_id Socket identifier. Input parameter. |
|
| - | 566 | * @param data The data buffer to be filled. Output parameter. |
|
| - | 567 | * @param datalength The data length. Input parameter. |
|
| - | 568 | * @param flags Various receive flags. Input parameter. |
|
| - | 569 | * @returns EOK on success. |
|
| - | 570 | * @returns ENOTSOCK if the socket is not found. |
|
| - | 571 | * @returns EBADMEM if the data parameter is NULL. |
|
| - | 572 | * @returns NO_DATA if the datalength parameter is zero (0). |
|
| - | 573 | * @returns Other error codes as defined for the NET_SOCKET_RECV message. |
|
| - | 574 | */ |
|
| 280 | int recv( int socket_id, void * data, size_t datalength, int flags ); |
575 | int recv( int socket_id, void * data, size_t datalength, int flags ); |
| - | 576 | ||
| - | 577 | /** Receives data via the socket. |
|
| - | 578 | * @param socket_id Socket identifier. Input parameter. |
|
| - | 579 | * @param data The data buffer to be filled. Output parameter. |
|
| - | 580 | * @param datalength The data length. Input parameter. |
|
| - | 581 | * @param flags Various receive flags. Input parameter. |
|
| - | 582 | * @param fromaddr The source address. Output parameter. |
|
| - | 583 | * @param addrlen The address length. The maximum address length is read. The actual address length is set. Input/output parameter. |
|
| - | 584 | * @returns EOK on success. |
|
| - | 585 | * @returns ENOTSOCK if the socket is not found. |
|
| - | 586 | * @returns EBADMEM if the data or fromaddr parameter is NULL. |
|
| - | 587 | * @returns NO_DATA if the datalength or addrlen parameter is zero (0). |
|
| - | 588 | * @returns Other error codes as defined for the NET_SOCKET_RECVFROM message. |
|
| - | 589 | */ |
|
| 281 | int recvfrom( int socket_id, void * data, size_t datalength, int flags, struct sockaddr * fromaddr, socklen_t * addrlen ); |
590 | int recvfrom( int socket_id, void * data, size_t datalength, int flags, struct sockaddr * fromaddr, socklen_t * addrlen ); |
| 282 | 591 | ||
| - | 592 | /** Gets socket option. |
|
| - | 593 | * @param socket_id Socket identifier. Input parameter. |
|
| - | 594 | * @param level The socket options level. Input parameter. |
|
| - | 595 | * @param optname The socket option to be get. Input parameter. |
|
| - | 596 | * @param value The value buffer to be filled. Output parameter. |
|
| - | 597 | * @param optlen The value buffer length. The maximum length is read. The actual length is set. Input/output parameter. |
|
| - | 598 | * @returns EOK on success. |
|
| - | 599 | * @returns ENOTSOCK if the socket is not found. |
|
| - | 600 | * @returns EBADMEM if the value or optlen parameter is NULL. |
|
| - | 601 | * @returns NO_DATA if the optlen parameter is zero (0). |
|
| - | 602 | * @returns Other error codes as defined for the NET_SOCKET_GETSOCKOPT message. |
|
| - | 603 | */ |
|
| 283 | int getsockopt( int socket_id, int level, int optname, void * value, size_t * optlen ); |
604 | int getsockopt( int socket_id, int level, int optname, void * value, size_t * optlen ); |
| - | 605 | ||
| - | 606 | /** Sets socket option. |
|
| - | 607 | * @param socket_id Socket identifier. Input parameter. |
|
| - | 608 | * @param level The socket options level. Input parameter. |
|
| - | 609 | * @param optname The socket option to be set. Input parameter. |
|
| - | 610 | * @param value The value to be set. Input parameter. |
|
| - | 611 | * @param optlen The value length. Input parameter. |
|
| - | 612 | * @returns EOK on success. |
|
| - | 613 | * @returns ENOTSOCK if the socket is not found. |
|
| - | 614 | * @returns EBADMEM if the value parameter is NULL. |
|
| - | 615 | * @returns NO_DATA if the optlen parameter is zero (0). |
|
| - | 616 | * @returns Other error codes as defined for the NET_SOCKET_SETSOCKOPT message. |
|
| - | 617 | */ |
|
| 284 | int setsockopt( int socket_id, int level, int optname, const void * value, size_t optlen ); |
618 | int setsockopt( int socket_id, int level, int optname, const void * value, size_t optlen ); |
| 285 | 619 | ||
| - | 620 | /*@}*/ |
|
| - | 621 | ||
| 286 | #endif |
622 | #endif |
| 287 | 623 | ||
| 288 | /** @} |
624 | /** @} |
| 289 | */ |
625 | */ |