]> git.ipfire.org Git - thirdparty/cups.git/blob - cups/sspi-private.h
<rdar://problem/13655599> Seed: Print queue JOBS disappear after computer Wakes up...
[thirdparty/cups.git] / cups / sspi-private.h
1 /*
2 * Private SSPI definitions for CUPS.
3 *
4 * Copyright 2010 by Apple Inc.
5 *
6 * These coded instructions, statements, and computer programs are the
7 * property of Apple Inc. and are protected by Federal copyright
8 * law. Distribution and use rights are outlined in the file "LICENSE.txt"
9 * which should have been included with this file. If this file is
10 * file is missing or damaged, see the license at "http://www.cups.org/".
11 */
12
13 #ifndef _CUPS_SSPI_PRIVATE_H_
14 # define _CUPS_SSPI_PRIVATE_H_
15
16 /*
17 * Include necessary headers...
18 */
19
20 # include <config.h>
21 # include <winsock2.h>
22 # include <ws2tcpip.h>
23 # include <wincrypt.h>
24 # include <wintrust.h>
25 # include <schannel.h>
26 # define SECURITY_WIN32
27 # include <security.h>
28 # include <sspi.h>
29
30 /*
31 * C++ magic...
32 */
33
34 # ifdef __cplusplus
35 extern "C" {
36 # endif /* __cplusplus */
37
38
39 typedef struct /**** SSPI/SSL data structure ****/
40 {
41 SOCKET sock; /* TCP/IP socket */
42 CredHandle creds; /* Credentials */
43 CtxtHandle context; /* SSL context */
44 BOOL contextInitialized; /* Is context init'd? */
45 SecPkgContext_StreamSizes streamSizes; /* SSL data stream sizes */
46 BYTE *decryptBuffer; /* Data pre-decryption*/
47 size_t decryptBufferLength; /* Length of decrypt buffer */
48 size_t decryptBufferUsed; /* Bytes used in buffer */
49 BYTE *readBuffer; /* Data post-decryption */
50 size_t readBufferLength; /* Length of read buffer */
51 size_t readBufferUsed; /* Bytes used in buffer */
52 DWORD certFlags; /* Cert verification flags */
53 } _sspi_struct_t;
54
55
56 /*
57 * Prototypes...
58 */
59 _sspi_struct_t *_sspiAlloc(void);
60 BOOL _sspiAccept(_sspi_struct_t *conn);
61 BOOL _sspiConnect(_sspi_struct_t *conn,
62 const CHAR *hostname);
63 void _sspiFree(_sspi_struct_t *conn);
64 BOOL _sspiGetCredentials(_sspi_struct_t *conn,
65 const LPWSTR containerName,
66 const TCHAR *commonName,
67 BOOL server);
68 int _sspiPending(_sspi_struct_t *conn);
69 int _sspiRead(_sspi_struct_t *conn,
70 void *buf, size_t len);
71 void _sspiSetAllowsAnyRoot(_sspi_struct_t *conn,
72 BOOL allow);
73 void _sspiSetAllowsExpiredCerts(_sspi_struct_t *conn,
74 BOOL allow);
75 int _sspiWrite(_sspi_struct_t *conn,
76 void *buf, size_t len);
77
78
79 # ifdef __cplusplus
80 }
81 # endif /* __cplusplus */
82 #endif /* !_CUPS_SSPI_PRIVATE_H_ */