Define basic data structures

This commit is contained in:
Alex Kotov 2020-12-13 14:15:45 +05:00
parent d8ba048c35
commit f8ec4af541
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
3 changed files with 41 additions and 0 deletions

View File

@ -1,2 +1,3 @@
nobase_include_HEADERS = \
shmemq.h \
shmemq/dummy.h

39
include/shmemq.h Normal file
View File

@ -0,0 +1,39 @@
#ifndef SHMEMQ_INCLUDED
#define SHMEMQ_INCLUDED 1
#include <stddef.h>
#define SHMEMQ_FRAME_SIZE ((size_t)8)
#define SHMEMQ_FRAME_DATA_SIZE \
(SHMEMQ_FRAME_SIZE - sizeof(struct Shmemq_FrameHeader))
#ifdef __cplusplus
extern "C" {
#endif
struct Shmemq_FrameHeader {
size_t frame_size;
};
struct Shmemq_Frame {
struct Shmemq_FrameHeader header;
unsigned char data[SHMEMQ_FRAME_DATA_SIZE];
};
struct Shmemq_QueueHeader {
size_t frames_count;
size_t read_frame_index;
size_t write_frame_index;
};
struct Shmemq_Queue {
struct Shmemq_QueueHeader header;
struct Shmemq_Frame frames[];
};
#ifdef __cplusplus
}
#endif
#endif

View File

@ -2,6 +2,7 @@
#include "config.h"
#endif
#include <shmemq.h>
#include <shmemq/dummy.h>
int main()