1178825Sdfr/*
2233294Sstas * Copyright (c) 2006 Kungliga Tekniska H��gskolan
3233294Sstas * (Royal Institute of Technology, Stockholm, Sweden).
4233294Sstas * All rights reserved.
5178825Sdfr *
6233294Sstas * Redistribution and use in source and binary forms, with or without
7233294Sstas * modification, are permitted provided that the following conditions
8233294Sstas * are met:
9178825Sdfr *
10233294Sstas * 1. Redistributions of source code must retain the above copyright
11233294Sstas *    notice, this list of conditions and the following disclaimer.
12178825Sdfr *
13233294Sstas * 2. Redistributions in binary form must reproduce the above copyright
14233294Sstas *    notice, this list of conditions and the following disclaimer in the
15233294Sstas *    documentation and/or other materials provided with the distribution.
16178825Sdfr *
17233294Sstas * 3. Neither the name of the Institute nor the names of its contributors
18233294Sstas *    may be used to endorse or promote products derived from this software
19233294Sstas *    without specific prior written permission.
20178825Sdfr *
21233294Sstas * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
22233294Sstas * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23233294Sstas * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24233294Sstas * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
25233294Sstas * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26233294Sstas * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27233294Sstas * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28233294Sstas * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29233294Sstas * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30233294Sstas * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31233294Sstas * SUCH DAMAGE.
32178825Sdfr */
33178825Sdfr
34233294Sstas/* $Id$ */
35178825Sdfr
36178825Sdfr#ifndef HEIM_NTLM_H
37178825Sdfr#define HEIM_NTLM_H
38178825Sdfr
39178825Sdfr/**
40178825Sdfr * Buffer for storing data in the NTLM library. When filled in by the
41178825Sdfr * library it should be freed with heim_ntlm_free_buf().
42178825Sdfr */
43178825Sdfrstruct ntlm_buf {
44178825Sdfr    size_t length; /**< length buffer data */
45178825Sdfr    void *data; /**< pointer to the data itself */
46178825Sdfr};
47178825Sdfr
48178825Sdfr#define NTLM_NEG_UNICODE		0x00000001
49233294Sstas#define NTLM_NEG_OEM                    0x00000002
50178825Sdfr#define NTLM_NEG_TARGET			0x00000004
51233294Sstas#define NTLM_MBZ9			0x00000008
52233294Sstas
53178825Sdfr#define NTLM_NEG_SIGN			0x00000010
54178825Sdfr#define NTLM_NEG_SEAL			0x00000020
55233294Sstas#define NTLM_NEG_DATAGRAM               0x00000040
56233294Sstas#define NTLM_NEG_LM_KEY                 0x00000080
57178825Sdfr#define NTLM_NEG_NTLM			0x00000200
58233294Sstas#define NTLM_NEG_ANONYMOUS              0x00000800
59178825Sdfr
60233294Sstas#define NTLM_MBZ8			0x00000100
61233294Sstas#define NTLM_NEG_NTLM			0x00000200
62233294Sstas#define NTLM_NEG_NT_ONLY		0x00000400
63233294Sstas#define NTLM_MBZ7			0x00000800 /* anon ? */
64178825Sdfr
65233294Sstas#define NTLM_OEM_SUPPLIED_DOMAIN	0x00001000
66233294Sstas#define NTLM_OEM_SUPPLIED_WORKSTATION	0x00002000
67233294Sstas#define NTLM_MBZ6			0x00004000 /* local call ? */
68178825Sdfr#define NTLM_NEG_ALWAYS_SIGN		0x00008000
69178825Sdfr
70178825Sdfr#define NTLM_TARGET_DOMAIN		0x00010000
71178825Sdfr#define NTLM_TARGET_SERVER		0x00020000
72233294Sstas
73233294Sstas#define NTLM_TARGET_SHARE		0x00040000
74233294Sstas#define NTLM_NEG_NTLM2_SESSION		0x00080000
75233294Sstas#define NTLM_NEG_NTLM2			0x00080000
76233294Sstas
77233294Sstas#define NTLM_NEG_IDENTIFY		0x00100000
78233294Sstas#define NTLM_MBZ5			0x00200000
79233294Sstas#define NTLM_NON_NT_SESSION_KEY		0x00400000
80233294Sstas#define NTLM_NEG_TARGET_INFO		0x00800000
81233294Sstas
82233294Sstas#define NTLM_MBZ4			0x01000000
83233294Sstas#define NTLM_NEG_VERSION		0x02000000
84233294Sstas#define NTLM_MBZ3			0x04000000
85233294Sstas#define NTLM_MBZ2			0x08000000
86233294Sstas
87233294Sstas#define NTLM_MBZ1			0x10000000
88178825Sdfr#define NTLM_ENC_128			0x20000000
89178825Sdfr#define NTLM_NEG_KEYEX			0x40000000
90233294Sstas#define NTLM_ENC_56			0x80000000
91178825Sdfr
92178825Sdfr/**
93178825Sdfr * Struct for the NTLM target info, the strings is assumed to be in
94178825Sdfr * UTF8.  When filled in by the library it should be freed with
95178825Sdfr * heim_ntlm_free_targetinfo().
96178825Sdfr */
97233294Sstas
98233294Sstas#define NTLM_TI_AV_FLAG_GUEST		0x00000001
99233294Sstas
100178825Sdfrstruct ntlm_targetinfo {
101178825Sdfr    char *servername; /**< */
102178825Sdfr    char *domainname; /**< */
103178825Sdfr    char *dnsdomainname; /**< */
104178825Sdfr    char *dnsservername; /**< */
105233294Sstas    char *dnstreename; /**< */
106233294Sstas    uint32_t avflags; /**< */
107178825Sdfr};
108178825Sdfr
109178825Sdfr/**
110178825Sdfr * Struct for the NTLM type1 message info, the strings is assumed to
111178825Sdfr * be in UTF8.  When filled in by the library it should be freed with
112178825Sdfr * heim_ntlm_free_type1().
113178825Sdfr */
114178825Sdfr
115178825Sdfrstruct ntlm_type1 {
116178825Sdfr    uint32_t flags; /**< */
117178825Sdfr    char *domain; /**< */
118178825Sdfr    char *hostname; /**< */
119178825Sdfr    uint32_t os[2]; /**< */
120178825Sdfr};
121178825Sdfr
122178825Sdfr/**
123178825Sdfr * Struct for the NTLM type2 message info, the strings is assumed to
124178825Sdfr * be in UTF8.  When filled in by the library it should be freed with
125178825Sdfr * heim_ntlm_free_type2().
126178825Sdfr */
127178825Sdfr
128178825Sdfrstruct ntlm_type2 {
129178825Sdfr    uint32_t flags; /**< */
130178825Sdfr    char *targetname; /**< */
131178825Sdfr    struct ntlm_buf targetinfo; /**< */
132233294Sstas    unsigned char challenge[8]; /**< */
133178825Sdfr    uint32_t context[2]; /**< */
134178825Sdfr    uint32_t os[2]; /**< */
135178825Sdfr};
136178825Sdfr
137178825Sdfr/**
138178825Sdfr * Struct for the NTLM type3 message info, the strings is assumed to
139178825Sdfr * be in UTF8.  When filled in by the library it should be freed with
140178825Sdfr * heim_ntlm_free_type3().
141178825Sdfr */
142178825Sdfr
143178825Sdfrstruct ntlm_type3 {
144178825Sdfr    uint32_t flags; /**< */
145178825Sdfr    char *username; /**< */
146178825Sdfr    char *targetname; /**< */
147178825Sdfr    struct ntlm_buf lm; /**< */
148178825Sdfr    struct ntlm_buf ntlm; /**< */
149178825Sdfr    struct ntlm_buf sessionkey; /**< */
150178825Sdfr    char *ws; /**< */
151178825Sdfr    uint32_t os[2]; /**< */
152178825Sdfr};
153178825Sdfr
154233294Sstas#include <ntlm_err.h>
155178825Sdfr#include <heimntlm-protos.h>
156178825Sdfr
157178825Sdfr#endif /* NTLM_NTLM_H */
158