~clint-fewbar/ubuntu/precise/squid3/ignore-sighup-early

« back to all changes in this revision

Viewing changes to helpers/ntlm_auth/smb_lm/smbval/rfcnb-priv.h

  • Committer: Bazaar Package Importer
  • Author(s): Luigi Gangitano
  • Date: 2010-05-04 11:15:49 UTC
  • mfrom: (1.3.1 upstream)
  • mto: (20.3.1 squeeze) (21.2.1 sid)
  • mto: This revision was merged to the branch mainline in revision 21.
  • Revision ID: james.westby@ubuntu.com-20100504111549-1apjh2g5sndki4te
Tags: upstream-3.1.3
ImportĀ upstreamĀ versionĀ 3.1.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
#define GLOBAL extern
 
32
 
 
33
#include "rfcnb-error.h"
 
34
#include "rfcnb-common.h"
 
35
#include "byteorder.h"
 
36
 
 
37
#ifdef RFCNB_PORT
 
38
#define RFCNB_Default_Port RFCNB_PORT
 
39
#else
 
40
#define RFCNB_Default_Port 139
 
41
#endif
 
42
 
 
43
#define RFCNB_MAX_STATS 1
 
44
 
 
45
/* Protocol defines we need */
 
46
 
 
47
#define RFCNB_SESSION_MESSAGE 0
 
48
#define RFCNB_SESSION_REQUEST 0x81
 
49
#define RFCNB_SESSION_ACK 0x82
 
50
#define RFCNB_SESSION_REJ 0x83
 
51
#define RFCNB_SESSION_RETARGET 0x84
 
52
#define RFCNB_SESSION_KEEP_ALIVE 0x85
 
53
 
 
54
/* Structures      */
 
55
 
 
56
typedef struct redirect_addr *redirect_ptr;
 
57
 
 
58
struct redirect_addr {
 
59
 
 
60
    struct in_addr ip_addr;
 
61
    int port;
 
62
    redirect_ptr next;
 
63
 
 
64
};
 
65
 
 
66
typedef struct RFCNB_Con {
 
67
 
 
68
    int fd;                     /* File descripter for TCP/IP connection */
 
69
    int rfc_errno;              /* last error                            */
 
70
    int timeout;                /* How many milli-secs before IO times out */
 
71
    int redirects;              /* How many times we were redirected     */
 
72
    struct redirect_addr *redirect_list;        /* First is first address */
 
73
    struct redirect_addr *last_addr;
 
74
 
 
75
} RFCNB_Con;
 
76
 
 
77
typedef char RFCNB_Hdr[4];      /* The header is 4 bytes long with  */
 
78
/* char[0] as the type, char[1] the */
 
79
/* flags, and char[2..3] the length */
 
80
 
 
81
/* Macros to extract things from the header. These are for portability
 
82
 * between architecture types where we are worried about byte order     */
 
83
 
 
84
#define RFCNB_Pkt_Hdr_Len        4
 
85
#define RFCNB_Pkt_Sess_Len       72
 
86
#define RFCNB_Pkt_Retarg_Len     10
 
87
#define RFCNB_Pkt_Nack_Len       5
 
88
#define RFCNB_Pkt_Type_Offset    0
 
89
#define RFCNB_Pkt_Flags_Offset   1
 
90
#define RFCNB_Pkt_Len_Offset     2      /* Length is 2 bytes plus a flag bit */
 
91
#define RFCNB_Pkt_N1Len_Offset   4
 
92
#define RFCNB_Pkt_Called_Offset  5
 
93
#define RFCNB_Pkt_N2Len_Offset   38
 
94
#define RFCNB_Pkt_Calling_Offset 39
 
95
#define RFCNB_Pkt_Error_Offset   4
 
96
#define RFCNB_Pkt_IP_Offset      4
 
97
#define RFCNB_Pkt_Port_Offset    8
 
98
 
 
99
/* The next macro isolates the length of a packet, including the bit in the
 
100
 * flags                                                                   */
 
101
 
 
102
#define RFCNB_Pkt_Len(p)  (PVAL(p, 3) | (PVAL(p, 2) << 8) |     \
 
103
                          ((PVAL(p, RFCNB_Pkt_Flags_Offset) & 0x01) << 16))
 
104
 
 
105
#define RFCNB_Put_Pkt_Len(p, v) (p[1] = (((v) >> 16) & 1)); \
 
106
                                (p[2] = (((v) >> 8) & 0xFF)); \
 
107
                                (p[3] = ((v) & 0xFF));
 
108
 
 
109
#define RFCNB_Pkt_Type(p) (CVAL(p, RFCNB_Pkt_Type_Offset))
 
110
 
 
111
/*typedef struct RFCNB_Hdr {
 
112
 *
 
113
 * unsigned char type;
 
114
 * unsigned char flags;
 
115
 * int16 len;
 
116
 *
 
117
 * } RFCNB_Hdr;
 
118
 *
 
119
 * typedef struct RFCNB_Sess_Pkt {
 
120
 * unsigned char type;
 
121
 * unsigned char flags;
 
122
 * int16 length;
 
123
 * unsigned char n1_len;
 
124
 * char called_name[33];
 
125
 * unsigned char n2_len;
 
126
 * char calling_name[33];
 
127
 * } RFCNB_Sess_Pkt;
 
128
 *
 
129
 *
 
130
 * typedef struct RFCNB_Nack_Pkt {
 
131
 *
 
132
 * struct RFCNB_Hdr hdr;
 
133
 * unsigned char error;
 
134
 *
 
135
 * } RFCNB_Nack_Pkt;
 
136
 *
 
137
 * typedef struct RFCNB_Retarget_Pkt {
 
138
 *
 
139
 * struct RFCNB_Hdr hdr;
 
140
 * int dest_ip;
 
141
 * unsigned char port;
 
142
 *
 
143
 * } RFCNB_Redir_Pkt; */
 
144
 
 
145
/* Static variables */
 
146
 
 
147
/* Only declare this if not defined */
 
148
 
 
149
#ifndef RFCNB_ERRNO
 
150
extern int RFCNB_errno;
 
151
extern int RFCNB_saved_errno;   /* Save this from point of error */
 
152
#endif
 
153
 
 
154
#endif /* __RFCNB_H__ */