aboutsummaryrefslogtreecommitdiff
path: root/Linux_C_12/cTCP_121.h
blob: ed116e70dd79927160ba801b10be2896f778a826 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifndef __CTCP__
#define __CTCP__

#include <netdb.h>

typedef FILE* SOCKET;
typedef FILE* HANDLE;
typedef HANDLE HWND;
typedef int DNSHdl;

struct DNSInfo
    {	struct DNSInfo	*next;
        HANDLE	dnsHdl;
        union	{	struct hostent	Hostent;
                    char			freeSpace[MAXGETHOSTSTRUCT];
                }
                junion;
    };
typedef struct DNSInfo DNSInfo;

/* the dictionary items */
struct dictitem
    {	SOCKET			endpointRef;
        struct dictitem	*next;
        char			availByte;
        unsigned		availByteValid		: 1;
        unsigned		referenceCount		: 2;
        unsigned		hasReceiveNotifier	: 1;
        /*
         * three kinds of receivers: receivers for established connections,
         * receivers for dns requests, receivers for asynchronous connect
         */
        unsigned		hasSendableNotifier	: 1;
        unsigned		aborted				: 1;
        unsigned		disconnected		: 1;
    };
typedef struct dictitem dictitem;

#define IE_CONNECTREQUEST		0x0001
#define IE_RECEIVED				0x0004
#define IE_EOM					0x0010
#define IE_SENDABLE				0x0100
#define IE_DISCONNECTED			0x0011
#define IE_IPADDRESSFOUND		0x2000000F
#define IE_IPADDRESSNOTFOUND	0x20000010
#define IE_ASYNCCONNECTCOMPLETE	0x0002
#define IE_ASYNCCONNECTFAILED	0x0003

#define ListenerReceiver	0
#define RChanReceiver		1
#define SChanReceiver		2
#define DNSReceiver			3
#define ConnectReceiver		4

#define SOCKET_ERROR        -1

/* PA: InitSockets has no definition.
void InitSockets();
*/
extern dictitem* lookup(SOCKET endpointRef);

#endif