COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

	Copyright (c) Geoworks 1995 -- All Rights Reserved

			GEOWORKS CONFIDENTIAL

PROJECT:	Socket
MODULE:		
FILE:		sockmisc.def

AUTHOR:		Jennifer Wu, Dec  7, 1995
	
REVISION HISTORY:
	Name	Date		Description
	----	----		-----------
	jwu	12/ 7/95		Initial revision

DESCRIPTION:
	Miscellaneous socket definitions.
		
	$Id: sockmisc.def,v 1.1 97/04/04 14:26:55 newdeal Exp $

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@

SetDef __SOCKMISC

;-------------------------------------------------------------------
;
; 		Specific Socket Driver Errors  
;
; These are placed in the high byte of SocketDrError when delivered to 
; the socket library.  Provided for use by applications which want to 
; display more detailed error messages.
;
; These values must match those defined in sockmisc.h!  Change that file
; too if you change these errors.
;
;---------------------------------------------------------------------------

SpecSocketDrError	etype	word
SSDE_DEVICE_BUSY	enum	SpecSocketDrError, 0100h
						; serial port or modem driver
					  	;   already in use
SSDE_DIAL_ERROR		enum	SpecSocketDrError, 0200h
SSDE_LINE_BUSY		enum	SpecSocketDrError, 0300h 
						; modem got a busy signal
SSDE_NO_DIALTONE	enum	SpecSocketDrError, 0400h
SSDE_NO_ANSWER		enum	SpecSocketDrError, 0500h
SSDE_NO_CARRIER		enum	SpecSocketDrError, 0600h
SSDE_BLACKLISTED	enum	SpecSocketDrError, 0700h
						; used in GSM network
SSDE_DELAYED		enum	SpecSocketDrError, 0800h
						; used in GSM network
SSDE_CALL_FAILED	enum	SpecSocketDrError, 0900h
						; couldn't dial for some reason
SSDE_NEG_FAILED		enum	SpecSocketDrError, 0a00h
SSDE_AUTH_REFUSED	enum	SpecSocketDrError, 0b00h
SSDE_AUTH_FAILED	enum	SpecSocketDrError, 0c00h
SSDE_LQM_FAILURE	enum	SpecSocketDrError, 0d00h
SSDE_LOOPED_BACK	enum	SpecSocketDrError, 0e00h
SSDE_IDLE_TIMEOUT	enum	SpecSocketDrError, 0f00h
SSDE_DEVICE_NOT_FOUND	enum	SpecSocketDrError, 1000h
						; unable to load device driver
SSDE_DEVICE_TIMEOUT	enum	SpecSocketDrError, 1100h
SSDE_DEVICE_ERROR	enum	SpecSocketDrError, 1200h
SSDE_NO_USERNAME	enum	SpecSocketDrError, 1300h
						; no username and password 
						;  prompting used
SSDE_CANCEL		enum	SpecSocketDrError, 1400h
						; user cancelled 
SSDE_INVALID_ACCPNT	enum	SpecSocketDrError, 1500h
						; invalid access point
SSDE_LOGIN_FAILED	enum	SpecSocketDrError, 1600h
SSDE_LOGIN_FAILED_NO_NOTIFY enum	SpecSocketDrError, 1700h
						; Failed to login to remote
						; host.  NO_NOTIFY is for
						; situations in which
						; user has already been
						; notified, and client should
						; not do it again.
SSDE_DIAL_ABORTED	enum	SpecSocketDrError, 1800h
						; Happens if MRC_DIAL_ABORTED
						; returned from modem drvr.
						; DR_MODEM_ABORT_DIAL was sent.

;---------------------------------------------------------------------------
;		Socket Exceptions 
;
; Used with SCO_EXCEPTION to inform client about a problem.
;
;---------------------------------------------------------------------------

SocketDrException	etype	byte, 1
SDX_SOURCE_QUENCH	       enum SocketDrException
SDX_PARAM_PROBLEM	       enum SocketDrException
SDX_TIME_EXCEEDED	       enum SocketDrException
SDX_UNREACHABLE		       enum SocketDrException


;---------------------------------------------------------------------------
;
;			IP Constants
;
;---------------------------------------------------------------------------

IP_ADDR_SIZE			equ	4
IPAddr	type	IP_ADDR_SIZE dup (byte)

;
; Maximum size of IP address in dotted-decimal notation: 255.255.255.255
;
MAX_IP_DECIMAL_ADDR_LENGTH	equ	15
MAX_IP_DECIMAL_ADDR_LENGTH_ZT 	equ	16

;
; Maximum size of a domain name is 255.  (RFC 1034, section 3.1)
; "To simplify implementations, the total number of octets that represent 
;  a domain name is limited to 255."
;
MAX_IP_ADDR_STRING_LENGTH	equ	255
MAX_IP_ADDR_STRING_LENGTH_ZT	equ	256

LOOPBACK_NET			equ	127	



COMMENT |------------------------------------------------------------------
		Extended Socket Address Control Address

	The opaque part of the Socket Address Control Address structure
	contains an extended address with the following information:
	1) size of link parameters, including link type
	2) link type				(optional)
	3) link parameters			(optional)
	4) connection address	
	where the nature of the link parameters depends on the link type.

	In the ExtendedSACAddress structure, the connection address
	immediately follows the opaque link parameters.

	The user readable link and connection addresses follow the 
	opaque connection address.  The link address will be appended
	to the user readable connection address string, surrounded by
	parenthesis.  (This assumes the connection address has no
	parenthesis, which is true for IP.)

	For more information about the SocketAddressControlClass, and
	the context in which it will use an ExtendedSACAddress, see
        the file sac.def

