4 * NetBIOS extensions to the standard WinSock API.
8 * Written by Kai Henningsen <kai-henningsen@users.sourceforge.net>
9 * Copyright (C) 2002, 2017, MinGW.org Project
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:
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
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.
33 #pragma GCC system_header
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
46 typedef struct sockaddr_nb
49 char snb_name[NETBIOS_NAME_LENGTH];
50 } SOCKADDR_NB, *PSOCKADDR_NB, *LPSOCKADDR_NB;
52 #define SET_NETBIOS_SOCKADDR(_snb,_type,_name,_port) \
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); \
65 #endif /* RC_INVOKED */
66 #endif /* !_WSNETBS_H: $RCSfile$: end of file */