Blame include/ntux/ntux.h

26e14f
#ifndef NTUX_H
26e14f
#define NTUX_H
26e14f
26e14f
#include <stdint.h>
26e14f
26e14f
#include "ntux_api.h"
26e14f
26e14f
#ifdef __cplusplus
26e14f
extern "C" {
26e14f
#endif
26e14f
26e14f
/* pre-alpha */
26e14f
#ifndef NTUX_APP
26e14f
#ifndef NTUX_PRE_ALPHA
26e14f
#error  libntux: pre-alpha: ABI is not final!
26e14f
#error  to use the library, please pass -DNTUX_PRE_ALPHA to the compiler.
26e14f
#endif
26e14f
#endif
26e14f
26e14f
/* status codes */
26e14f
#define NTUX_OK				0x00
26e14f
#define NTUX_USAGE			0x01
26e14f
#define NTUX_ERROR			0x02
26e14f
26e14f
/* driver flags */
26e14f
#define NTUX_DRIVER_VERBOSITY_NONE	0x0000
26e14f
#define NTUX_DRIVER_VERBOSITY_ERRORS	0x0001
26e14f
#define NTUX_DRIVER_VERBOSITY_STATUS	0x0002
26e14f
#define NTUX_DRIVER_VERBOSITY_USAGE	0x0004
26e14f
#define NTUX_DRIVER_CLONE_VECTOR	0x0008
26e14f
26e14f
#define NTUX_DRIVER_VERSION		0x0010
26e14f
#define NTUX_DRIVER_DRY_RUN		0x0020
26e14f
26e14f
struct ntux_source_version {
26e14f
	int		major;
26e14f
	int		minor;
26e14f
	int		revision;
26e14f
	const char *	commit;
26e14f
};
26e14f
26e14f
struct ntux_error_info {
26e14f
	const struct ntux_driver_ctx *	edctx;
26e14f
	const struct ntux_unit_ctx *	euctx;
26e14f
	const char *			eunit;
26e14f
	int				esyscode;
26e14f
	int				elibcode;
26e14f
	const char *			efunction;
26e14f
	int				eline;
26e14f
	unsigned			eflags;
26e14f
	void *				eany;
26e14f
};
26e14f
26e14f
struct ntux_common_ctx {
26e14f
	uint64_t			drvflags;
26e14f
	uint64_t			actflags;
26e14f
	uint64_t			fmtflags;
26e14f
};
26e14f
26e14f
struct ntux_driver_ctx {
26e14f
	const char **			units;
26e14f
	const char *			program;
26e14f
	const char *			module;
26e14f
	const struct ntux_common_ctx *	cctx;
26e14f
	struct ntux_error_info **	errv;
26e14f
	void *				any;
26e14f
};
26e14f
26e14f
/* package info */
26e14f
ntux_api				const struct ntux_source_version * ntux_source_version(void);
26e14f
26e14f
/* driver api */
26e14f
ntux_api int  ntux_get_driver_ctx	(char ** argv, char ** envp, uint32_t flags, struct ntux_driver_ctx **);
26e14f
ntux_api int  ntux_create_driver_ctx	(const struct ntux_common_ctx *, struct ntux_driver_ctx **);
26e14f
ntux_api void ntux_free_driver_ctx	(struct ntux_driver_ctx *);
26e14f
26e14f
/* utility api */
26e14f
ntux_api int  ntux_main			(int, char **, char **);
26e14f
26e14f
#ifdef __cplusplus
26e14f
}
26e14f
#endif
26e14f
26e14f
#endif