From d801d4da2d9f6146b4dfe5e2a0be00e8d2d3ae1b Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 4 Jan 2011 18:07:12 +0100 Subject: s3: Add packet_trn_id() --- source3/include/proto.h | 1 + source3/libsmb/nmblib.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/source3/include/proto.h b/source3/include/proto.h index 6f18ee08e6..418a0d104c 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -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, diff --git a/source3/libsmb/nmblib.c b/source3/libsmb/nmblib.c index e10bd7aa7b..fd011ebf27 100644 --- a/source3/libsmb/nmblib.c +++ b/source3/libsmb/nmblib.c @@ -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. ******************************************************************/ -- cgit