| [222] | 1 | #include "idl_types.h"
|
|---|
| 2 |
|
|---|
| 3 | /*
|
|---|
| 4 | IDL structures for NBT operations
|
|---|
| 5 |
|
|---|
| 6 | NBT is not traditionally encoded using IDL/NDR. This is a bit of an
|
|---|
| 7 | experiment, and I may well switch us back to a more traditional
|
|---|
| 8 | encoding if it doesn't work out
|
|---|
| 9 | */
|
|---|
| 10 |
|
|---|
| 11 | import "misc.idl", "security.idl", "svcctl.idl", "samr.idl";
|
|---|
| 12 | [
|
|---|
| 13 | helper("libcli/netlogon.h", "libcli/nbt/libnbt.h")
|
|---|
| 14 | ]
|
|---|
| 15 | interface nbt
|
|---|
| 16 | {
|
|---|
| 17 | const int NBT_NAME_SERVICE_PORT = 137;
|
|---|
| 18 | const int NBT_DGRAM_SERVICE_PORT = 138;
|
|---|
| 19 |
|
|---|
| 20 | typedef [bitmap16bit] bitmap {
|
|---|
| 21 | NBT_RCODE = 0x000F,
|
|---|
| 22 | NBT_FLAG_BROADCAST = 0x0010,
|
|---|
| 23 | NBT_FLAG_RECURSION_AVAIL = 0x0080,
|
|---|
| 24 | NBT_FLAG_RECURSION_DESIRED = 0x0100,
|
|---|
| 25 | NBT_FLAG_TRUNCATION = 0x0200,
|
|---|
| 26 | NBT_FLAG_AUTHORITIVE = 0x0400,
|
|---|
| 27 | NBT_OPCODE = 0x7800,
|
|---|
| 28 | NBT_FLAG_REPLY = 0x8000
|
|---|
| 29 | } nbt_operation;
|
|---|
| 30 |
|
|---|
| 31 | /* the opcodes are in the operation field, masked with
|
|---|
| 32 | NBT_OPCODE */
|
|---|
| 33 | typedef enum {
|
|---|
| 34 | NBT_OPCODE_QUERY = (0x0<<11),
|
|---|
| 35 | NBT_OPCODE_REGISTER = (0x5<<11),
|
|---|
| 36 | NBT_OPCODE_RELEASE = (0x6<<11),
|
|---|
| 37 | NBT_OPCODE_WACK = (0x7<<11),
|
|---|
| 38 | NBT_OPCODE_REFRESH = (0x8<<11),
|
|---|
| 39 | NBT_OPCODE_REFRESH2 = (0x9<<11),
|
|---|
| 40 | NBT_OPCODE_MULTI_HOME_REG = (0xf<<11)
|
|---|
| 41 | } nbt_opcode;
|
|---|
| 42 |
|
|---|
| 43 | /* rcode values */
|
|---|
| 44 | typedef enum {
|
|---|
| 45 | NBT_RCODE_OK = 0x0,
|
|---|
| 46 | NBT_RCODE_FMT = 0x1,
|
|---|
| 47 | NBT_RCODE_SVR = 0x2,
|
|---|
| 48 | NBT_RCODE_NAM = 0x3,
|
|---|
| 49 | NBT_RCODE_IMP = 0x4,
|
|---|
| 50 | NBT_RCODE_RFS = 0x5,
|
|---|
| 51 | NBT_RCODE_ACT = 0x6,
|
|---|
| 52 | NBT_RCODE_CFT = 0x7
|
|---|
| 53 | } nbt_rcode;
|
|---|
| 54 |
|
|---|
| 55 | /* we support any 8bit name type, but by defining the common
|
|---|
| 56 | ones here we get better debug displays */
|
|---|
| 57 | typedef [enum8bit] enum {
|
|---|
| 58 | NBT_NAME_CLIENT = 0x00,
|
|---|
| 59 | NBT_NAME_MS = 0x01,
|
|---|
| 60 | NBT_NAME_USER = 0x03,
|
|---|
| 61 | NBT_NAME_SERVER = 0x20,
|
|---|
| 62 | NBT_NAME_PDC = 0x1B,
|
|---|
| 63 | NBT_NAME_LOGON = 0x1C,
|
|---|
| 64 | NBT_NAME_MASTER = 0x1D,
|
|---|
| 65 | NBT_NAME_BROWSER = 0x1E
|
|---|
| 66 | } nbt_name_type;
|
|---|
| 67 |
|
|---|
| 68 | /* the ndr parser for nbt_name is separately defined in
|
|---|
| 69 | nbtname.c (along with the parsers for nbt_string) */
|
|---|
| 70 | typedef [public,nopull,nopush] struct {
|
|---|
| 71 | string name;
|
|---|
| 72 | string scope;
|
|---|
| 73 | nbt_name_type type;
|
|---|
| 74 | } nbt_name;
|
|---|
| 75 |
|
|---|
| 76 | typedef [public,enum16bit] enum {
|
|---|
| 77 | NBT_QCLASS_IP = 0x01
|
|---|
| 78 | } nbt_qclass;
|
|---|
| 79 |
|
|---|
| 80 | typedef [public,enum16bit] enum {
|
|---|
| 81 | NBT_QTYPE_ADDRESS = 0x0001,
|
|---|
| 82 | NBT_QTYPE_NAMESERVICE = 0x0002,
|
|---|
| 83 | NBT_QTYPE_NULL = 0x000A,
|
|---|
| 84 | NBT_QTYPE_NETBIOS = 0x0020,
|
|---|
| 85 | NBT_QTYPE_STATUS = 0x0021
|
|---|
| 86 | } nbt_qtype;
|
|---|
| 87 |
|
|---|
| 88 | typedef struct {
|
|---|
| 89 | nbt_name name;
|
|---|
| 90 | nbt_qtype question_type;
|
|---|
| 91 | nbt_qclass question_class;
|
|---|
| 92 | } nbt_name_question;
|
|---|
| 93 |
|
|---|
| 94 | /* these are the possible values of the NBT_NM_OWNER_TYPE
|
|---|
| 95 | field */
|
|---|
| 96 | typedef enum {
|
|---|
| 97 | NBT_NODE_B = 0x0000,
|
|---|
| 98 | NBT_NODE_P = 0x2000,
|
|---|
| 99 | NBT_NODE_M = 0x4000,
|
|---|
| 100 | NBT_NODE_H = 0x6000
|
|---|
| 101 | } nbt_node_type;
|
|---|
| 102 |
|
|---|
| 103 | typedef [bitmap16bit] bitmap {
|
|---|
| 104 | NBT_NM_PERMANENT = 0x0200,
|
|---|
| 105 | NBT_NM_ACTIVE = 0x0400,
|
|---|
| 106 | NBT_NM_CONFLICT = 0x0800,
|
|---|
| 107 | NBT_NM_DEREGISTER = 0x1000,
|
|---|
| 108 | NBT_NM_OWNER_TYPE = 0x6000,
|
|---|
| 109 | NBT_NM_GROUP = 0x8000
|
|---|
| 110 | } nb_flags;
|
|---|
| 111 |
|
|---|
| 112 | typedef struct {
|
|---|
| 113 | nb_flags nb_flags;
|
|---|
| 114 | ipv4address ipaddr;
|
|---|
| 115 | } nbt_rdata_address;
|
|---|
| 116 |
|
|---|
| 117 | typedef struct {
|
|---|
| 118 | uint16 length;
|
|---|
| 119 | nbt_rdata_address addresses[length/6];
|
|---|
| 120 | } nbt_rdata_netbios;
|
|---|
| 121 |
|
|---|
| 122 | typedef struct {
|
|---|
| 123 | uint8 unit_id[6];
|
|---|
| 124 | uint8 jumpers;
|
|---|
| 125 | uint8 test_result;
|
|---|
| 126 | uint16 version_number;
|
|---|
| 127 | uint16 period_of_statistics;
|
|---|
| 128 | uint16 number_of_crcs;
|
|---|
| 129 | uint16 number_alignment_errors;
|
|---|
| 130 | uint16 number_of_collisions;
|
|---|
| 131 | uint16 number_send_aborts;
|
|---|
| |
|---|