2 * Private SSPI definitions for CUPS.
4 * Copyright 2010 by Apple Inc.
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/".
13 #ifndef _CUPS_SSPI_PRIVATE_H_
14 # define _CUPS_SSPI_PRIVATE_H_
17 * Include necessary headers...
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>
36 # endif /* __cplusplus */
39 typedef struct /**** SSPI/SSL data structure ****/
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 */
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
,
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
,
73 void _sspiSetAllowsExpiredCerts(_sspi_struct_t
*conn
,
75 int _sspiWrite(_sspi_struct_t
*conn
,
76 void *buf
, size_t len
);
81 # endif /* __cplusplus */
82 #endif /* !_CUPS_SSPI_PRIVATE_H_ */