]> git.ipfire.org Git - thirdparty/squid.git/blob - helpers/ntlm_auth/SMB/smbval/rfcnb-priv.h
Major rewrite of proxy authentication to support other schemes than
[thirdparty/squid.git] / helpers / ntlm_auth / SMB / smbval / rfcnb-priv.h
1 #ifndef __RFCNB_H__
2 #define __RFCNB_H__
3
4 /* UNIX RFCNB (RFC1001/RFC1002) NetBIOS implementation
5 *
6 * Version 1.0
7 * RFCNB Defines
8 *
9 * Copyright (C) Richard Sharpe 1996
10 *
11 */
12
13 /*
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27 */
28
29 /* Defines we need */
30
31 typedef unsigned short uint16;
32
33 #define GLOBAL extern
34
35 #include "rfcnb-error.h"
36 #include "rfcnb-common.h"
37 #include "byteorder.h"
38
39 #ifdef RFCNB_PORT
40 #define RFCNB_Default_Port RFCNB_PORT
41 #else
42 #define RFCNB_Default_Port 139
43 #endif
44
45 #define RFCNB_MAX_STATS 1
46
47 /* Protocol defines we need */
48
49 #define RFCNB_SESSION_MESSAGE 0
50 #define RFCNB_SESSION_REQUEST 0x81
51 #define RFCNB_SESSION_ACK 0x82
52 #define RFCNB_SESSION_REJ 0x83
53 #define RFCNB_SESSION_RETARGET 0x84
54 #define RFCNB_SESSION_KEEP_ALIVE 0x85
55
56 /* Structures */
57
58 typedef struct redirect_addr *redirect_ptr;
59
60 struct redirect_addr {
61
62 struct in_addr ip_addr;
63 int port;
64 redirect_ptr next;
65
66 };
67
68 typedef struct RFCNB_Con {
69
70 int fd; /* File descripter for TCP/IP connection */
71 int rfc_errno; /* last error */
72 int timeout; /* How many milli-secs before IO times out */
73 int redirects; /* How many times we were redirected */
74 struct redirect_addr *redirect_list; /* First is first address */
75 struct redirect_addr *last_addr;
76
77 } RFCNB_Con;
78
79 typedef char RFCNB_Hdr[4]; /* The header is 4 bytes long with */
80 /* char[0] as the type, char[1] the */
81 /* flags, and char[2..3] the length */
82
83 /* Macros to extract things from the header. These are for portability
84 * between architecture types where we are worried about byte order */
85
86 #define RFCNB_Pkt_Hdr_Len 4
87 #define RFCNB_Pkt_Sess_Len 72
88 #define RFCNB_Pkt_Retarg_Len 10
89 #define RFCNB_Pkt_Nack_Len 5
90 #define RFCNB_Pkt_Type_Offset 0
91 #define RFCNB_Pkt_Flags_Offset 1
92 #define RFCNB_Pkt_Len_Offset 2 /* Length is 2 bytes plus a flag bit */
93 #define RFCNB_Pkt_N1Len_Offset 4
94 #define RFCNB_Pkt_Called_Offset 5
95 #define RFCNB_Pkt_N2Len_Offset 38
96 #define RFCNB_Pkt_Calling_Offset 39
97 #define RFCNB_Pkt_Error_Offset 4
98 #define RFCNB_Pkt_IP_Offset 4
99 #define RFCNB_Pkt_Port_Offset 8
100
101 /* The next macro isolates the length of a packet, including the bit in the
102 * flags */
103
104 #define RFCNB_Pkt_Len(p) (PVAL(p, 3) | (PVAL(p, 2) << 8) | \
105 ((PVAL(p, RFCNB_Pkt_Flags_Offset) & 0x01) << 16))
106
107 #define RFCNB_Put_Pkt_Len(p, v) (p[1] = (((v) >> 16) & 1)); \
108 (p[2] = (((v) >> 8) & 0xFF)); \
109 (p[3] = ((v) & 0xFF));
110
111 #define RFCNB_Pkt_Type(p) (CVAL(p, RFCNB_Pkt_Type_Offset))
112
113 /*typedef struct RFCNB_Hdr {
114 *
115 * unsigned char type;
116 * unsigned char flags;
117 * int16 len;
118 *
119 * } RFCNB_Hdr;
120 *
121 * typedef struct RFCNB_Sess_Pkt {
122 * unsigned char type;
123 * unsigned char flags;
124 * int16 length;
125 * unsigned char n1_len;
126 * char called_name[33];
127 * unsigned char n2_len;
128 * char calling_name[33];
129 * } RFCNB_Sess_Pkt;
130 *
131 *
132 * typedef struct RFCNB_Nack_Pkt {
133 *
134 * struct RFCNB_Hdr hdr;
135 * unsigned char error;
136 *
137 * } RFCNB_Nack_Pkt;
138 *
139 * typedef struct RFCNB_Retarget_Pkt {
140 *
141 * struct RFCNB_Hdr hdr;
142 * int dest_ip;
143 * unsigned char port;
144 *
145 * } RFCNB_Redir_Pkt; */
146
147 /* Static variables */
148
149 /* Only declare this if not defined */
150
151 #ifndef RFCNB_ERRNO
152 extern int RFCNB_errno;
153 extern int RFCNB_saved_errno; /* Save this from point of error */
154 #endif
155
156 #endif /* __RFCNB_H__ */