Add basic packet buffer definition
This commit is contained in:
parent
0baae86beb
commit
fb762b2aef
3 changed files with 25 additions and 2 deletions
11
include/packet_buffer.h
Normal file
11
include/packet_buffer.h
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#pragma once
|
||||
#include <stddef.h>
|
||||
|
||||
#define PACKET_BUFFER_SIZE 512
|
||||
|
||||
struct PacketBuffer {
|
||||
char buf[PACKET_BUFFER_SIZE];
|
||||
size_t pos;
|
||||
};
|
||||
|
||||
struct PacketBuffer *new_packet_buffer();
|
||||
|
|
@ -1,8 +1,11 @@
|
|||
#include "pupdns.h"
|
||||
#include <stdio.h>
|
||||
#include "packet_buffer.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
printf("Hello, world!\n");
|
||||
struct PacketBuffer *buf = new_packet_buffer();
|
||||
|
||||
printf("size: %ld\n", sizeof(buf->buf));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
9
src/packet_buffer.c
Normal file
9
src/packet_buffer.c
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#include "packet_buffer.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
struct PacketBuffer *new_packet_buffer()
|
||||
{
|
||||
struct PacketBuffer *buf;
|
||||
buf = malloc(sizeof(struct PacketBuffer));
|
||||
return buf;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue