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