Wireshark-dev: Re: [Wireshark-dev] Creation / Passing a new tvbuff

Date: Tue, 24 Feb 2009 21:46:14 +0000
I think tvb_memcpy is what i'm looking for. However, what exactly is "target"? and how would i use it? maybe an example?


---- wsgd <wsgd@xxxxxxx> wrote: 

=============
Into tvbuff.h,
 you have some possiblities
 to have access to the raw data (array of bytes) :

a) extern const guint8* tvb_get_ptr(tvbuff_t*, gint offset, gint length);
return the pointeur on an array of bytes

b) extern void* tvb_memcpy(tvbuff_t*, void* target, gint offset, gint 
length);
copy the array of bytes to target (already allocated)

c) extern void* tvb_memdup(tvbuff_t*, gint offset, gint length);
copy the array of bytes to an allocated memory (you must free it)



Olvier

gogrady@xxxxxxxxx a écrit :
> Don't know what a subdissector does, but ill explain more what im doing. Taking the raw data in my custom dissector, sending it to a dll that will act like a proxy. Sends the data to another lib which sends back a message object to the proxy. Then that object is send to a decoder lib which will allow me to pick out parts of the message that i want using the functions in the decoder lib.
>
> the first lib takes a buffer as parameter and i was wondering how i could pass the data from the dissector to the proxy to the lib. So if thats a subdissector...then yes. What does tvb_new_subset(...) do? I'm new to wireshark development.
>
> Thanks,
> Greg
>
>
> ---- wsgd <wsgd@xxxxxxx> wrote: 
>
> =============
> Like a subdissector ?
>
> Look at tcp_dissect_pdus (into packet-tcp.c) :
> next_tvb = tvb_new_subset(tvb, offset, length, plen);
>
>
> Olivier
>
> gogrady@xxxxxxxxx a écrit :
>   
>> Hello,
>>
>> I am trying to take the raw data of one packet in my dissector and pass it to a dll to be decoded. The way that i think would be best would be to create a tvbuff and pass it to the dll however, i'm unsure of how to create the new tvbuff with just the one packet of data. I read epan/tvbuff.h and tvbuff.c but i dont quite understand. Any help would be appreciated, or if you have a better idea of how to do this let me know.
>>
>> Thank you,
>> Greg
>>
>> ___________________________________________________________________________
>> Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
>> Archives:    http://www.wireshark.org/lists/wireshark-dev
>> Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
>>              mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe
>>
>>
>>   
>>     
>
>
>   


-- 
Wireshark Generic Dissector http://wsgd.free.fr