home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
sockpli.zip
/
SOCKET.COP
< prev
next >
Wrap
Text File
|
1995-06-27
|
15KB
|
464 lines
%dcl #_SOCKET_32H char ext;
%if #_SOCKET_32H = '' %then
%do;
%dcl #_SOCKET_32H char ext;
%#_SOCKET_32H = 'Y';
/*
* Copyright (c) 1982, 1985, 1986 Regents of the University of Califor
nia.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that this notice is preserved and that due credit is given
* to the University of California at Berkeley. The name of the Univer
sity
* may not be used to endorse or promote products derived from this
* software without specific prior written permission. This software
* is provided ``as is'' without express or implied warranty.
*
* @(#)socket.h 7.2 (Berkeley) 12/30/87
*/
/*
* Definitions related to sockets: types, address families, options.
*/
/*
* Types
*/
dcl SOCK_STREAM fixed bin(31) value(1);
/* stream socket */
dcl SOCK_DGRAM fixed bin(31) value(2);
/* datagram socket */
dcl SOCK_RAW fixed bin(31) value(3);
/* raw-protocol interface */
dcl SOCK_RDM fixed bin(31) value(4);
/* reliably-delivered message */
dcl SOCK_SEQPACKET fixed bin(31) value(5);
/* sequenced packet stream */
/*
* Option flags per-socket.
*/
dcl SO_DEBUG fixed bin(15) value('0001'xn);
/* turn on debugging info recording */
dcl SO_ACCEPTCONN fixed bin(15) value('0002'xn);
/* socket has had listen() */
dcl SO_REUSEADDR fixed bin(15) value('0004'xn);
/* allow local address reuse */
dcl SO_KEEPALIVE fixed bin(15) value('0008'xn);
/* keep connections alive */
dcl SO_DONTROUTE fixed bin(15) value('0010'xn);
/* just use interface addresses */
dcl SO_BROADCAST fixed bin(15) value('0020'xn);
/* permit sending of broadcast msgs */
dcl SO_USELOOPBACK fixed bin(15) value('0040'xn);
/* bypass hardware when possible */
dcl SO_LINGER fixed bin(15) value('0080'xn);
/* linger on close if data present */
dcl SO_OOBINLINE fixed bin(15) value('0100'xn);
/* leave received OOB data in line */
/*
* Additional options, not kept in so_options.
*/
dcl SO_SNDBUF fixed bin(15) value('1001'xn);
/* send buffer size */
dcl SO_RCVBUF fixed bin(15) value('1002'xn);
/* receive buffer size */
dcl SO_SNDLOWAT fixed bin(15) value('1003'xn);
/* send low-water mark */
dcl SO_RCVLOWAT fixed bin(15) value('1004'xn);
/* receive low-water mark */
dcl SO_SNDTIMEO fixed bin(15) value('1005'xn);
/* send timeout */
dcl SO_RCVTIMEO fixed bin(15) value('1006'xn);
/* receive timeout */
dcl SO_ERROR fixed bin(15) value('1007'xn);
/* get error status and clear */
dcl SO_TYPE fixed bin(15) value('1008'xn);
/* get socket type */
/*
* Structure used for manipulating linger option.
*/
define structure
1 linger,
2 l_onoff fixed bin(31),/* option on/off */
2 l_linger fixed bin(31);/* linger time */
/*
* Level number for (get/set)sockopt() to apply to socket itself.
*/
dcl SOL_SOCKET fixed bin(15) value(-1);
/* options for socket level */
/*
* Address families.
*/
dcl AF_UNSPEC fixed bin(31) value(0);
/* unspecified */
dcl AF_UNIX fixed bin(31) value(1);
/* local to host (pipes, portals) */
dcl AF_INET fixed bin(31) value(2);
/* internetwork: UDP, TCP, etc. */
dcl AF_IMPLINK fixed bin(31) value(3);
/* arpanet imp addresses */
dcl AF_PUP fixed bin(31) value(4);
/* pup protocols: e.g. BSP */
dcl AF_CHAOS fixed bin(31) value(5);
/* mit CHAOS protocols */
dcl AF_NS fixed bin(31) value(6);
/* XEROX NS protocols */
dcl AF_NBS fixed bin(31) value(7);
/* nbs protocols */
dcl AF_ECMA fixed bin(31) value(8);
/* european computer manufacturers */
dcl AF_DATAKIT fixed bin(31) value(9);
/* datakit protocols */
dcl AF_CCITT fixed bin(31) value(10);
/* CCITT protocols, X.25 etc */
dcl AF_SNA fixed bin(31) value(11);
/* IBM SNA */
dcl AF_DECnet fixed bin(31) value(12);
/* DECnet */
dcl AF_DLI fixed bin(31) value(13);
/* Direct data link interface */
dcl AF_LAT fixed bin(31) value(14);
/* LAT */
dcl AF_HYLINK fixed bin(31) value(15);
/* NSC Hyperchannel */
dcl AF_APPLETALK fixed bin(31) value(16);
/* Apple Talk */
dcl AF_MAX fixed bin(31) value(17);
/*
* Structure used by kernel to store most
* addresses.
*/
define structure
1 sockaddr,
2 sa_family unsigned fixed bin(16) ,/* address family */
2 sa_data char(14-1) varyingz;/* up to 14 bytes of direct address
*/
/*
* Structure used by kernel to pass protocol
* information in raw sockets.
*/
define structure
1 sockproto,
2 sp_family unsigned fixed bin(16) ,/* address family */
2 sp_protocol unsigned fixed bin(16) ;/* protocol */
/*
* Protocol families, same as address families for now.
*/
%dcl PF_UNSPEC char ext;
%PF_UNSPEC='AF_UNSPEC';
%dcl @PF_UNSPEC char ext;
%@PF_UNSPEC='@AF_UNSPEC';
%dcl PF_UNIX char ext;
%PF_UNIX='AF_UNIX';
%dcl @PF_UNIX char ext;
%@PF_UNIX='@AF_UNIX';
%dcl PF_INET char ext;
%PF_INET='AF_INET';
%dcl @PF_INET char ext;
%@PF_INET='@AF_INET';
%dcl PF_IMPLINK char ext;
%PF_IMPLINK='AF_IMPLINK';
%dcl @PF_IMPLINK char ext;
%@PF_IMPLINK='@AF_IMPLINK';
%dcl PF_PUP char ext;
%PF_PUP='AF_PUP';
%dcl @PF_PUP char ext;
%@PF_PUP='@AF_PUP';
%dcl PF_CHAOS char ext;
%PF_CHAOS='AF_CHAOS';
%dcl @PF_CHAOS char ext;
%@PF_CHAOS='@AF_CHAOS';
%dcl PF_NS char ext;
%PF_NS='AF_NS';
%dcl @PF_NS char ext;
%@PF_NS='@AF_NS';
%dcl PF_NBS char ext;
%PF_NBS='AF_NBS';
%dcl @PF_NBS char ext;
%@PF_NBS='@AF_NBS';
%dcl PF_ECMA char ext;
%PF_ECMA='AF_ECMA';
%dcl @PF_ECMA char ext;
%@PF_ECMA='@AF_ECMA';
%dcl PF_DATAKIT char ext;
%PF_DATAKIT='AF_DATAKIT';
%dcl @PF_DATAKIT char ext;
%@PF_DATAKIT='@AF_DATAKIT';
%dcl PF_CCITT char ext;
%PF_CCITT='AF_CCITT';
%dcl @PF_CCITT char ext;
%@PF_CCITT='@AF_CCITT';
%dcl PF_SNA char ext;
%PF_SNA='AF_SNA';
%dcl @PF_SNA char ext;
%@PF_SNA='@AF_SNA';
%dcl PF_DECnet char ext;
%PF_DECnet='AF_DECnet';
%dcl @PF_DECnet char ext;
%@PF_DECnet='@AF_DECnet';
%dcl PF_DLI char ext;
%PF_DLI='AF_DLI';
%dcl @PF_DLI char ext;
%@PF_DLI='@AF_DLI';
%dcl PF_LAT char ext;
%PF_LAT='AF_LAT';
%dcl @PF_LAT char ext;
%@PF_LAT='@AF_LAT';
%dcl PF_HYLINK char ext;
%PF_HYLINK='AF_HYLINK';
%dcl @PF_HYLINK char ext;
%@PF_HYLINK='@AF_HYLINK';
%dcl PF_APPLETALK char ext;
%PF_APPLETALK='AF_APPLETALK';
%dcl @PF_APPLETALK char ext;
%@PF_APPLETALK='@AF_APPLETALK';
%dcl PF_MAX char ext;
%PF_MAX='AF_MAX';
%dcl @PF_MAX char ext;
%@PF_MAX='@AF_MAX';
/*
* Maximum queue length specifiable by listen.
*/
dcl SOMAXCONN fixed bin(31) value(5);
%dcl #_off_t char ext;
%if #_off_t = '' %then
%do;
define alias off_t fixed bin(31);
define alias @off_t pointer;
%dcl #_off_t char ext;
%#_off_t = 'Y';
%end;
define structure
1 iovec,
2 iov_base pointer,
2 iov_len fixed bin(31);
/*
* Message header for recvmsg and sendmsg calls.
*/
define structure
1 msghdr,
2 msg_name pointer,/* optional address */
2 msg_namelen fixed bin(31),/* size of address */
2 msg_iov handle iovec,/* scatter/gather array */
2 msg_iovlen fixed bin(31),/* # elements in msg_iov */
2 msg_accrights pointer,/* access rights sent/received */
2 msg_accrightslen fixed bin(31);
define structure
1 uio,
2 uio_iov handle iovec,
2 uio_iovcnt fixed bin(31),
2 uio_offset type off_t,
2 uio_segflg fixed bin(31),
2 uio_resid fixed bin(31);
define
ordinal
uio_rw
( UIO_READ,
UIO_WRITE
);
dcl FREAD fixed bin(31) value(1);
dcl FWRITE fixed bin(31) value(2);
dcl MSG_OOB fixed bin(15) value('1'xn);
/* process out-of-band data */
dcl MSG_PEEK fixed bin(15) value('2'xn);
/* peek at incoming message */
dcl MSG_DONTROUTE fixed bin(15) value('4'xn);
/* send without using routing tables */
dcl MSG_MAXIOVLEN fixed bin(31) value(16);
dcl accept entry (
fixed bin(31),
pointer,
pointer)
returns( fixed bin(31) byvalue )
options(linkage(system) byvalue nodescriptor) external;
dcl bind entry (
fixed bin(31),
pointer,
fixed bin (31))
returns( fixed bin(31) byvalue )
options(linkage(system) byvalue nodescriptor) external;
dcl connect entry (
fixed bin(31),
pointer,
fixed bin (31))
returns( fixed bin(31) byvalue )
options(linkage(system) byvalue nodescriptor) external;
dcl gethostid entry (
)
returns( fixed bin(31) byvalue )
options(linkage(system) byvalue nodescriptor) external;
dcl getpeername entry (
fixed bin(31),
pointer,
pointer)
returns( fixed bin(31) byvalue )
options(linkage(system) byvalue nodescriptor) external;
dcl getsockname entry (
fixed bin(31),
pointer,
pointer)
returns( fixed bin(31) byvalue )
options(linkage(system) byvalue nodescriptor) external;
dcl getsockopt entry (
fixed bin(31),
fixed bin(31),
fixed bin(31),
pointer,
pointer)
returns( fixed bin(31) byvalue )
options(linkage(system) byvalue nodescriptor) external;
dcl ioctl entry (
fixed bin(31),
fixed bin(31),
pointer,
fixed bin(31))
returns( fixed bin(31) byvalue )
options(linkage(system) byvalue nodescriptor) external;
dcl listen entry (
fixed bin(31),
fixed bin(31))
returns( fixed bin(31) byvalue )
options(linkage(system) byvalue nodescriptor) external;
dcl recvmsg entry (
fixed bin(31),
handle msghdr,
fixed bin(31))
returns( fixed bin(31) byvalue )
options(linkage(system) byvalue nodescriptor) external;
dcl recv entry (
fixed bin(31),
pointer,
fixed bin(31),
fixed bin(31))
returns( fixed bin(31) byvalue )
options(linkage(system) byvalue nodescriptor) external;
dcl recvfrom entry (
fixed bin(31),
pointer,
fixed bin(31),
fixed bin(31),
pointer,
pointer)
returns( fixed bin(31) byvalue )
options(linkage(system) byvalue nodescriptor) external;
%dcl BSD_SELECT char ext;
%if BSD_SELECT = '' %then
%do;
dcl select entry (
pointer,
fixed bin(31),
fixed bin(31),
fixed bin(31),
fixed bin(31))
returns( fixed bin(31) byvalue )
options(linkage(system) byvalue nodescriptor) external;
%end;
dcl send entry (
fixed bin(31),
pointer,
fixed bin(31),
fixed bin(31))
returns( fixed bin(31) byvalue )
options(linkage(system) byvalue nodescriptor) external;
dcl sendmsg entry (
fixed bin(31),
handle msghdr,
fixed bin(31))
returns( fixed bin(31) byvalue )
options(linkage(system) byvalue nodescriptor) external;
dcl sendto entry (
fixed bin(31),
pointer,
fixed bin(31),
fixed bin(31),
pointer,
fixed bin(31))
returns( fixed bin(31) byvalue )
options(linkage(system) byvalue nodescriptor) external;
dcl setsockopt entry (
fixed bin(31),
fixed bin(31),
fixed bin(31),
pointer,
fixed bin(31))
returns( fixed bin(31) byvalue )
options(linkage(system) byvalue nodescriptor) external;
dcl sock_init entry (
)
returns( fixed bin(31) byvalue )
options(linkage(system) byvalue nodescriptor) external;
dcl sock_errno entry (
)
returns( fixed bin(31) byvalue )
options(linkage(system) byvalue nodescriptor) external;
dcl psock_errno entry (
pointer )
options(linkage(system) byvalue nodescriptor) external;
dcl socket entry (
fixed bin(31),
fixed bin(31),
fixed bin(31))
returns( fixed bin(31) byvalue )
options(linkage(system) byvalue nodescriptor) external;
dcl soclose entry (
fixed bin(31) )
returns( fixed bin(31) byvalue )
options(linkage(system) byvalue nodescriptor) external;
dcl soabort entry (
fixed bin(31) )
returns( fixed bin(31) byvalue )
options(linkage(system) byvalue nodescriptor) external;
dcl so_cancel entry (
fixed bin(31) )
returns( fixed bin(31) byvalue )
options(linkage(system) byvalue nodescriptor) external;
dcl readv entry (
fixed bin(31),
handle iovec,
fixed bin(31))
returns( fixed bin(31) byvalue )
options(linkage(system) byvalue nodescriptor) external;
dcl writev entry (
fixed bin(31),
handle iovec,
fixed bin(31))
returns( fixed bin(31) byvalue )
options(linkage(system) byvalue nodescriptor) external;
dcl shutdown entry (
fixed bin(31),
fixed bin(31))
returns( fixed bin(31) byvalue )
options(linkage(system) byvalue nodescriptor) external;
dcl getinetversion entry (
pointer )
returns( fixed bin(31) byvalue )
options(linkage(system) byvalue nodescriptor) external;
%end;
/* __SOCKET_32H */