---------------------------------------------------------------------------|

; 
; LinkType defines the nature of the link parameters.  
; New LinkTypes should be added between LT_ID and LT_DEFAULT.
;

LinkID		type	word			; permanent identifier for a
						;  link in the link database

LinkType	etype	byte
LT_ADDR			enum	LinkType	; link params = link address 
LT_ID			enum	LinkType	; link params = LinkID

LinkParams	struct
	LP_type		LinkType		; nature of LP_params
	LP_params	label byte		; start of link parameters
LinkParams	ends

ExtendedSACAddress	struct
	ESACA_linkSize	word		; number of bytes in the opaque address 
					; which are LinkParams
	ESACA_opaque 	label byte	; start of LinkParams, immediately
					; followed by the connection address
ExtendedSACAddress	ends

;---------------------------------------------------------------------------
;		
;		TCP Extended Address Structures
;
; These structures are defined here to give an example of the different
; forms a TCP address may take.  While the ExtendedSACAddress given above
; is common to all drivers, these declarations are specific to TCP.  The
; resolved forms assume the link driver will not change the link paramters
; during resolution, which is true of PPP and SLIP, but not necessarily
; of future drivers.
;
;---------------------------------------------------------------------------

; 
; A TCP extended address using an access point ID as the link address.
;

TcpAccPntExtendedAddress	struct
	TAPEA_linkSize	word		3
	TAPEA_linkType	byte			; LinkType (LT_ID)
	TAPEA_accPntID	word	
	TAPEA_ipAddr	label	byte		; IP address
TcpAccPntExtendedAddress	ends

;
; A TCP extended address with no link address.
;

TcpOnlyExtendedAddress		struct
	TOEA_linkSize	word		0
	TOEA_ipAddr	label	byte		; IP address
TcpOnlyExtendedAddress		ends

;
; Resolved variants of the above two forms.  A resolved IP address is
; always 4 bytes.
;
TcpAccPntResolvedAddress	struct
	TAPRA_linkSize	word	3
	TAPRA_linkType	byte			; LinkType (LT_ID)
	TAPRA_accPntID	word
	TAPRA_ipAddr	byte	4 dup (?)
TcpAccPntResolvedAddress	ends

TcpOnlyResolvedAddress		struct
	TORA_linkSize	word		0
	TORA_ipAddr	dword		; IP address
TcpOnlyResolvedAddress		ends

;
; A TCP extended address with a non-accpnt link address.
;
; There is no advantage to making a resolved version of this,
; since the fixed size IP field follows a variable size link field
;
TcpNonAccPntExtendedAddress	struct
	TNAPEA_linkSize	word
	TNAPEA_linkType	byte			; LinkType (LT_ADDR)
	TNAPEA_addr	label	byte	
		; link address immediately followed by IP address
TcpNonAccPntExtendedAddress	ends


;---------------------------------------------------------------------------
;
;		Default Server and Client IP addresses 
;
; These addresses are assigned by the PPP driver when it is called by 
; another.  We will be the server and the peer will be assigned the
; client address.  
;
; TCP assigns one of these as the default remote IP address when 
; TcpipResolveAddr is called without an IP address to resolve.  Address
; assigned depends on state of link.
;
; From RFC1597:
; 	The Internet Assigned Numbers Authority (IANA) has reserved the
; 	following three blocks of the IP address space for private networks:
;	
;	10.0.0.0	-  10.255.255.255
;	172.16.0.0	-  172.31.255.255
;	192.168.0.0	-  192.168.255.255
;
; We're using two addresses from this range, chosen completely at random. ;)
; 
;---------------------------------------------------------------------------

DEFAULT_SERVER_IP_ADDR	equ	0x55574a0a	; 10.74.87.85 in network order
DEFAULT_CLIENT_IP_ADDR	equ	0x5750450a	; 10.69.80.87 in network order

CLIENT_IP_ADDR	equ	0x0a455057		; 10.69.80.87 in host order
SERVER_IP_ADDR	equ	0x0a4a5755		; 10.74.87.85 in host order

;---------------------------------------------------------------------------
;
;		UDP/TCP assigned ports  
;
; If changes are made to this list, PLEASE update sockmisc.h as well.
;
;---------------------------------------------------------------------------

ECHO		equ	7			; TCP/UDP
DISCARD		equ	9			; TCP/UDP
FTP_DATA	equ	20			; TCP
FTP		equ	21			; TCP
TELNET_SERVER	equ	23			; TCP
SMTP		equ	25			; TCP
NAME_SERVER	equ	42			; UDP
WHOIS		equ	43			; TCP
DOMAIN_SERVER	equ	53			; TCP/UDP
FINGER		equ	79			; TCP
POP3		equ	110			; TCP

;---------------------------------------------------------------------------
;	
;		SocketSubsystemNotification
;
;---------------------------------------------------------------------------

SocketSubsystemNotification	etype	word, 0
SSN_LINK_CONNECTED		enum	SocketSubsystemNotification
;	Desc:	Notification that a socket link connection
;		is actually connected to another machine.
;	
;	Pass:	cxdx	= MediumType
;		bx	= unit number (ignored if MMUT_NONE)
;		al	= MUT_INT
;

SSN_LINK_NOT_CONNECTED		enum	SocketSubsystemNotification
;	Desc:	Notification that a socket link connection has
;		been disconnected.
;
;	Pass:	cxdx	= MediumType
;		bx	= unit number (ignored if MMUT_NONE)
;		al	= MUT_INT
;
