[Winpcap-users] pcap_next_ex() Error (Visual Studio 6)

Guy Harris guy at alum.mit.edu
Thu Jul 28 20:28:50 GMT 2005


On Jul 28, 2005, at 7:06 AM, Isara Anantavrasilp wrote:

> Yeah, I just got the same problem, so I changed the declaration:  
> "u_char *pkt_data;" to "const u_char *pkt_data;"
>
> It works just fine. However, I dont know if it is the correct way.

Given that the "const" in the declaration of "pcap_next_ex()" is an  
indication that there's no guarantee that you'll be allowed to write  
to the packet data or that Bad Things won't happen if you write to it  
- i.e., it's an indication that you shouldn't write to it (if you  
want to modify the packet data, copy it and modify the copy) -  
declaring the pointer to the packet data as a pointer to "const  
u_char" is the right thing to do.


More information about the Winpcap-users mailing list