view types.h @ 7:a7e36b32e20a

make: tests need jansson
author David Demelier <markand@malikania.fr>
date Wed, 23 Jun 2021 11:45:00 +0200
parents 215c0c3b3609
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 */