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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors