xref: /aosp_15_r20/external/cronet/net/tools/gssapi/gss_types.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2019 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef NET_TOOLS_GSSAPI_GSS_TYPES_H_
6 #define NET_TOOLS_GSSAPI_GSS_TYPES_H_
7 
8 #include <cstddef>
9 #include <cstdint>
10 
11 // Define a minimal subset of the definitions needed to build a loadable fake
12 // GSSAPI library. The bindings follow RFC 2744. The code follows the RFC
13 // faithfully with the possible exception of `const` qualifiers for some
14 // function arguments.
15 //
16 // Note that //net/http/http_auth_gssapi_posix* functions depend on the gssapi.h
17 // as found on the host platform. For test purposes file does not depend on the
18 // system gssapi.h in order to reduce sensitivity to the host environment.
19 //
20 // These declarations follow RFC 2744 Appendix A with the exception of using
21 // C++isms in some places.
22 
23 using OM_uint32 = uint32_t;
24 using gss_qop_t = uint32_t;
25 
26 struct gss_buffer_desc_struct {
27   size_t length;
28   void* value;
29 };
30 using gss_buffer_desc = gss_buffer_desc_struct;
31 using gss_buffer_t = gss_buffer_desc_struct*;
32 
33 struct gss_OID_desc_struct {
34   OM_uint32 length;
35   void* elements;
36 };
37 using gss_OID_desc = gss_OID_desc_struct;
38 using gss_OID = gss_OID_desc_struct*;
39 
40 struct gss_channel_bindings_struct {
41   OM_uint32 initiator_addrtype;
42   gss_buffer_desc initiator_address;
43   OM_uint32 acceptor_addrtype;
44   gss_buffer_desc acceptor_address;
45   gss_buffer_desc application_data;
46 };
47 using gss_channel_bindings_t = gss_channel_bindings_struct*;
48 
49 // Following structures are defined as <implementation-specific>.
50 
51 struct FakeGssName {};
52 using gss_name_t = FakeGssName*;
53 
54 struct FakeGssCredId {};
55 using gss_cred_id_t = FakeGssCredId*;
56 
57 struct FakeGssCtxId {};
58 using gss_ctx_id_t = FakeGssCtxId*;
59 
60 #if defined(WIN32)
61 #define GSS_EXPORT __declspec(dllexport)
62 #else
63 #define GSS_EXPORT __attribute__((visibility("default")))
64 #endif
65 
66 #endif  // NET_TOOLS_GSSAPI_GSS_TYPES_H_
67