tcpdump mailing list archives

Re: Initializing a device


From: Akos Vandra <axos88 () gmail com>
Date: Thu, 12 Jan 2012 10:43:52 +0100

On 12 January 2012 10:38, Guy Harris <guy () alum mit edu> wrote:

On Jan 12, 2012, at 1:06 AM, Akos Vandra wrote:

We could put a limit - say 32 or 64 chars - to the max length of the
param, and then allocate in on the stack, but it would still require
printf.

Where would that be done?  It's a little more convenient than using routines such as asprintf() and g_sprintf(), 
because you don't have to free the result, but it's still extra work.

In the wrapper functions (setparam_xxx)
for ex something like this:

int setparam_uint64(pcap_t * pcap, char* param, uint64_t value)
{
  char[64] buf;
  sprintf(buf, "%lu", value);
  return pcap->setparam_op(param, buf);  //Add check for NULL op
}


In this form, as we are going to have a single interface function to
set and read the parameter,

Which form is that?

That we use only one function ptr to set and get parameter values,
which uses char* as parameters.

-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.
-
This is the tcpdump-workers list.
Visit https://cod.sandelman.ca/ to unsubscribe.


Current thread: