view types.h @ 3:215c0c3b3609

misc: use JSON everywhere (scictl/sciwebd)
author David Demelier <markand@malikania.fr>
date Mon, 14 Jun 2021 22:08:24 +0200
parents
children 3051ef92173a
line wrap: on
line source

#ifndef SCI_TYPES_H
#define SCI_TYPES_H

#include <sys/types.h>
#include <stddef.h>

#include <jansson.h>

struct job {
	int id;
	int project_id;
	const char *tag;
};

struct jobresult {
	int id;
	int job_id;
	int worker_id;
	int exitcode;
	const char *log;
};

struct worker {
	int id;
	const char *name;
	const char *desc;
};

struct project {
	int id;
	const char *name;
	const char *desc;
	const char *url;
	const char *script;
};

json_t *
job_to(const struct job *, size_t);

ssize_t
job_from(struct job *, size_t, json_t *);

json_t *
jobresult_to(const struct jobresult *, size_t);

ssize_t
jobresult_from(struct jobresult *, size_t, json_t *);

json_t *
worker_to(const struct worker *, size_t);

ssize_t
worker_from(struct worker *, size_t, json_t *);

json_t *
project_to(const struct project *, size_t);

ssize_t
project_from(struct project *, size_t, json_t *);

#endif /* !SCI_TYPES_H */