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