epoc32/include/libc/sys/socket.h
author William Roberts <williamr@symbian.org>
Tue, 16 Mar 2010 16:12:26 +0000 (2010-03-16)
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
child 4 837f303aceeb
permissions -rw-r--r--
Final list of Symbian^2 public API header files
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 
    17 
    18 /**
    19  @file
    20  @publishedAll
    21  @released
    22 */
    23 
    24 #ifndef	_SYS_SOCKET_H
    25 #define	_SYS_SOCKET_H
    26 
    27 #include "_ansi.h"
    28 
    29 #ifdef	__cplusplus
    30 extern "C" {
    31 #endif
    32 
    33 /*
    34 Types - may be extended by individual protocols
    35 */
    36 #define	SOCK_STREAM	1		///< stream socket
    37 #define	SOCK_DGRAM	2		///< datagram socket
    38 #define	SOCK_SEQPACKET	3	///< sequenced packet stream
    39 #define	SOCK_RAW	4		///< raw-protocol interface
    40 
    41 /*
    42 Options for use with [gs]etsockopt at the socket level.
    43 Note: Symbian OS setsockopt() ignores the options with values <= 0.
    44 */
    45 #define	SOL_SOCKET	1		///< options for socket level
    46 
    47 #define	SO_DEBUG	1		///< turn on debugging info recording
    48 #define	SO_RCVBUF	2		///< receive buffer size
    49 #define	SO_SNDBUF	3		///< send buffer size
    50 #define	SO_ERROR	9		///< get error status and clear
    51 #define	SO_REUSEADDR	0x406		///< reuse local addresses
    52 #define	SO_BROADCAST	-1	///< permit sending of broadcast msgs, not supported in Symbian OS
    53 #define	SO_USELOOPBACK	-2	///< bypass hardware when possible, not supported in Symbian OS
    54 #define	SO_LINGER	    -3  ///< linger on close if data present, not supported in Symbian OS
    55 #define	SO_OOBINLINE	-4	///< leave received OOB data in line, not supported in Symbian OS
    56 
    57 /*
    58 Address families - for EPOC32 these are based on the protocol IDs.
    59 */
    60 #define	AF_UNSPEC	0		///< unspecified
    61 #define	AF_LOCAL	0x666	///< local to host (pipes)
    62 #define	AF_INET		0x0800	///< internetwork: UDP, TCP, etc.
    63 #define	AF_IRDA		0x0100	///< IrDA
    64 #define AF_PLP		273		///< Symbian link protocol
    65 
    66 /*
    67 Protocol families, same as address families
    68 */
    69 #define	PF_UNSPEC	AF_UNSPEC
    70 #define	PF_LOCAL	AF_LOCAL
    71 #define	PF_INET		AF_INET
    72 #define	PF_IRDA		AF_IRDA
    73 #define PF_PLP		AF_PLP
    74 
    75 /**
    76 Structure used by EPOC32 to store most addresses.
    77 NB. EPOC32 uses 32-bit family and port numbers internally, but they have been
    78 left as shorts here for compatibility with code that uses htons()/ntohs() explicitly.
    79 */
    80 struct sockaddr {
    81 	u_short	sa_family;		/* address family */
    82 	u_short sa_port;		/* port number - a common feature of most protocols */
    83 	char	sa_data[24];		/* up to 24 bytes of direct address */
    84 };
    85 
    86 #define	SOMAXCONN	5 ///< Maximum queue length specifiable by listen
    87 
    88 #define	MSG_PEEK	1 ///< peek at incoming message
    89 #define	MSG_OOB		1 ///< write out-of-band data
    90 
    91 IMPORT_C int accept(int, struct sockaddr *, size_t *);
    92 IMPORT_C int bind(int, struct sockaddr *, size_t);
    93 IMPORT_C int connect(int, struct sockaddr *, size_t);
    94 IMPORT_C int getpeername(int, struct sockaddr *, size_t *);
    95 IMPORT_C int getsockname(int, struct sockaddr *, size_t *);
    96 IMPORT_C int getsockopt(int, int, int, void *, size_t *);
    97 IMPORT_C int listen(int, int);
    98 IMPORT_C int recv(int, char *, size_t, int);
    99 IMPORT_C int recvfrom(int, char *, size_t, int, struct sockaddr *, size_t *);
   100 IMPORT_C int send(int, const char *, size_t, int);
   101 IMPORT_C int sendto(int, const char *, size_t, int, struct sockaddr *, size_t);
   102 IMPORT_C int setsockopt(int, int, int, void *, size_t);
   103 IMPORT_C int socket(int, int, int);
   104 IMPORT_C int shutdown(int, int);
   105 
   106 #ifdef	__cplusplus
   107 }
   108 #endif
   109 
   110 #endif	/* _SYS_SOCKET_H */