packet-parsing #1

Open
pentapiper wants to merge 5 commits from packet-parsing into main
2 changed files with 0 additions and 38 deletions
Showing only changes of commit 201e15348e - Show all commits

View file

@ -11,6 +11,4 @@ struct DNSPacketBuffer {
struct DNSPacketBuffer *new_dns_packet_buffer();

I think both of the structs in this file should be typedef'ed so that you dont need to write 'struct' everywhere.

I think both of the structs in this file should be typedef'ed so that you dont need to write 'struct' everywhere.
struct DNSPacketHeader *dns_header(struct DNSPacketBuffer);
unsigned char pb_read_byte(struct DNSPacketBuffer *);

View file

@ -8,39 +8,3 @@ struct DNSPacketBuffer *new_dns_packet_buffer()
buf = malloc(sizeof(struct DNSPacketBuffer));
return buf;
}
struct DNSPacketHeader *dns_header(struct DNSPacketBuffer)
{
}
// read a single byte and move the cursor one byte forward
unsigned char pb_read_byte(struct DNSPacketBuffer *pb)
{
unsigned char b = pb->buf[pb->pos];
pb->pos++;
if (pb->pos >= PB_SIZE) {
printf(
"WARN: pb_read_byte: advanced packetbuffer cursor pos to %lu, which is greater than the max %d",
pb->pos,
PB_SIZE
);
}
return b;
}
unsigned char pb_get_byte(struct DNSPacketBuffer *pb)
{
if (pb->pos >= PB_SIZE) {
printf(
"WARN: pb_get_byte: accessing packetbuffer cursor pos %lu, which is greater than the max %d",
pb->pos,
PB_SIZE
);
}
return pb->buf[pb->pos];
}