Re: Parsing a Section of Binary String Data!




dotnetdotcn@xxxxxxx wrote:
zoltan wrote:
Hi,
The scenario is like this :


struct ns_rr {

const u_char* rdata;
};

The rdata field contains some fields such as :

char * flags;
char * services;
char * regexp;
char * replacement;

I want to parse the rdata section and obtain the individual string
fields as shown above. Can anyone suggest an efficient method? Are
these strings terminiated by '\0' within the rdata section?


Thanks and Regards,

Timmy Jose.
look at this:
struct ns_rr * a;
puts(a->rdata->flags);

The problem is this :

ns_rr is the Standard type which is used to store the data.

I know that the various fields ( flag, services etc) are in the rdata
member. So to extract them, I define my own structure like this :

struct NAPTR
{

char * flags;
char * services;
char * regexp;
char * replacement;
};

So the compiler has no idea that there is a field called "flags" inside
the rdata member!!! That is the trouble... Any ideas?

.



Relevant Pages