blob: 6dfbaf291ec398bffab7f539d29f2d080efe141c [file] [log] [blame]
Benny Prijono4766ffe2005-11-01 17:56:59 +00001/* $Id$
2 *
3 */
Benny Prijonodd859a62005-11-01 16:42:51 +00004
5#ifndef __PJ_SOCK_H__
6#define __PJ_SOCK_H__
7
8/**
9 * @file sock.h
10 * @brief Socket Abstraction.
11 */
12
13#include <pj/types.h>
14
15PJ_BEGIN_DECL
16
17
18/**
19 * @defgroup PJ_SOCK Socket Abstraction
20 * @ingroup PJ_IO
21 * @{
22 *
23 * The PJLIB socket abstraction layer is a thin and very portable abstraction
24 * for socket API. It provides API similar to BSD socket API. The abstraction
25 * is needed because BSD socket API is not always available on all platforms,
26 * therefore it wouldn't be possible to create a trully portable network
27 * programs unless we provide such abstraction.
28 *
29 * Applications can use this API directly in their application, just
30 * as they would when using traditional BSD socket API, provided they
31 * call #pj_init() first.
32 *
33 * \section pj_sock_examples_sec Examples
34 *
35 * For some examples on how to use the socket API, please see:
36 *
37 * - \ref page_pjlib_sock_test
38 * - \ref page_pjlib_select_test
39 * - \ref page_pjlib_sock_perf_test
40 */
41
42
43/**
44 * Supported address families.
45 * APPLICATION MUST USE THESE VALUES INSTEAD OF NORMAL AF_*, BECAUSE
46 * THE LIBRARY WILL DO TRANSLATION TO THE NATIVE VALUE.
47 */
48extern const pj_uint16_t PJ_AF_UNIX; /**< Unix domain socket. */
49#define PJ_AF_LOCAL PJ_AF_UNIX; /**< POSIX name for AF_UNIX */
50extern const pj_uint16_t PJ_AF_INET; /**< Internet IP protocol. */
51extern const pj_uint16_t PJ_AF_INET6; /**< IP version 6. */
52extern const pj_uint16_t PJ_AF_PACKET; /**< Packet family. */
53extern const pj_uint16_t PJ_AF_IRDA; /**< IRDA sockets. */
54
55
56/**
57 * Supported types of sockets.
58 * APPLICATION MUST USE THESE VALUES INSTEAD OF NORMAL SOCK_*, BECAUSE
59 * THE LIBRARY WILL TRANSLATE THE VALUE TO THE NATIVE VALUE.
60 */
61
62extern const pj_uint16_t PJ_SOCK_STREAM; /**< Sequenced, reliable, connection-
63 based byte streams. */
64extern const pj_uint16_t PJ_SOCK_DGRAM; /**< Connectionless, unreliable
65 datagrams of fixed maximum
66 lengths. */
67extern const pj_uint16_t PJ_SOCK_RAW; /**< Raw protocol interface. */
68extern const pj_uint16_t PJ_SOCK_RDM; /**< Reliably-delivered messages. */
69
70
71/**
Benny Prijono4d974f32005-11-06 13:32:11 +000072 * Socket level specified in #pj_sock_setsockopt() or #pj_sock_getsockopt().
Benny Prijonodd859a62005-11-01 16:42:51 +000073 * APPLICATION MUST USE THESE VALUES INSTEAD OF NORMAL SOL_*, BECAUSE
74 * THE LIBRARY WILL TRANSLATE THE VALUE TO THE NATIVE VALUE.
75 */
76extern const pj_uint16_t PJ_SOL_SOCKET; /**< Socket level. */
77extern const pj_uint16_t PJ_SOL_IP; /**< IP level. */
78extern const pj_uint16_t PJ_SOL_TCP; /**< TCP level. */
79extern const pj_uint16_t PJ_SOL_UDP; /**< UDP level. */
80extern const pj_uint16_t PJ_SOL_IPV6; /**< IP version 6 */
Benny Prijono4d974f32005-11-06 13:32:11 +000081
82/**
83 * Values to be specified as \c optname when calling #pj_sock_setsockopt()
84 * or #pj_sock_getsockopt().
85 */
86extern const pj_uint16_t PJ_SO_TYPE; /**< Socket type. */
87extern const pj_uint16_t PJ_SO_RCVBUF; /**< Buffer size for receive. */
88extern const pj_uint16_t PJ_SO_SNDBUF; /**< Buffer size for send. */
89
Benny Prijonodd859a62005-11-01 16:42:51 +000090
91/**
92 * Flags to be specified in #pj_sock_recv, #pj_sock_send, etc.
93 */
94typedef enum pj_sock_msg_flag
95{
96 PJ_MSG_OOB = 0x01, /**< Out-of-band messages. */
97 PJ_MSG_PEEK = 0x02, /**< Peek, don't remove from buffer. */
98 PJ_MSG_DONTROUTE = 0x04, /**< Don't route. */
99} pj_sock_msg_flag;
100
101
102/**
103 * Flag to be specified in #pj_sock_shutdown.
104 */
105typedef enum pj_socket_sd_type
106{
107 PJ_SD_RECEIVE = 0, /**< No more receive. */
108 PJ_SHUT_RD = 0, /**< Alias for SD_RECEIVE. */
109 PJ_SD_SEND = 1, /**< No more sending. */
110 PJ_SHUT_WR = 1, /**< Alias for SD_SEND. */
111 PJ_SD_BOTH = 2, /**< No more send and receive. */
112 PJ_SHUT_RDWR = 2, /**< Alias for SD_BOTH. */
113} pj_socket_sd_type;
114
115
116
117/** Address to accept any incoming messages. */
118#define PJ_INADDR_ANY ((pj_uint32_t)0)
119
120/** Address indicating an error return */
121#define PJ_INADDR_NONE ((pj_uint32_t)0xffffffff)
122
123/** Address to send to all hosts. */
124#define PJ_INADDR_BROADCAST ((pj_uint32_t)0xffffffff)
125
126
127/**
128 * Maximum length specifiable by #pj_sock_listen().
129 * If the build system doesn't override this value, then the lowest
130 * denominator (five, in Win32 systems) will be used.
131 */
132#if !defined(PJ_SOMAXCONN)
133# define PJ_SOMAXCONN 5
134#endif
135
136
137/**
138 * Constant for invalid socket returned by #pj_sock_socket() and
139 * #pj_sock_accept().
140 */
141#define PJ_INVALID_SOCKET (-1)
142
143/**
144 * Structure describing a generic socket address.
145 */
146typedef struct pj_sockaddr
147{
148 pj_uint16_t sa_family; /**< Common data: address family. */
149 char sa_data[14]; /**< Address data. */
150} pj_sockaddr;
151
152
153/**
154 * This structure describes Internet address.
155 */
156typedef struct pj_in_addr
157{
158 pj_uint32_t s_addr; /**< The 32bit IP address. */
159} pj_in_addr;
160
161
162/**
163 * This structure describes Internet socket address.
164 */
165typedef struct pj_sockaddr_in
166{
167 pj_uint16_t sin_family; /**< Address family. */
168 pj_uint16_t sin_port; /**< Transport layer port number. */
169 pj_in_addr sin_addr; /**< IP address. */
170 char sin_zero[8]; /**< Padding. */
171} pj_sockaddr_in;
172
173
174/**
175 * This structure describes IPv6 address.
176 */
177typedef struct pj_in6_addr
178{
179 /** Union of address formats. */
180 union {
181 pj_uint8_t u6_addr8[16]; /**< u6_addr8 */
182 pj_uint16_t u6_addr16[8]; /**< u6_addr16 */
183 pj_uint32_t u6_addr32[4]; /**< u6_addr32 */
184 } in6_u;
185/** Shortcut to access in6_u.u6_addr8. */
186#define s6_addr in6_u.u6_addr8
187/** Shortcut to access in6_u.u6_addr16. */
188#define s6_addr16 in6_u.u6_addr16
189/** Shortcut to access in6_u.u6_addr32. */
190#define s6_addr32 in6_u.u6_addr32
191} pj_in6_addr;
192
193/** Initializer value for pj_in6_addr. */
194#define PJ_IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
195
196/** Initializer value for pj_in6_addr. */
197#define PJ_IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
198
199/**
200 * This structure describes IPv6 socket address.
201 */
202typedef struct pj_sockaddr_in6
203{
204 pj_uint16_t sin6_family; /**< Address family */
205 pj_uint16_t sin6_port; /**< Transport layer port number. */
206 pj_uint32_t sin6_flowinfo; /**< IPv6 flow information */
207 pj_in6_addr sin6_addr; /**< IPv6 address. */
208 pj_uint32_t sin6_scope_id; /**< IPv6 scope-id */
209} pj_sockaddr_in6;
210
211
212/*****************************************************************************
213 *
214 * SOCKET ADDRESS MANIPULATION.
215 *
216 *****************************************************************************
217 */
218
219/**
220 * Convert 16-bit value from network byte order to host byte order.
221 *
222 * @param netshort 16-bit network value.
223 * @return 16-bit host value.
224 */
225PJ_DECL(pj_uint16_t) pj_ntohs(pj_uint16_t netshort);
226
227/**
228 * Convert 16-bit value from host byte order to network byte order.
229 *
230 * @param hostshort 16-bit host value.
231 * @return 16-bit network value.
232 */
233PJ_DECL(pj_uint16_t) pj_htons(pj_uint16_t hostshort);
234
235/**
236 * Convert 32-bit value from network byte order to host byte order.
237 *
238 * @param netlong 32-bit network value.
239 * @return 32-bit host value.
240 */
241PJ_DECL(pj_uint32_t) pj_ntohl(pj_uint32_t netlong);
242
243/**
244 * Convert 32-bit value from host byte order to network byte order.
245 *
246 * @param hostlong 32-bit host value.
247 * @return 32-bit network value.
248 */
249PJ_DECL(pj_uint32_t) pj_htonl(pj_uint32_t hostlong);
250
251/**
252 * Convert an Internet host address given in network byte order
253 * to string in standard numbers and dots notation.
254 *
255 * @param inaddr The host address.
256 * @return The string address.
257 */
258PJ_DECL(char*) pj_inet_ntoa(pj_in_addr inaddr);
259
260/**
261 * This function converts the Internet host address cp from the standard
262 * numbers-and-dots notation into binary data and stores it in the structure
263 * that inp points to.
264 *
265 * @param cp IP address in standard numbers-and-dots notation.
266 * @param inp Structure that holds the output of the conversion.
267 *
268 * @return nonzero if the address is valid, zero if not.
269 */
270PJ_DECL(int) pj_inet_aton(const pj_str_t *cp, struct pj_in_addr *inp);
271
272/**
273 * Convert address string with numbers and dots to binary IP address.
274 *
275 * @param cp The IP address in numbers and dots notation.
276 * @return If success, the IP address is returned in network
277 * byte order. If failed, PJ_INADDR_NONE will be
278 * returned.
279 * @remark
280 * This is an obsolete interface to #pj_inet_aton(); it is obsolete
281 * because -1 is a valid address (255.255.255.255), and #pj_inet_aton()
282 * provides a cleaner way to indicate error return.
283 */
284PJ_DECL(pj_in_addr) pj_inet_addr(const pj_str_t *cp);
285
286
287/**
288 * Get the transport layer port number of an Internet socket address.
289 * The port is returned in host byte order.
290 *
291 * @param addr The IP socket address.
292 * @return Port number, in host byte order.
293 */
294PJ_INLINE(pj_uint16_t) pj_sockaddr_in_get_port(const pj_sockaddr_in *addr)
295{
296 return pj_ntohs(addr->sin_port);
297}
298
299/**
300 * Set the port number of an Internet socket address.
301 *
302 * @param addr The IP socket address.
303 * @param hostport The port number, in host byte order.
304 */
305PJ_INLINE(void) pj_sockaddr_in_set_port(pj_sockaddr_in *addr,
306 pj_uint16_t hostport)
307{
308 addr->sin_port = pj_htons(hostport);
309}
310
311/**
312 * Get the IP address of an Internet socket address.
313 * The address is returned as 32bit value in host byte order.
314 *
315 * @param addr The IP socket address.
316 * @return 32bit address, in host byte order.
317 */
318PJ_INLINE(pj_in_addr) pj_sockaddr_in_get_addr(const pj_sockaddr_in *addr)
319{
320 pj_in_addr in_addr;
321 in_addr.s_addr = pj_ntohl(addr->sin_addr.s_addr);
322 return in_addr;
323};
324
325/**
326 * Set the IP address of an Internet socket address.
327 *
328 * @param addr The IP socket address.
329 * @param hostaddr The host address, in host byte order.
330 */
331PJ_INLINE(void) pj_sockaddr_in_set_addr(pj_sockaddr_in *addr,
332 pj_uint32_t hostaddr)
333{
334 addr->sin_addr.s_addr = pj_htonl(hostaddr);
335}
336
337/**
338 * Set the IP address of an IP socket address from string address,
339 * with resolving the host if necessary. The string address may be in a
340 * standard numbers and dots notation or may be a hostname. If hostname
341 * is specified, then the function will resolve the host into the IP
342 * address.
343 *
344 * @param addr The IP socket address to be set.
345 * @param cp The address string, which can be in a standard
346 * dotted numbers or a hostname to be resolved.
347 *
348 * @return Zero on success.
349 */
350PJ_DECL(pj_status_t) pj_sockaddr_in_set_str_addr( pj_sockaddr_in *addr,
351 const pj_str_t *cp);
352
353/**
354 * Set the IP address and port of an IP socket address.
355 * The string address may be in a standard numbers and dots notation or
356 * may be a hostname. If hostname is specified, then the function will
357 * resolve the host into the IP address.
358 *
359 * @param addr The IP socket address to be set.
360 * @param cp The address string, which can be in a standard
361 * dotted numbers or a hostname to be resolved.
362 * @param port The port number, in host byte order.
363 *
364 * @return Zero on success.
365 */
366PJ_DECL(pj_status_t) pj_sockaddr_in_init( pj_sockaddr_in *addr,
367 const pj_str_t *cp,
368 pj_uint16_t port);
369
370
371/*****************************************************************************
372 *
373 * HOST NAME AND ADDRESS.
374 *
375 *****************************************************************************
376 */
377
378/**
379 * Get system's host name.
380 *
381 * @return The hostname, or empty string if the hostname can not
382 * be identified.
383 */
384PJ_DECL(const pj_str_t*) pj_gethostname(void);
385
386/**
387 * Get host's IP address, which the the first IP address that is resolved
388 * from the hostname.
389 *
390 * @return The host's IP address, PJ_INADDR_NONE if the host
391 * IP address can not be identified.
392 */
393PJ_DECL(pj_in_addr) pj_gethostaddr(void);
394
395
396/*****************************************************************************
397 *
398 * SOCKET API.
399 *
400 *****************************************************************************
401 */
402
403/**
404 * Create new socket/endpoint for communication.
405 *
406 * @param family Specifies a communication domain; this selects the
407 * protocol family which will be used for communication.
408 * @param type The socket has the indicated type, which specifies the
409 * communication semantics.
410 * @param protocol Specifies a particular protocol to be used with the
411 * socket. Normally only a single protocol exists to support
412 * a particular socket type within a given protocol family,
413 * in which a case protocol can be specified as 0.
414 * @param sock New socket descriptor, or PJ_INVALID_SOCKET on error.
415 *
416 * @return Zero on success.
417 */
418PJ_DECL(pj_status_t) pj_sock_socket(int family,
419 int type,
420 int protocol,
421 pj_sock_t *sock);
422
423/**
424 * Close the socket descriptor.
425 *
426 * @param sockfd The socket descriptor.
427 *
428 * @return Zero on success.
429 */
430PJ_DECL(pj_status_t) pj_sock_close(pj_sock_t sockfd);
Benny Prijono4d974f32005-11-06 13:32:11 +0000431
Benny Prijonodd859a62005-11-01 16:42:51 +0000432
433/**
434 * This function gives the socket sockfd the local address my_addr. my_addr is
435 * addrlen bytes long. Traditionally, this is called assigning a name to
436 * a socket. When a socket is created with #pj_sock_socket(), it exists in a
437 * name space (address family) but has no name assigned.
438 *
439 * @param sockfd The socket desriptor.
440 * @param my_addr The local address to bind the socket to.
441 * @param addrlen The length of the address.
442 *
443 * @return Zero on success.
444 */
445PJ_DECL(pj_status_t) pj_sock_bind( pj_sock_t sockfd,
446 const pj_sockaddr_t *my_addr,
447 int addrlen);
448
449/**
450 * Bind the IP socket sockfd to the given address and port.
451 *
452 * @param sockfd The socket descriptor.
453 * @param addr Local address to bind the socket to, in host byte order.
454 * @param port The local port to bind the socket to, in host byte order.
455 *
456 * @return Zero on success.
457 */
458PJ_DECL(pj_status_t) pj_sock_bind_in( pj_sock_t sockfd,
459 pj_uint32_t addr,
460 pj_uint16_t port);
461
462#if PJ_HAS_TCP
463/**
464 * Listen for incoming connection. This function only applies to connection
465 * oriented sockets (such as PJ_SOCK_STREAM or PJ_SOCK_SEQPACKET), and it
466 * indicates the willingness to accept incoming connections.
467 *
468 * @param sockfd The socket descriptor.
469 * @param backlog Defines the maximum length the queue of pending
470 * connections may grow to.
471 *
472 * @return Zero on success.
473 */
474PJ_DECL(pj_status_t) pj_sock_listen( pj_sock_t sockfd,
475 int backlog );
476
477/**
478 * Accept new connection on the specified connection oriented server socket.
479 *
480 * @param serverfd The server socket.
481 * @param newsock New socket on success, of PJ_INVALID_SOCKET if failed.
482 * @param addr A pointer to sockaddr type. If the argument is not NULL,
483 * it will be filled by the address of connecting entity.
484 * @param addrlen Initially specifies the length of the address, and upon
485 * return will be filled with the exact address length.
486 *
487 * @return Zero on success, or the error number.
488 */
489PJ_DECL(pj_status_t) pj_sock_accept( pj_sock_t serverfd,
490 pj_sock_t *newsock,
491 pj_sockaddr_t *addr,
492 int *addrlen);
493#endif
494
495/**
496 * The file descriptor sockfd must refer to a socket. If the socket is of
497 * type PJ_SOCK_DGRAM then the serv_addr address is the address to which
498 * datagrams are sent by default, and the only address from which datagrams
499 * are received. If the socket is of type PJ_SOCK_STREAM or PJ_SOCK_SEQPACKET,
500 * this call attempts to make a connection to another socket. The
501 * other socket is specified by serv_addr, which is an address (of length
502 * addrlen) in the communications space of the socket. Each communications
503 * space interprets the serv_addr parameter in its own way.
504 *
505 * @param sockfd The socket descriptor.
506 * @param serv_addr Server address to connect to.
507 * @param addrlen The length of server address.
508 *
509 * @return Zero on success.
510 */
511PJ_DECL(pj_status_t) pj_sock_connect( pj_sock_t sockfd,
512 const pj_sockaddr_t *serv_addr,
513 int addrlen);
514
515/**
516 * Return the address of peer which is connected to socket sockfd.
517 *
518 * @param sockfd The socket descriptor.
519 * @param addr Pointer to sockaddr structure to which the address
520 * will be returned.
521 * @param namelen Initially the length of the addr. Upon return the value
522 * will be set to the actual length of the address.
523 *
524 * @return Zero on success.
525 */
526PJ_DECL(pj_status_t) pj_sock_getpeername(pj_sock_t sockfd,
527 pj_sockaddr_t *addr,
528 int *namelen);
529
530/**
531 * Return the current name of the specified socket.
532 *
533 * @param sockfd The socket descriptor.
534 * @param addr Pointer to sockaddr structure to which the address
535 * will be returned.
536 * @param namelen Initially the length of the addr. Upon return the value
537 * will be set to the actual length of the address.
538 *
539 * @return Zero on success.
540 */
541PJ_DECL(pj_status_t) pj_sock_getsockname( pj_sock_t sockfd,
542 pj_sockaddr_t *addr,
543 int *namelen);
544
545/**
546 * Get socket option associated with a socket. Options may exist at multiple
547 * protocol levels; they are always present at the uppermost socket level.
548 *
549 * @param sockfd The socket descriptor.
550 * @param level The level which to get the option from.
Benny Prijono4d974f32005-11-06 13:32:11 +0000551 * @param optname The option name.
Benny Prijonodd859a62005-11-01 16:42:51 +0000552 * @param optval Identifies the buffer which the value will be
553 * returned.
554 * @param optlen Initially contains the length of the buffer, upon
555 * return will be set to the actual size of the value.
556 *
557 * @return Zero on success.
558 */
559PJ_DECL(pj_status_t) pj_sock_getsockopt( pj_sock_t sockfd,
Benny Prijono4d974f32005-11-06 13:32:11 +0000560 pj_uint16_t level,
561 pj_uint16_t optname,
Benny Prijonodd859a62005-11-01 16:42:51 +0000562 void *optval,
563 int *optlen);
564/**
565 * Manipulate the options associated with a socket. Options may exist at
566 * multiple protocol levels; they are always present at the uppermost socket
567 * level.
568 *
569 * @param sockfd The socket descriptor.
570 * @param level The level which to get the option from.
Benny Prijono4d974f32005-11-06 13:32:11 +0000571 * @param optname The option name.
Benny Prijonodd859a62005-11-01 16:42:51 +0000572 * @param optval Identifies the buffer which contain the value.
573 * @param optlen The length of the value.
574 *
575 * @return PJ_SUCCESS or the status code.
576 */
577PJ_DECL(pj_status_t) pj_sock_setsockopt( pj_sock_t sockfd,
Benny Prijono4d974f32005-11-06 13:32:11 +0000578 pj_uint16_t level,
579 pj_uint16_t optname,
Benny Prijonodd859a62005-11-01 16:42:51 +0000580 const void *optval,
581 int optlen);
582
583
584/**
585 * Receives data stream or message coming to the specified socket.
586 *
587 * @param sockfd The socket descriptor.
588 * @param buf The buffer to receive the data or message.
589 * @param len On input, the length of the buffer. On return,
590 * contains the length of data received.
591 * @param flags Combination of #pj_sock_msg_flag.
592 *
593 * @return PJ_SUCCESS or the error code.
594 */
595PJ_DECL(pj_status_t) pj_sock_recv(pj_sock_t sockfd,
596 void *buf,
597 pj_ssize_t *len,
598 unsigned flags);
599
600/**
601 * Receives data stream or message coming to the specified socket.
602 *
603 * @param sockfd The socket descriptor.
604 * @param buf The buffer to receive the data or message.
605 * @param len On input, the length of the buffer. On return,
606 * contains the length of data received.
607 * @param flags Bitmask combination of #pj_sock_msg_flag.
608 * @param from If not NULL, it will be filled with the source
609 * address of the connection.
610 * @param fromlen Initially contains the length of from address,
611 * and upon return will be filled with the actual
612 * length of the address.
613 *
614 * @return PJ_SUCCESS or the error code.
615 */
616PJ_DECL(pj_status_t) pj_sock_recvfrom( pj_sock_t sockfd,
617 void *buf,
618 pj_ssize_t *len,
619 unsigned flags,
620 pj_sockaddr_t *from,
621 int *fromlen);
622
623/**
624 * Transmit data to the socket.
625 *
626 * @param sockfd Socket descriptor.
627 * @param buf Buffer containing data to be sent.
628 * @param len On input, the length of the data in the buffer.
629 * Upon return, it will be filled with the length
630 * of data sent.
631 * @param flags Bitmask combination of #pj_sock_msg_flag.
632 *
633 * @return PJ_SUCCESS or the status code.
634 */
635PJ_DECL(pj_status_t) pj_sock_send(pj_sock_t sockfd,
636 const void *buf,
637 pj_ssize_t *len,
638 unsigned flags);
639
640/**
641 * Transmit data to the socket to the specified address.
642 *
643 * @param sockfd Socket descriptor.
644 * @param buf Buffer containing data to be sent.
645 * @param len On input, the length of the data in the buffer.
646 * Upon return, it will be filled with the length
647 * of data sent.
648 * @param flags Bitmask combination of #pj_sock_msg_flag.
649 * @param to The address to send.
650 * @param tolen The length of the address in bytes.
651 *
652 * @return The length of data successfully sent.
653 */
654PJ_DECL(pj_status_t) pj_sock_sendto(pj_sock_t sockfd,
655 const void *buf,
656 pj_ssize_t *len,
657 unsigned flags,
658 const pj_sockaddr_t *to,
659 int tolen);
660
661#if PJ_HAS_TCP
662/**
663 * The shutdown call causes all or part of a full-duplex connection on the
664 * socket associated with sockfd to be shut down.
665 *
666 * @param sockfd The socket descriptor.
667 * @param how If how is PJ_SHUT_RD, further receptions will be
668 * disallowed. If how is PJ_SHUT_WR, further transmissions
669 * will be disallowed. If how is PJ_SHUT_RDWR, further
670 * receptions andtransmissions will be disallowed.
671 *
672 * @return Zero on success.
673 */
674PJ_DECL(pj_status_t) pj_sock_shutdown( pj_sock_t sockfd,
675 int how);
676#endif
677
678/**
679 * @}
680 */
681
682
683PJ_END_DECL
684
685#endif /* __PJ_SOCK_H__ */
686