8 #include <basictypes.h> 47 #define NETBIOS_NAME_MICROSOFT_VARIANT (1) 50 #ifdef NETBIOS_NAME_MICROSOFT_VARIANT 51 #define NETBIOS_NAME_SIZE_IN_CHARS (15) 52 #define NETBIOS_NAME_MICROSOFT_SUFFIX_IN_CHARS (1) 54 #define NETBIOS_NAME_SIZE_IN_CHARS (16) 58 #define NETBIOS_NAME_SUFFIX_WORKSTATION (0x00) 61 #define NETBIOS_OPCODE_QUERY (0) 62 #define NETBIOS_OPCODE_REGISTRATION (5) 63 #define NETBIOS_OPCODE_RELEASE (6) 64 #define NETBIOS_OPCODE_WACK (7) 65 #define NETBIOS_OPCODE_REFRESH (8) 68 #define NETBIOS_OWNER_NODE_TYPE_B_NODE (0x0) 69 #define NETBIOS_OWNER_NODE_TYPE_P_NODE (0x1) 70 #define NETBIOS_OWNER_NODE_TYPE_M_NODE (0x2) 71 #define NETBIOS_OWNER_NODE_TYPE_H_NODE (0x3) 80 #define NETBIOS_NAME_LABEL_NAME (0x20) 81 #define NETBIOS_NAME_LABEL_POINTER (0xC0) 84 #define NETBIOS_COMPRESSED_NAME_LENGTH (NETBIOS_NAME_SIZE_IN_CHARS * 2) 93 #define NETBIOS_REQUEST_TYPE_NB (0x0020) 94 #define NETBIOS_REQUEST_TYPE_NBSTAT (0x0021) 102 #define NETBIOS_REQUEST_CLASS_IN (0x0001) 105 #define NETBIOS_INFINITE_TTL (0) 108 #define NETBIOS_UNIT_ID_IN_BYTES (6) 141 typedef struct _OpCodeNmFlagsRCode
153 } __attribute__((packed)) OpCodeNmFlagsRCode;
166 typedef struct _NameServicePacketHeader
168 uint16_t name_trn_id;
169 OpCodeNmFlagsRCode opcode_nmflags_rcode;
175 } __attribute__((packed)) NameServicePacketHeader;
185 typedef struct _NameServiceName
187 uint8_t label_length_count;
188 uint8_t name[NETBIOS_COMPRESSED_NAME_LENGTH];
189 #ifdef NETBIOS_NAME_MICROSOFT_VARIANT 190 uint8_t suffix[(NETBIOS_NAME_MICROSOFT_SUFFIX_IN_CHARS * 2)];
192 uint8_t zero_termination;
194 } __attribute__((packed)) NameServiceName;
204 typedef struct _NameServiceQuestionEntry
206 NameServiceName name;
207 uint16_t question_type;
208 uint16_t question_class;
210 } __attribute__((packed)) NameServiceQuestionEntry;
219 typedef struct _NbFlags
225 } __attribute__((packed)) NbFlags;
234 typedef struct _NameServiceResourceRecordNamePointerHeader
236 uint8_t rr_nameLabel;
237 uint8_t rr_nameIndex;
241 } __attribute__((packed)) NameServiceResourceRecordNamePointerHeader;
254 typedef struct _NameServiceResourceRecordTrailer
261 } __attribute__((packed)) NameServiceResourceRecordTrailer;
277 typedef struct _NameFlags
287 } __attribute__((packed)) Name_Flags;
297 typedef struct _NodeNameEntry
299 char name[NETBIOS_NAME_SIZE_IN_CHARS];
300 #ifdef NETBIOS_NAME_MICROSOFT_VARIANT 303 Name_Flags name_flags;
305 } __attribute__((packed)) NodeNameEntry;
315 typedef struct _NameServiceNodeStatusResponseTrailer
321 } __attribute__((packed)) NameServiceNodeStatusResponseTrailer;
348 typedef struct _NameServiceNodeStatusResponseStatistics
350 uint8_t unit_id[NETBIOS_UNIT_ID_IN_BYTES];
353 uint16_t version_number;
354 uint16_t number_of_crc;
355 uint16_t period_of_statistics;
356 uint16_t number_alignment_errors;
357 uint16_t number_of_collisions;
358 uint16_t number_send_aborts;
359 uint32_t number_good_sends;
360 uint32_t number_good_receives;
361 uint16_t number_retransmits;
362 uint16_t number_of_conditions;
363 uint16_t number_free_command_blocks;
364 uint16_t total_number_command_blocks;
365 uint16_t nax_total_command_blocks;
366 uint16_t number_pending_sessions;
367 uint16_t max_number_pending_sessions;
368 uint16_t max_total_pending_sessions;
369 uint16_t session_data_packet_size;
371 } __attribute__((packed)) NameServiceNodeStatusResponseStatistics;
380 typedef void(UdpNetbiosNameServiceFunc)(PoolPtr poolPtr);
381 extern UdpNetbiosNameServiceFunc *UdpNetbiosNameServicePtr;
420 void NetbiosConvertName(
char *netBIOSnamePtr,
const char *namePtr,
int netBIOSnameSize);
444 int NetbiosGetNetbiosName(
char *netBIOSnamePtr,
int netBIOSnameSize);
466 void NetbiosEnableNameService(
const char *name, BOOL initialRegister);