char *nmb_namestr(const struct nmb_name *n);
struct packet_struct *copy_packet(struct packet_struct *packet);
void free_packet(struct packet_struct *packet);
+int packet_trn_id(struct packet_struct *p);
struct packet_struct *parse_packet(char *buf,int length,
enum packet_type packet_type,
struct in_addr ip,
SAFE_FREE(packet);
}
+int packet_trn_id(struct packet_struct *p)
+{
+ int result;
+ switch (p->packet_type) {
+ case NMB_PACKET:
+ result = p->packet.nmb.header.name_trn_id;
+ break;
+ case DGRAM_PACKET:
+ result = p->packet.dgram.header.dgm_id;
+ break;
+ default:
+ result = -1;
+ }
+ return result;
+}
+
/*******************************************************************
Parse a packet buffer into a packet structure.
******************************************************************/