A
aki
i am receiving a buffer from network as char pointer.
char * buffer;
this is an argument of my function.
well i want to decode this buffer.
buffer contain a packet with different fields
as
code of size 1 byte contain inter value
identifier of size 1 byte contain integer value
and
length of size 2 byte. contain integer value.
as struct lcpHeader
{
uint8_t code;
uint8_t identifier;
uint16_t length;
};
i want to access it all fields.
1) code field
struct lcpHeader *hdr;
hdr=(struct lcpHeader*)buffer;
when i do switch(hdr->code)
will it give integer value contained in the code....?
how to access other fielsd?
i hope i have made clear what i wann do?
char * buffer;
this is an argument of my function.
well i want to decode this buffer.
buffer contain a packet with different fields
as
code of size 1 byte contain inter value
identifier of size 1 byte contain integer value
and
length of size 2 byte. contain integer value.
as struct lcpHeader
{
uint8_t code;
uint8_t identifier;
uint16_t length;
};
i want to access it all fields.
1) code field
struct lcpHeader *hdr;
hdr=(struct lcpHeader*)buffer;
when i do switch(hdr->code)
will it give integer value contained in the code....?
how to access other fielsd?
i hope i have made clear what i wann do?