summaryrefslogtreecommitdiffstats
path: root/private/inc/sys/snet/nbt_ctrl.h
blob: 8f78167c0baf09e4445ced889b4ea8dc8a91aa05 (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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
/*++

Copyright (c) 1991  Microsoft Corporation

Module Name:

    nbt_ctrl.h

Abstract:

    This file contains structure definitions for the user-level interface to
    the NBT driver.

Author:

    Mike Massa (mikemas)           Jan 30, 1992

Revision History:

    Who         When        What
    --------    --------    ----------------------------------------------
    mikemas     01-30-92     created

Notes:

--*/

/*
 *	 /usr/projects/spare/PBRAIN/SCCS/pbrainG/dev/src/include/sys/snet/0/s.nbt_control.h
 *	@(#)nbt_control.h	1.9
 *
 *	Last delta created	15:54:26 10/25/91
 *	This file extracted	16:49:25 12/23/91
 *
 *	Modifications:
 *	
 *		6 Feb 1991 (RAE)	Ported to SpiderTCP
 */

#ifndef _NBT_CTRL_INCLUDED_
#define _NBT_CTRL_INCLUDED_


typedef unsigned short word;
typedef unsigned char byte;
typedef unsigned int dword;

//
// #defines for debugging reference count problems
//

#if DBG

#define REFCOUNT_TRACE 1

#endif

#define REFCOUNT_TRACE_UNUSENAME 0
#define REFCOUNT_TRACE_USENAME   1
#define REFCOUNT_TRACE_FINDNAME  2
#define REFCOUNT_TRACE_PUTNEXT   3
#define REFCOUNT_TRACE_LINKREQ   4
#define REFCOUNT_TRACE_ACTIVE    5

#define NUM_REFCOUNT_TRACE 6

/*
 * XEB (Standard Object Block)
 */

#ifdef COMPILE_UP_TCPIP

typedef struct xeb {
        struct msgb  *msg;      /* the allocated stream msg */
        char blockname[4];      /* Debug name information */
	struct xeb *dnlink;	/* Debug link to next block) */
	struct xeb *dplink;	/* Debug link to previous block */
	struct xeb *nlink;	/* link to next block) */
	struct xeb *plink;	/* link to previous block */
        struct queue *uqptrRD;
        struct queue *uqptrWR;
        struct queue *lqptrRD;
        struct queue *lqptrWR;
        int state;
        int (*init_object)();   /* init_object procedure */
        void (*in_object)();    /* in_object procedure */
        int (*out_object)();    /* out_object procedure */
        int (*close_object)();  /* close_object procedure */
        int (*test_resource)(); /* procedure, test buf resources */
        int bufcall_flag;       /* object wait on buf resources */
        struct xeb *nmptr;      /* pointer to bound name */
	struct msgb *work_q;	/* queue of work to do */
} XEB;

#else  /* COMPILE_UP_TCPIP */

typedef struct xeb {
        struct msgb **msg;      /* the allocated stream msg */
        char blockname[4];      /* Debug name information */
	struct xeb *nlink;	/* link to next block) */
	struct xeb *plink;	/* link to previous block */
        struct queue *uqptrRD;
        struct queue *uqptrWR;
        struct queue *lqptrRD;
        struct queue *lqptrWR;
        int state;
        int ref_count;          /* reference count for the object */
                                /* each pending operation references the */
                                /* object and the completion deref's it */
                                /* when the ref count goes to zero, the */
                                /* object can be safely closed */
#ifdef REFCOUNT_TRACE
        int trace_count[NUM_REFCOUNT_TRACE];
                                /* each type of reference has a trace entry */
                                /* when a reference is made, it is made with */
                                /* a reference type that is incremented for */
                                /* the entry */
        int FindNamesAdded;     /* number of findname requests added to the */
                                /* FASTTIMQ for this xeb                    */
        int FindNamesRemoved;   /* number of findname requests taken from the */
                                /* FASTTIMQ for this xeb                      */
#endif
        KEVENT close_event;     /* This event is signalled when the ref count */
                                /* goes to zero.  It is waited on in nbtclose */
        int (*init_object)();   /* init_object procedure */
        void (*in_object)();    /* in_object procedure */
        int (*out_object)();    /* out_object procedure */
        int (*close_object)();  /* close_object procedure */
        int (*test_resource)(); /* procedure, test buf resources */
	int spl;                /* level at which per xeb lock was acquired */
	struct msgb *work_q;	/* work to do queue for deferred actions */
        int bufcall_flag;       /* object wait on buf resources */
        struct xeb *nmptr;      /* pointer to bound name */
} XEB;

#endif  /* COMPILE_UP_TCPIP */


typedef struct linkreq {
    unsigned int primtype;
    XEB *xeb;
    struct queue *toq;              /* who have asked */
    struct queue *l_qbot;
    int   l_index;
    struct msgb * mconind;       /* msg pointer  to message which have started */
                            /* this request */
} LINKREQ;



typedef struct confreq {
    unsigned int primtype;

  /* General */

    unsigned char  this_scope[240];          /* SCOPE_ID */
    unsigned char  name[17];                 /* permanent nb name   */
    unsigned long  broadcast_inaddr;         /* ip broadcast addr   */
    unsigned long  subnet_mask;              /* subnet mask for the ip addr */
    unsigned long  this_inaddr;              /* ip addr for the nbt */
    unsigned short bcast_req_retry_timeout;  /* 250 ms */
    unsigned short bcast_req_retry_count;    /* 3 */

  /* Name service */

    unsigned short conflict_timer;          /* 1000 ms */
    unsigned short namesrv_udpport;         /* 137 */

  /* Session service */

    unsigned short sessionsrv_tcpport;      /* 139 */
    unsigned short ssn_retry_count;         /* 4 */
    unsigned short ssn_close_timeout;       /* 30 sek */
    unsigned short ssn_keep_alive_timeout;  /* 60 sek */

  /* Datagram service */

    unsigned short datagramsrv_udpport;     /* 138 */
    unsigned short dgr_frag_timeout;        /* 2 sec */
} CONFREQ;


#define CONF_REQ            3001
#define NBT_LINK_REQ        3016
#define NBT_LINK_ACK        3017
#define NBT_LINK_NACK       3018
#define NBT_UNLINK_REQ      3019
#define NBT_UNLINK_ACK      3020
#define NBT_UNLINK_NACK     3021


#endif // _NBT_CTRL_INCLUDED_