OSDN Git Service

9914efcd41d1e923ef474726544529f738fc74b3
[mingw/mingw-org-wsl.git] / w32api / include / wsnetbs.h
1 /*
2  * wsnetbs.h
3  *
4  * NetBIOS extensions to the standard WinSock API.
5  *
6  * $Id$
7  *
8  * Written by Kai Henningsen <kai-henningsen@users.sourceforge.net>
9  * Copyright (C) 2002, 2017, MinGW.org Project
10  *
11  *
12  * Permission is hereby granted, free of charge, to any person obtaining a
13  * copy of this software and associated documentation files (the "Software"),
14  * to deal in the Software without restriction, including without limitation
15  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
16  * and/or sell copies of the Software, and to permit persons to whom the
17  * Software is furnished to do so, subject to the following conditions:
18  *
19  * The above copyright notice and this permission notice (including the next
20  * paragraph) shall be included in all copies or substantial portions of the
21  * Software.
22  *
23  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29  * DEALINGS IN THE SOFTWARE.
30  *
31  */
32 #ifndef _WSNETBS_H
33 #pragma GCC system_header
34 #define _WSNETBS_H
35
36 #define NETBIOS_NAME_LENGTH             16
37 #define NETBIOS_UNIQUE_NAME              0
38 #define NETBIOS_GROUP_NAME               1
39 #define NETBIOS_TYPE_QUICK_UNIQUE        2
40 #define NETBIOS_TYPE_QUICK_GROUP         3
41
42 #ifndef RC_INVOKED
43
44 #include "_winsock.h"
45
46 typedef struct sockaddr_nb
47 { short         snb_family;
48   u_short       snb_type;
49   char          snb_name[NETBIOS_NAME_LENGTH];
50 } SOCKADDR_NB, *PSOCKADDR_NB, *LPSOCKADDR_NB;
51
52 #define SET_NETBIOS_SOCKADDR(_snb,_type,_name,_port)                    \
53   { register int _i;                                                    \
54     register char *_n = (_name);                                        \
55     register PSOCKADDR_NB _s = (_snb);                                  \
56     _s->snb_family = AF_NETBIOS;                                        \
57     _s->snb_type = (_type);                                             \
58     for (_i = 0; _n[_i] != '\0' && _i < NETBIOS_NAME_LENGTH - 1; _i++)  \
59       { _s->snb_name[_i] = _n[_i]; }                                    \
60     while (_i < NETBIOS_NAME_LENGTH - 1)                                \
61       { _s->snb_name[_i++] = ' '; }                                     \
62     _s->snb_name[NETBIOS_NAME_LENGTH - 1] = (_port);                    \
63   }
64
65 #endif  /* RC_INVOKED */
66 #endif  /* !_WSNETBS_H: $RCSfile$: end of file */