NBIP 3.61 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
/* Copyright 1998 Acorn Computers Ltd
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/*
*  Lan Manager client
*
*  NBNS.H -- Private Definitions for NetBIOS-over-IP
*
*  Versions
*  29-01-96 INH Original
*
*/

/* RFC-1002 definitions ---------------------------- */

#define NBNS_PORT 137         /* UDP */

/* Flags to CreateNBNSheader */
#define HAS_QUERY	(1<<16)
#define HAS_ANSWER	(1<<17)
#define HAS_AUTHORITY	(1<<18)
#define HAS_ADDITIONAL	(1<<19)

/* Opcode field definitions */

#define OPC_OPCODE_MASK (15<<11)  /* Opcode bits */
#define OPC_STATUS_MASK  15

#define OPC_REQUEST	0
#define OPC_REPLY	(1<<15)

#define OPC_FIND	(0<<11)
#define OPC_REGISTER	(5<<11)
#define OPC_RELEASE	(6<<11)
#define OPC_WACK	(7<<11)
#define OPC_REFRESH	(8<<11)


#define OPC_AUTHORITY	(1<<10)
#define OPC_TRUNCATED	(1<<9)
#define OPC_REC_DESIRED	(1<<8)
#define OPC_REC_AVAIL	(1<<7)
#define OPC_BROADCAST	(1<<4)

/* Status values */
#define ST_OK		0
#define ST_FMT_ERR	1
#define ST_SRV_ERR	2
#define ST_NAM_ERR	3
#define ST_IMP_ERR	4
#define ST_RFS_ERR	5
#define ST_ACT_ERR	6
#define ST_CFT_ERR	7

/* Commonly used combinations */

#define NAME_REG_REQUEST	(OPC_REQUEST|OPC_REGISTER|OPC_REC_DESIRED  \
                                  |OPC_BROADCAST|HAS_QUERY|HAS_ADDITIONAL)

#define NAME_OVERWRITE_REQUEST	(OPC_REQUEST|OPC_REGISTER|OPC_BROADCAST    \
				  |HAS_QUERY|HAS_ADDITIONAL)

#define NAME_REG_REPLY		(OPC_REPLY  |OPC_REGISTER|OPC_AUTHORITY    \
                                  |OPC_REC_DESIRED|OPC_REC_AVAIL|HAS_ANSWER)

#define NAME_END_CHALLENGE	(OPC_REPLY  |OPC_REGISTER|OPC_AUTHORITY    \
				  |OPC_REC_DESIRED|HAS_ANSWER)

#define NAME_REFRESH_REQUEST	(OPC_REQUEST|OPC_REFRESH|OPC_BROADCAST     \
                                  |HAS_QUERY|HAS_ADDITIONAL)

#define NAME_RLSE_REQUEST	(OPC_REQUEST|OPC_RELEASE|OPC_BROADCAST     \
				  |HAS_QUERY|HAS_ADDITIONAL)

#define NAME_RLSE_REPLY		(OPC_REPLY  |OPC_RELEASE|OPC_AUTHORITY     \
				  |HAS_ANSWER)

#define NAME_FIND_REQUEST	(OPC_REQUEST|OPC_FIND|OPC_REC_DESIRED      \
                                  |HAS_QUERY)
#define NAME_STATUS_REQUEST	(OPC_REQUEST|OPC_FIND|HAS_QUERY)

#define NAME_FIND_REPLY		(OPC_REPLY  |OPC_FIND|OPC_AUTHORITY      \
				  |OPC_REC_DESIRED|HAS_ANSWER)

#define NAME_FIND_REDIRECT	(OPC_REPLY  |OPC_FIND|OPC_REC_DESIRED    \
				  |HAS_AUTHORITY|HAS_ADDITIONAL)

#define NAME_WAIT		(OPC_REPLY |OPC_WACK|OPC_AUTHORITY|HAS_ANSWER)

/* Misc flags ---- */

#define INET_IPADDR_TAG		0x00010001
#define INET_NAMESRV_TAG	0x00020001
#define INET_NULL_TAG		0x000A0001
#define INET_NAME_TAG		0x00200001
#define INET_STATUS_TAG		0x00210001


#define NBFLG_UNIQUE	0
#define NBFLG_GROUP	0x8000
#define NBFLG_BNODE	0
#define NBFLG_PNODE	0x2000
#define NBFLG_MNODE	0x4000

/* Extra flags for status queries */
#define NBFLG_RELEASE	0x1000
#define NBFLG_CONFLICT	0x800
#define NBFLG_ACTIVE	0x400
#define NBFLG_PERMANENT	0x200


/* Session services ------------ */

#define NBIP_SESSION_PORT 139 /* TCP */

#define NBIP_SESS_DATA      0x00
#define NBIP_SESS_REQUEST   0x81
#define NBIP_SESS_OK        0x82
#define NBIP_SESS_REJECT    0x83
#define NBIP_SESS_RETARGET  0x84
#define NBIP_SESS_KEEPALIVE 0x85