tcpdump mailing list archives
Re: supporting extend 'open live capture' parametes
From: Guy Harris <guy () alum mit edu>
Date: Thu, 10 Jan 2008 12:29:37 -0800
Andy Howell wrote:
How about having a generic list of options? Something like: typedef enum { END_OF_OPTS, PARAM_1, PARAM_2, } pcap_opts; typedef union { void *p; unsigned int u; } pcap_opt_value;
That assumes that an option will either be an "unsigned int" or a pointer. I'd be inclined to have something more like typedef struct { bpf_u_int32 option; bpf_u_int32 optlen; } pcap_opthdr;with the buffer being a sequence of pcap_opthdr structures followed by option values. "option" is the code for the option type (with 0 being the "end of option list" option), and "optlen" is the length of the option value (so an application can skip options it doesn't understand).
"pcap_opthdr" is 64 bits long, so as long as the option buffer is aligned on a {32-bit,64-bit} boundary, the options will be aligned on that boundary as well (and if the option buffer is mallocated, it'll be aligned on the strictest boundary required for C data types).
I'd also have pcap_open_live_ex() take a "pcap_opthdr *" as an argument (for one thing, that means no whining from the compiler that we're casting a "char *" to a type requiring stricter alignment).
We would probably want a functions that returns the valid options for a device.
That's his "pcap_get_capabilities()" function. - This is the tcpdump-workers list. Visit https://cod.sandelman.ca/ to unsubscribe.
Current thread:
- setting the initial ring size Abeni Paolo (Jan 07)
- Re: setting the initial ring size Andy Howell (Jan 07)
- Re: setting the initial ring size Guy Harris (Jan 09)
- Re: setting the initial ring size Abeni Paolo (Jan 10)
- Re: setting the initial ring size Guy Harris (Jan 10)
- Re: supporting extend 'open live capture' parametes [was: setting the initial ring size] Abeni Paolo (Jan 10)
- Re: supporting extend 'open live capture' parametes Guy Harris (Jan 10)
- Re: supporting extend 'open live capture' parametes Andy Howell (Jan 10)
- Re: supporting extend 'open live capture' parametes Guy Harris (Jan 10)
- Re: supporting extend 'open live capture' parametes Andy Howell (Jan 11)
- Re: supporting extend 'open live capture' parametes Michael Richardson (Jan 13)
- Re: supporting extend 'open live capture' parametes Guy Harris (Jan 13)
- Re: supporting extend 'open live capture' parametes Michael Richardson (Jan 13)
- Re: supporting extend 'open live capture' parametes Guy Harris (Jan 15)
- Re: setting the initial ring size Guy Harris (Jan 09)
- Re: setting the initial ring size Andy Howell (Jan 07)