dsparse.h (3413B)
1/** 2 * WinPR: Windows Portable Runtime 3 * Active Directory Domain Services Parsing Functions 4 * 5 * Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com> 6 * 7 * Licensed under the Apache License, Version 2.0 (the "License"); 8 * you may not use this file except in compliance with the License. 9 * You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, software 14 * distributed under the License is distributed on an "AS IS" BASIS, 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 * See the License for the specific language governing permissions and 17 * limitations under the License. 18 */ 19 20#ifndef WINPR_DSPARSE_H 21#define WINPR_DSPARSE_H 22 23#if defined(_WIN32) && !defined(_UWP) 24 25#include <winpr/windows.h> 26#include <winpr/rpc.h> 27 28#include <ntdsapi.h> 29 30#else 31 32#include <winpr/crt.h> 33#include <winpr/winpr.h> 34#include <winpr/wtypes.h> 35#include <winpr/error.h> 36 37typedef enum 38{ 39 DS_NAME_NO_FLAGS = 0x0, 40 DS_NAME_FLAG_SYNTACTICAL_ONLY = 0x1, 41 DS_NAME_FLAG_EVAL_AT_DC = 0x2, 42 DS_NAME_FLAG_GCVERIFY = 0x4, 43 DS_NAME_FLAG_TRUST_REFERRAL = 0x8 44} DS_NAME_FLAGS; 45 46typedef enum 47{ 48 DS_UNKNOWN_NAME = 0, 49 DS_FQDN_1779_NAME = 1, 50 DS_NT4_ACCOUNT_NAME = 2, 51 DS_DISPLAY_NAME = 3, 52 DS_UNIQUE_ID_NAME = 6, 53 DS_CANONICAL_NAME = 7, 54 DS_USER_PRINCIPAL_NAME = 8, 55 DS_CANONICAL_NAME_EX = 9, 56 DS_SERVICE_PRINCIPAL_NAME = 10, 57 DS_SID_OR_SID_HISTORY_NAME = 11, 58 DS_DNS_DOMAIN_NAME = 12 59} DS_NAME_FORMAT; 60 61typedef enum 62{ 63 DS_NAME_NO_ERROR = 0, 64 DS_NAME_ERROR_RESOLVING = 1, 65 DS_NAME_ERROR_NOT_FOUND = 2, 66 DS_NAME_ERROR_NOT_UNIQUE = 3, 67 DS_NAME_ERROR_NO_MAPPING = 4, 68 DS_NAME_ERROR_DOMAIN_ONLY = 5, 69 DS_NAME_ERROR_NO_SYNTACTICAL_MAPPING = 6, 70 DS_NAME_ERROR_TRUST_REFERRAL = 7 71} DS_NAME_ERROR; 72 73typedef enum 74{ 75 DS_SPN_DNS_HOST = 0, 76 DS_SPN_DN_HOST = 1, 77 DS_SPN_NB_HOST = 2, 78 DS_SPN_DOMAIN = 3, 79 DS_SPN_NB_DOMAIN = 4, 80 DS_SPN_SERVICE = 5 81} DS_SPN_NAME_TYPE; 82 83typedef struct 84{ 85 DWORD status; 86 LPTSTR pDomain; 87 LPTSTR pName; 88} DS_NAME_RESULT_ITEM, *PDS_NAME_RESULT_ITEM; 89 90typedef struct 91{ 92 DWORD cItems; 93 PDS_NAME_RESULT_ITEM rItems; 94} DS_NAME_RESULT, *PDS_NAME_RESULT; 95 96#ifdef __cplusplus 97extern "C" 98{ 99#endif 100 101 WINPR_API DWORD DsCrackSpnW(LPCWSTR pszSpn, DWORD* pcServiceClass, LPWSTR ServiceClass, 102 DWORD* pcServiceName, LPWSTR ServiceName, DWORD* pcInstanceName, 103 LPWSTR InstanceName, USHORT* pInstancePort); 104 105 WINPR_API DWORD DsCrackSpnA(LPCSTR pszSpn, LPDWORD pcServiceClass, LPSTR ServiceClass, 106 LPDWORD pcServiceName, LPSTR ServiceName, LPDWORD pcInstanceName, 107 LPSTR InstanceName, USHORT* pInstancePort); 108 109#ifdef UNICODE 110#define DsCrackSpn DsCrackSpnW 111#else 112#define DsCrackSpn DsCrackSpnA 113#endif 114 115 WINPR_API DWORD DsMakeSpnW(LPCWSTR ServiceClass, LPCWSTR ServiceName, LPCWSTR InstanceName, 116 USHORT InstancePort, LPCWSTR Referrer, DWORD* pcSpnLength, 117 LPWSTR pszSpn); 118 119 WINPR_API DWORD DsMakeSpnA(LPCSTR ServiceClass, LPCSTR ServiceName, LPCSTR InstanceName, 120 USHORT InstancePort, LPCSTR Referrer, DWORD* pcSpnLength, 121 LPSTR pszSpn); 122 123#ifdef __cplusplus 124} 125#endif 126 127#ifdef UNICODE 128#define DsMakeSpn DsMakeSpnW 129#else 130#define DsMakeSpn DsMakeSpnA 131#endif 132 133#endif 134 135#endif /* WINPR_DSPARSE_H */