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