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