Lines Matching refs:packet

49  * A REQUEST packet is always sent to the well known UDP port 137.
52 * initialization time. In rare cases, a request packet will be sent to
55 * A RESPONSE packet is always sent to the source UDP port and source IP
56 * address of the request packet.
58 * A DEMAND packet must always be sent to the well known UDP port 137.
130 struct name_packet *packet;
156 struct name_packet *packet);
187 struct name_packet packet;
191 * The response packet has in it the address of the presumed owner
197 if ((answer = reply_info->packet->answer) == 0)
203 packet.info = NAME_QUERY_REQUEST | NM_FLAGS_UNICAST;
204 packet.qdcount = 1; /* question entries */
205 packet.question = &question;
206 packet.ancount = 0; /* answer recs */
207 packet.answer = NULL;
208 packet.nscount = 0; /* authority recs */
209 packet.authority = NULL;
210 packet.arcount = 0; /* additional recs */
211 packet.additional = NULL;
216 packet.name_trn_id = tid;
217 if (smb_send_name_service_packet(addr, &packet) >= 0) {
219 &packet, UCAST_REQ_RETRY_TIMEOUT)) != 0)
260 info = reply->packet->info;
262 answer = reply->packet->answer;
267 free(reply->packet);
295 smb_reply_ready(struct name_packet *packet, addr_entry_t *addr)
303 if (reply->name_trn_id == packet->name_trn_id) {
307 reply->packet = packet;
319 answer = packet->answer;
322 free(packet);
327 struct name_packet *packet, uint32_t timeout)
341 info = reply->packet->info;
342 answer = reply->packet->answer;
413 question = packet->question;
436 * The response packet has in it the
455 free(reply->packet);
475 * >0 -> Encode successful, value is length of packet in "buf"
665 * Returns a pointer to a name packet on success. Otherwise, returns
685 syslog(LOG_DEBUG, "nbns: short packet (%d bytes)", n_buf);
888 * Send out a name service packet to proper destination.
892 * struct name_packet *packet -> Packet to send
899 smb_send_name_service_packet(addr_entry_t *addr, struct name_packet *packet)
904 if ((len = smb_name_buf_from_packet(buf, sizeof (buf), packet)) < 0) {
916 * This function sends the given NetBIOS packet to the given
926 struct name_packet *packet, uint32_t retries, uint32_t timeout)
938 packet->name_trn_id = tid;
939 if (smb_send_name_service_packet(destination, packet) >= 0) {
941 packet, timeout);
969 struct name_packet packet;
989 packet.info = NAME_REGISTRATION_REQUEST | NM_FLAGS_BROADCAST;
997 packet.info = NAME_REGISTRATION_REQUEST | NM_FLAGS_UNICAST;
1000 packet.qdcount = 1; /* question entries */
1001 packet.question = question;
1002 packet.ancount = 0; /* answer recs */
1003 packet.answer = NULL;
1004 packet.nscount = 0; /* authority recs */
1005 packet.authority = NULL;
1006 packet.arcount = 1; /* additional recs */
1007 packet.additional = additional;
1011 packet.info |= NAME_MULTIHOME_REGISTRATION_REQUEST;
1021 rc = smb_netbios_send_rcv(bcast, &destination[i], &packet,
1044 struct name_packet packet;
1063 packet.info = NAME_REFRESH_REQUEST | NM_FLAGS_BROADCAST;
1073 packet.info = NAME_REFRESH_REQUEST | NM_FLAGS_UNICAST;
1087 packet.info = NAME_REFRESH_REQUEST | NM_FLAGS_UNICAST;
1094 packet.info |= NAME_MULTIHOME_REGISTRATION_REQUEST;
1096 packet.qdcount = 1; /* question entries */
1097 packet.question = question;
1098 packet.ancount = 0; /* answer recs */
1099 packet.answer = NULL;
1100 packet.nscount = 0; /* authority recs */
1101 packet.authority = NULL;
1102 packet.arcount = 1; /* additional recs */
1103 packet.additional = additional;
1109 rc = smb_netbios_send_rcv(bcast, &destination[i], &packet,
1120 rc = smb_netbios_send_rcv(bcast, addr, &packet,
1138 struct name_packet packet;
1141 bzero(&packet, sizeof (struct name_packet));
1144 packet.name_trn_id = original_packet->name_trn_id;
1145 packet.info = NAME_REGISTRATION_RESPONSE | NAME_NM_FLAGS_RA |
1147 packet.qdcount = 0; /* question entries */
1148 packet.question = NULL;
1149 packet.ancount = 1; /* answer recs */
1150 packet.answer = &answer;
1151 packet.nscount = 0; /* authority recs */
1152 packet.authority = NULL;
1153 packet.arcount = 0; /* additional recs */
1154 packet.additional = NULL;
1163 return (smb_send_name_service_packet(addr, &packet));
1179 struct name_packet packet;
1188 packet.info = NAME_RELEASE_REQUEST | NM_FLAGS_BROADCAST;
1196 packet.info = NAME_RELEASE_REQUEST | NM_FLAGS_UNICAST;
1199 packet.qdcount = 1; /* question entries */
1200 packet.question = question;
1201 packet.ancount = 0; /* answer recs */
1202 packet.answer = NULL;
1203 packet.nscount = 0; /* authority recs */
1204 packet.authority = NULL;
1205 packet.arcount = 1; /* additional recs */
1206 packet.additional = additional;
1209 rc = smb_netbios_send_rcv(bcast, &destination[i], &packet,
1227 struct name_packet packet;
1230 bzero(&packet, sizeof (struct name_packet));
1233 packet.name_trn_id = original_packet->name_trn_id;
1234 packet.info = NAME_RELEASE_RESPONSE | (rcode & NAME_RCODE_MASK);
1235 packet.qdcount = 0; /* question entries */
1236 packet.question = NULL;
1237 packet.ancount = 1; /* answer recs */
1238 packet.answer = &answer;
1239 packet.nscount = 0; /* authority recs */
1240 packet.authority = NULL;
1241 packet.arcount = 0; /* additional recs */
1242 packet.additional = NULL;
1251 return (smb_send_name_service_packet(addr, &packet));
1265 struct name_packet packet;
1276 packet.info = NAME_QUERY_REQUEST | NM_FLAGS_BROADCAST;
1284 packet.info = NAME_QUERY_REQUEST | NM_FLAGS_UNICAST;
1286 packet.qdcount = 1; /* question entries */
1287 packet.question = question;
1288 packet.ancount = 0; /* answer recs */
1289 packet.answer = NULL;
1290 packet.nscount = 0; /* authority recs */
1291 packet.authority = NULL;
1292 packet.arcount = 0; /* additional recs */
1293 packet.additional = NULL;
1300 packet.name_trn_id = tid;
1303 &packet) >= 0) {
1306 &packet, timeout)) != 0)
1328 struct name_packet packet;
1335 packet.name_trn_id = original_packet->name_trn_id;
1336 packet.info = NAME_QUERY_RESPONSE | (rcode & NAME_RCODE_MASK);
1337 packet.qdcount = 0; /* question entries */
1338 packet.question = NULL;
1339 packet.ancount = 1; /* answer recs */
1340 packet.answer = &answer;
1341 packet.nscount = 0; /* authority recs */
1342 packet.authority = NULL;
1343 packet.arcount = 0; /* additional recs */
1344 packet.additional = NULL;
1375 return (smb_send_name_service_packet(addr, &packet));
1388 struct name_packet packet;
1396 bzero(&packet, sizeof (struct name_packet));
1399 packet.name_trn_id = original_packet->name_trn_id;
1400 packet.info = NODE_STATUS_RESPONSE;
1401 packet.qdcount = 0; /* question entries */
1402 packet.question = NULL;
1403 packet.ancount = 1; /* answer recs */
1404 packet.answer = &answer;
1405 packet.nscount = 0; /* authority recs */
1406 packet.authority = NULL;
1407 packet.arcount = 0; /* additional recs */
1408 packet.additional = NULL;
1432 packet.info |= NAME_NM_FLAGS_TC;
1457 packet.info |= NAME_NM_FLAGS_TC;
1464 packet.info |= NAME_NM_FLAGS_TC;
1470 packet.info |= NAME_NM_FLAGS_TC;
1476 packet.info |= NAME_NM_FLAGS_TC;
1482 packet.info |= NAME_NM_FLAGS_TC;
1488 packet.info |= NAME_NM_FLAGS_TC;
1494 packet.info |= NAME_NM_FLAGS_TC;
1500 packet.info |= NAME_NM_FLAGS_TC;
1506 packet.info |= NAME_NM_FLAGS_TC;
1512 packet.info |= NAME_NM_FLAGS_TC;
1521 return (smb_send_name_service_packet(addr, &packet));
1537 /* build name service packet */
1591 /* build packet */
1632 /* build packet */
1672 /* build packet */
1728 /* build packet */
1832 smb_name_process_Bnode_packet(struct name_packet *packet, addr_entry_t *addr)
1839 question = packet->question;
1840 additional = packet->additional;
1842 switch (packet->info & NAME_OPCODE_OPCODE_MASK) {
1879 packet, entry, 0);
1898 * field in the request packet
1901 packet);
1912 smb_name_process_Pnode_packet(struct name_packet *packet, addr_entry_t *addr)
1919 question = packet->question;
1920 additional = packet->additional;
1922 if (packet->info & NAME_NM_FLAGS_B) {
1929 switch (packet->info & NAME_OPCODE_OPCODE_MASK) {
1950 (void) smb_send_name_registration_response(addr, packet, 0);
1972 packet, entry, 0);
1979 packet, name, RCODE_NAM_ERR);
1995 * field in the request packet
2000 packet);
2011 smb_name_process_Mnode_packet(struct name_packet *packet, addr_entry_t *addr)
2013 if (packet->info & NAME_NM_FLAGS_B)
2014 smb_name_process_Bnode_packet(packet, addr);
2016 smb_name_process_Pnode_packet(packet, addr);
2020 smb_name_process_Hnode_packet(struct name_packet *packet, addr_entry_t *addr)
2022 if (packet->info & NAME_NM_FLAGS_B)
2023 smb_name_process_Bnode_packet(packet, addr);
2025 smb_name_process_Pnode_packet(packet, addr);
2187 struct name_packet *packet;
2189 if ((packet = smb_name_buf_to_packet(p->buf, p->length)) != NULL) {
2190 if (packet->info & NAME_OPCODE_R) {
2191 /* Reply packet */
2192 smb_reply_ready(packet, addr);
2198 /* Request packet */
2201 smb_name_process_Bnode_packet(packet, addr);
2204 smb_name_process_Pnode_packet(packet, addr);
2207 smb_name_process_Mnode_packet(packet, addr);
2211 smb_name_process_Hnode_packet(packet, addr);
2215 if (packet->answer)
2216 smb_netbios_name_freeaddrs(packet->answer->name);
2217 free(packet);
2219 syslog(LOG_ERR, "nbns: packet decode failed");
2462 * Launch a netbios worker to process the received packet.