initial commit
This commit is contained in:
commit
8c8158ad5b
7 changed files with 724 additions and 0 deletions
73
prezzyipc.h
Normal file
73
prezzyipc.h
Normal file
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
* prezzyipc.h
|
||||
* Copyright (c) 2024 Jeremy Baxter.
|
||||
*/
|
||||
|
||||
#ifndef _PREZZYIPC_H_
|
||||
#define _PREZZYIPC_H_
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define PREZZY_PACKET_MAX 1024
|
||||
#define PREZZY_SOCK "/tmp/prezzyd.sock"
|
||||
|
||||
typedef char byte;
|
||||
|
||||
typedef enum {
|
||||
PREZZY_STATE = 1,
|
||||
PREZZY_DETAILS = 2,
|
||||
PREZZY_LARGE_IMAGE = 3,
|
||||
PREZZY_LARGE_TOOLTIP = 4,
|
||||
PREZZY_ICON = 5,
|
||||
PREZZY_ICON_TOOLTIP = 6,
|
||||
PREZZY_PARTY_SIZE = 7,
|
||||
PREZZY_PARTY_LIMIT = 8,
|
||||
PREZZY_TIMESTAMP_START = 9,
|
||||
PREZZY_TIMESTAMP_END = 10,
|
||||
PREZZY_PROPERTY_MAX = 11
|
||||
} PrezzyProperty;
|
||||
|
||||
typedef enum {
|
||||
PLT_STRING = 1,
|
||||
PLT_INT64 = 2,
|
||||
PLT_INT = 3,
|
||||
PLT_MAX = 4
|
||||
} PrezzyPayloadType;
|
||||
|
||||
#ifdef _PREZZYIPC_C_
|
||||
PrezzyPayloadType payloadTypeMapping[PREZZY_PROPERTY_MAX] = {
|
||||
[PREZZY_STATE] = PLT_STRING,
|
||||
[PREZZY_DETAILS] = PLT_STRING,
|
||||
[PREZZY_LARGE_IMAGE] = PLT_STRING,
|
||||
[PREZZY_LARGE_TOOLTIP] = PLT_STRING,
|
||||
[PREZZY_ICON] = PLT_STRING,
|
||||
[PREZZY_ICON_TOOLTIP] = PLT_STRING,
|
||||
[PREZZY_PARTY_SIZE] = PLT_INT,
|
||||
[PREZZY_PARTY_LIMIT] = PLT_INT,
|
||||
[PREZZY_TIMESTAMP_START] = PLT_INT64,
|
||||
[PREZZY_TIMESTAMP_END] = PLT_INT64
|
||||
};
|
||||
#else
|
||||
extern PrezzyPayloadType payloadTypeMapping[PREZZY_PROPERTY_MAX];
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
PrezzyProperty property;
|
||||
PrezzyPayloadType type;
|
||||
char *pString;
|
||||
int64_t pInteger;
|
||||
} PrezzyIpcPacket;
|
||||
|
||||
void dumpPacket(PrezzyIpcPacket);
|
||||
char *fromIpcPacket(PrezzyIpcPacket);
|
||||
PrezzyIpcPacket *makeIpcPacket(const char *);
|
||||
int squashLong(long);
|
||||
size_t strbcpy(char *, const char *, size_t);
|
||||
char *stringFrom(const char *);
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue