sl@0: // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0: // All rights reserved.
sl@0: // This component and the accompanying materials are made available
sl@0: // under the terms of "Eclipse Public License v1.0"
sl@0: // which accompanies this distribution, and is available
sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0: //
sl@0: // Initial Contributors:
sl@0: // Nokia Corporation - initial contribution.
sl@0: //
sl@0: // Contributors:
sl@0: //
sl@0: // Description:
sl@0: //
sl@0: 
sl@0: /**
sl@0:  @file
sl@0:  @publishedAll
sl@0:  @released
sl@0: */
sl@0: 
sl@0: #ifndef	_SYS_SOCKET_H
sl@0: #define	_SYS_SOCKET_H
sl@0: 
sl@0: #include "_ansi.h"
sl@0: 
sl@0: #ifdef	__cplusplus
sl@0: extern "C" {
sl@0: #endif
sl@0: #include <sys/types.h>
sl@0: /*
sl@0: Types - may be extended by individual protocols
sl@0: */
sl@0: #define	SOCK_STREAM	1		//< stream socket
sl@0: #define	SOCK_DGRAM	2		//< datagram socket
sl@0: #define	SOCK_SEQPACKET	3	//< sequenced packet stream
sl@0: #define	SOCK_RAW	4		//< raw-protocol interface
sl@0: 
sl@0: /*
sl@0: Options for use with [gs]etsockopt at the socket level.
sl@0: Note: Symbian OS setsockopt() ignores the options with values <= 0.
sl@0: */
sl@0: #define	SOL_SOCKET	1		//< options for socket level
sl@0: 
sl@0: #define	SO_DEBUG	1		//< turn on debugging info recording
sl@0: #define	SO_RCVBUF	2		//< receive buffer size
sl@0: #define	SO_SNDBUF	3		//< send buffer size
sl@0: #define	SO_ERROR	9		//< get error status and clear
sl@0: #define	SO_REUSEADDR	0x406		//< reuse local addresses
sl@0: #define	SO_BROADCAST	-1	//< permit sending of broadcast msgs, not supported in Symbian OS
sl@0: #define	SO_USELOOPBACK	-2	//< bypass hardware when possible, not supported in Symbian OS
sl@0: #define	SO_LINGER	    -3  //< linger on close if data present, not supported in Symbian OS
sl@0: #define	SO_OOBINLINE	-4	//< leave received OOB data in line, not supported in Symbian OS
sl@0: 
sl@0: /*
sl@0: Address families - for EPOC32 these are based on the protocol IDs.
sl@0: */
sl@0: #define	AF_UNSPEC	0		//< unspecified
sl@0: #define	AF_LOCAL	0x666	//< local to host (pipes)
sl@0: #define	AF_INET		0x0800	//< internetwork: UDP, TCP, etc.
sl@0: #define	AF_IRDA		0x0100	//< IrDA
sl@0: #define AF_PLP		273		//< Symbian link protocol
sl@0: 
sl@0: /*
sl@0: Protocol families, same as address families
sl@0: */
sl@0: #define	PF_UNSPEC	AF_UNSPEC
sl@0: #define	PF_LOCAL	AF_LOCAL
sl@0: #define	PF_INET		AF_INET
sl@0: #define	PF_IRDA		AF_IRDA
sl@0: #define PF_PLP		AF_PLP
sl@0: 
sl@0: /**
sl@0: Structure used by EPOC32 to store most addresses.
sl@0: NB. EPOC32 uses 32-bit family and port numbers internally, but they have been
sl@0: left as shorts here for compatibility with code that uses htons()/ntohs() explicitly.
sl@0: */
sl@0: struct sockaddr {
sl@0: 	u_short	sa_family;		/* address family */
sl@0: 	u_short sa_port;		/* port number - a common feature of most protocols */
sl@0: 	char	sa_data[24];		/* up to 24 bytes of direct address */
sl@0: };
sl@0: 
sl@0: #define	SOMAXCONN	5 //< Maximum queue length specifiable by listen
sl@0: 
sl@0: #define	MSG_PEEK	1 //< peek at incoming message
sl@0: #define	MSG_OOB		1 //< write out-of-band data
sl@0: 
sl@0: IMPORT_C int accept(int, struct sockaddr *, size_t *);
sl@0: IMPORT_C int bind(int, struct sockaddr *, size_t);
sl@0: IMPORT_C int connect(int, struct sockaddr *, size_t);
sl@0: IMPORT_C int getpeername(int, struct sockaddr *, size_t *);
sl@0: IMPORT_C int getsockname(int, struct sockaddr *, size_t *);
sl@0: IMPORT_C int getsockopt(int, int, int, void *, size_t *);
sl@0: IMPORT_C int listen(int, int);
sl@0: IMPORT_C int recv(int, char *, size_t, int);
sl@0: IMPORT_C int recvfrom(int, char *, size_t, int, struct sockaddr *, size_t *);
sl@0: IMPORT_C int send(int, const char *, size_t, int);
sl@0: IMPORT_C int sendto(int, const char *, size_t, int, struct sockaddr *, size_t);
sl@0: IMPORT_C int setsockopt(int, int, int, void *, size_t);
sl@0: IMPORT_C int socket(int, int, int);
sl@0: IMPORT_C int shutdown(int, int);
sl@0: 
sl@0: #ifdef	__cplusplus
sl@0: }
sl@0: #endif
sl@0: 
sl@0: #endif	/* _SYS_SOCKET_H */