1.1 --- a/epoc32/include/libc/sys/socket.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/libc/sys/socket.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,110 @@
1.4 -socket.h
1.5 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +// All rights reserved.
1.7 +// This component and the accompanying materials are made available
1.8 +// 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
1.9 +// which accompanies this distribution, and is available
1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.11 +//
1.12 +// Initial Contributors:
1.13 +// Nokia Corporation - initial contribution.
1.14 +//
1.15 +// Contributors:
1.16 +//
1.17 +// Description:
1.18 +//
1.19 +
1.20 +
1.21 +
1.22 +/**
1.23 + @file
1.24 + @publishedAll
1.25 + @released
1.26 +*/
1.27 +
1.28 +#ifndef _SYS_SOCKET_H
1.29 +#define _SYS_SOCKET_H
1.30 +
1.31 +#include "_ansi.h"
1.32 +
1.33 +#ifdef __cplusplus
1.34 +extern "C" {
1.35 +#endif
1.36 +
1.37 +/*
1.38 +Types - may be extended by individual protocols
1.39 +*/
1.40 +#define SOCK_STREAM 1 ///< stream socket
1.41 +#define SOCK_DGRAM 2 ///< datagram socket
1.42 +#define SOCK_SEQPACKET 3 ///< sequenced packet stream
1.43 +#define SOCK_RAW 4 ///< raw-protocol interface
1.44 +
1.45 +/*
1.46 +Options for use with [gs]etsockopt at the socket level.
1.47 +Note: Symbian OS setsockopt() ignores the options with values <= 0.
1.48 +*/
1.49 +#define SOL_SOCKET 1 ///< options for socket level
1.50 +
1.51 +#define SO_DEBUG 1 ///< turn on debugging info recording
1.52 +#define SO_RCVBUF 2 ///< receive buffer size
1.53 +#define SO_SNDBUF 3 ///< send buffer size
1.54 +#define SO_ERROR 9 ///< get error status and clear
1.55 +#define SO_REUSEADDR 0x406 ///< reuse local addresses
1.56 +#define SO_BROADCAST -1 ///< permit sending of broadcast msgs, not supported in Symbian OS
1.57 +#define SO_USELOOPBACK -2 ///< bypass hardware when possible, not supported in Symbian OS
1.58 +#define SO_LINGER -3 ///< linger on close if data present, not supported in Symbian OS
1.59 +#define SO_OOBINLINE -4 ///< leave received OOB data in line, not supported in Symbian OS
1.60 +
1.61 +/*
1.62 +Address families - for EPOC32 these are based on the protocol IDs.
1.63 +*/
1.64 +#define AF_UNSPEC 0 ///< unspecified
1.65 +#define AF_LOCAL 0x666 ///< local to host (pipes)
1.66 +#define AF_INET 0x0800 ///< internetwork: UDP, TCP, etc.
1.67 +#define AF_IRDA 0x0100 ///< IrDA
1.68 +#define AF_PLP 273 ///< Symbian link protocol
1.69 +
1.70 +/*
1.71 +Protocol families, same as address families
1.72 +*/
1.73 +#define PF_UNSPEC AF_UNSPEC
1.74 +#define PF_LOCAL AF_LOCAL
1.75 +#define PF_INET AF_INET
1.76 +#define PF_IRDA AF_IRDA
1.77 +#define PF_PLP AF_PLP
1.78 +
1.79 +/**
1.80 +Structure used by EPOC32 to store most addresses.
1.81 +NB. EPOC32 uses 32-bit family and port numbers internally, but they have been
1.82 +left as shorts here for compatibility with code that uses htons()/ntohs() explicitly.
1.83 +*/
1.84 +struct sockaddr {
1.85 + u_short sa_family; /* address family */
1.86 + u_short sa_port; /* port number - a common feature of most protocols */
1.87 + char sa_data[24]; /* up to 24 bytes of direct address */
1.88 +};
1.89 +
1.90 +#define SOMAXCONN 5 ///< Maximum queue length specifiable by listen
1.91 +
1.92 +#define MSG_PEEK 1 ///< peek at incoming message
1.93 +#define MSG_OOB 1 ///< write out-of-band data
1.94 +
1.95 +IMPORT_C int accept(int, struct sockaddr *, size_t *);
1.96 +IMPORT_C int bind(int, struct sockaddr *, size_t);
1.97 +IMPORT_C int connect(int, struct sockaddr *, size_t);
1.98 +IMPORT_C int getpeername(int, struct sockaddr *, size_t *);
1.99 +IMPORT_C int getsockname(int, struct sockaddr *, size_t *);
1.100 +IMPORT_C int getsockopt(int, int, int, void *, size_t *);
1.101 +IMPORT_C int listen(int, int);
1.102 +IMPORT_C int recv(int, char *, size_t, int);
1.103 +IMPORT_C int recvfrom(int, char *, size_t, int, struct sockaddr *, size_t *);
1.104 +IMPORT_C int send(int, const char *, size_t, int);
1.105 +IMPORT_C int sendto(int, const char *, size_t, int, struct sockaddr *, size_t);
1.106 +IMPORT_C int setsockopt(int, int, int, void *, size_t);
1.107 +IMPORT_C int socket(int, int, int);
1.108 +IMPORT_C int shutdown(int, int);
1.109 +
1.110 +#ifdef __cplusplus
1.111 +}
1.112 +#endif
1.113 +
1.114 +#endif /* _SYS_SOCKET_H */