:pserver:anonymous@cvs.middle-man.sourceforge.net:/cvsroot/middle-man middleman
[middleman.git] / libntlm / ntlm.h.in
1 /* ntlm.h       header file for libntlm                               -*- c -*-
2  *
3  * This file is part of libntlm.
4  *
5  * Libntlm is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * Libntlm is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with libntlm; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  *
19  */
20
21 #ifndef _NTLM_H
22 #define _NTLM_H
23
24 #ifdef __cplusplus
25 extern "C" {
26 #if 0 /* keep Emacsens's auto-indent happy */
27 }
28 #endif
29 #endif
30
31 typedef unsigned short uint16;
32 typedef unsigned int uint32;
33 typedef unsigned char uint8;
34
35 #define NTLM_VERSION "@PACKAGE_VERSION@"
36
37 /* 
38  * These structures are byte-order dependant, and should not
39  * be manipulated except by the use of the routines provided
40  */
41
42 typedef struct
43 {
44   uint16 len;
45   uint16 maxlen;
46   uint32 offset;
47 }tSmbStrHeader;
48
49 typedef struct
50 {
51   char ident[8];
52   uint32 msgType;
53   uint32 flags;
54   tSmbStrHeader user;
55   tSmbStrHeader domain;
56   uint8 buffer[1024];
57   uint32 bufIndex;
58 }tSmbNtlmAuthRequest;
59
60 typedef struct
61 {
62   char ident[8];
63   uint32 msgType;
64   tSmbStrHeader uDomain;
65   uint32 flags;
66   uint8 challengeData[8];
67   uint8 reserved[8];
68   tSmbStrHeader emptyString;
69   uint8 buffer[1024];
70   uint32 bufIndex;
71 }tSmbNtlmAuthChallenge;
72
73
74 typedef struct
75 {
76   char ident[8];
77   uint32 msgType;
78   tSmbStrHeader lmResponse;
79   tSmbStrHeader ntResponse;
80   tSmbStrHeader uDomain;
81   tSmbStrHeader uUser;
82   tSmbStrHeader uWks;
83   tSmbStrHeader sessionKey;
84   uint32 flags;
85   uint8 buffer[1024];
86   uint32 bufIndex;
87 }tSmbNtlmAuthResponse;
88
89 /* public: */
90
91 #define SmbLength(ptr) (((ptr)->buffer - (uint8*)(ptr)) + (ptr)->bufIndex)
92
93 extern void dumpSmbNtlmAuthRequest(FILE *fp, tSmbNtlmAuthRequest *request);
94 extern void dumpSmbNtlmAuthChallenge(FILE *fp, tSmbNtlmAuthChallenge *challenge);
95 extern void dumpSmbNtlmAuthResponse(FILE *fp, tSmbNtlmAuthResponse *response);
96
97 extern void buildSmbNtlmAuthRequest(tSmbNtlmAuthRequest *request, char *user, char *domain);
98 extern void buildSmbNtlmAuthResponse(tSmbNtlmAuthChallenge *challenge, tSmbNtlmAuthResponse *response, char *user, char *password);
99
100 #ifdef __cplusplus
101 }
102 #endif
103
104 #endif