1 /**
2  * @file nspapi.h
3  * Copyright 2012, 2013 MinGW.org project
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice (including the next
13  * paragraph) shall be included in all copies or substantial portions of the
14  * Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  * DEALINGS IN THE SOFTWARE.
23  */
24 #ifndef _NSPAPI_H
25 #define _NSPAPI_H
26 #pragma GCC system_header
27 #include <_mingw.h>
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 #define NS_ALL		0
34 
35 #define NS_SAP		1
36 #define NS_NDS		2
37 #define NS_PEER_BROWSE	3
38 
39 #define NS_TCPIP_LOCAL	10
40 #define NS_TCPIP_HOSTS	11
41 #define NS_DNS		12
42 #define NS_NETBT	13
43 #define NS_WINS		14
44 
45 #define NS_NBP		20
46 
47 #define NS_MS		30
48 #define NS_STDA		31
49 #define NS_NTDS		32
50 
51 #define NS_X500		40
52 #define NS_NIS		41
53 #define NS_NISPLUS	42
54 
55 #define NS_WRQ		50
56 
57 #define SERVICE_REGISTER	1
58 #define SERVICE_DEREGISTER	2
59 #define SERVICE_FLUSH		3
60 #define SERVICE_FLAG_HARD	0x00000002
61 
62 #ifndef RC_INVOKED
63 
64 #if defined (_WINSOCK_H) || defined (_WINSOCK2_H) /* needed for LPSOCKADDR */
65 #ifndef __CSADDR_T_DEFINED /* also in winsock2.h, but not in winsock.h */
66 #define __CSADDR_T_DEFINED
67 typedef struct _SOCKET_ADDRESS {
68 	LPSOCKADDR lpSockaddr;
69 	INT iSockaddrLength;
70 } SOCKET_ADDRESS,*PSOCKET_ADDRESS,*LPSOCKET_ADDRESS;
71 typedef struct _CSADDR_INFO {
72 	SOCKET_ADDRESS LocalAddr;
73 	SOCKET_ADDRESS RemoteAddr;
74 	INT iSocketType;
75 	INT iProtocol;
76 } CSADDR_INFO,*PCSADDR_INFO,*LPCSADDR_INFO;
77 #endif
78 #endif
79 
80 #ifndef __BLOB_T_DEFINED /* also in wtypes.h and winsock2.h */
81 #define __BLOB_T_DEFINED
82 typedef struct _BLOB {
83 	ULONG	cbSize;
84 	BYTE	*pBlobData;
85 } BLOB,*PBLOB,*LPBLOB;
86 #endif
87 
88 typedef struct _SERVICE_ADDRESS {
89 	DWORD dwAddressType;
90 	DWORD dwAddressFlags;
91 	DWORD dwAddressLength;
92 	DWORD dwPrincipalLength;
93 	BYTE *lpAddress;
94 	BYTE *lpPrincipal;
95 } SERVICE_ADDRESS;
96 typedef struct _SERVICE_ADDRESSES {
97 	DWORD dwAddressCount;
98 	SERVICE_ADDRESS Addresses[1];
99 } SERVICE_ADDRESSES, *PSERVICE_ADDRESSES, *LPSERVICE_ADDRESSES;
100 typedef struct _SERVICE_INFOA {
101 	LPGUID lpServiceType;
102 	LPSTR lpServiceName;
103 	LPSTR lpComment;
104 	LPSTR lpLocale;
105 	DWORD dwDisplayHint;
106 	DWORD dwVersion;
107 	DWORD dwTime;
108 	LPSTR lpMachineName;
109 	LPSERVICE_ADDRESSES lpServiceAddress;
110 	BLOB ServiceSpecificInfo;
111 } SERVICE_INFOA, *LPSERVICE_INFOA;
112 typedef struct _SERVICE_INFOW {
113 	LPGUID lpServiceType;
114 	LPWSTR lpServiceName;
115 	LPWSTR lpComment;
116 	LPWSTR lpLocale;
117 	DWORD dwDisplayHint;
118 	DWORD dwVersion;
119 	DWORD dwTime;
120 	LPWSTR lpMachineName;
121 	LPSERVICE_ADDRESSES lpServiceAddress;
122 	BLOB ServiceSpecificInfo;
123 } SERVICE_INFOW, *LPSERVICE_INFOW;
124 
125 typedef void *LPSERVICE_ASYNC_INFO;
126 INT WINAPI SetServiceA(DWORD,DWORD,DWORD,LPSERVICE_INFOA,LPSERVICE_ASYNC_INFO,LPDWORD);
127 INT WINAPI SetServiceW(DWORD,DWORD,DWORD,LPSERVICE_INFOW,LPSERVICE_ASYNC_INFO,LPDWORD);
128 INT WINAPI GetAddressByNameA(DWORD,LPGUID,LPSTR,LPINT,DWORD,LPSERVICE_ASYNC_INFO,LPVOID,LPDWORD,LPSTR,LPDWORD);
129 INT WINAPI GetAddressByNameW(DWORD,LPGUID,LPWSTR,LPINT,DWORD,LPSERVICE_ASYNC_INFO,LPVOID,LPDWORD,LPWSTR,LPDWORD);
130 
131 typedef __AW(SERVICE_INFO) SERVICE_INFO, *LPSERVICE_INFO;
132 #define _SERVICE_INFO __AW(SERVICE_INFO)
133 #define SetService __AW(SetService)
134 #define GetAddressByName __AW(GetAddressByName)
135 
136 #endif /* RC_INVOKED */
137 
138 #ifdef __cplusplus
139 }
140 #endif
141 
142 #endif /* _NSPAPI_H */
143