s3: Add packet_trn_id()
authorVolker Lendecke <vl@samba.org>
Tue, 4 Jan 2011 17:07:12 +0000 (18:07 +0100)
committerVolker Lendecke <vl@samba.org>
Fri, 7 Jan 2011 12:28:04 +0000 (13:28 +0100)
source3/include/proto.h
source3/libsmb/nmblib.c

index 6f18ee08e6fd28d774ed29f84c60b35ead3ffdfd..418a0d104c50a1cef0e44373056e8f7becf901fa 100644 (file)
@@ -2772,6 +2772,7 @@ void put_name(char *dest, const char *name, int pad, unsigned int name_type);
 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,
index e10bd7aa7bc10625466872d8c829eb61e33afa69..fd011ebf27945338e592140c1d39ab14527b15b1 100644 (file)
@@ -726,6 +726,22 @@ void free_packet(struct packet_struct *packet)
        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.
 ******************************************************************/