Blame include/ptycon/ptycon.h

0efa8c
#ifndef PTYCON_H
0efa8c
#define PTYCON_H
0efa8c
0efa8c
#include <stdint.h>
0efa8c
0efa8c
#include "ptycon_api.h"
0efa8c
0efa8c
#ifdef __cplusplus
0efa8c
extern "C" {
0efa8c
#endif
0efa8c
0efa8c
/* pre-alpha */
0efa8c
#ifndef PTYC_APP
0efa8c
#ifndef PTYC_PRE_ALPHA
0efa8c
#error  libptycon: pre-alpha: ABI is not final!
0efa8c
#error  to use the library, please pass -DPTYC_PRE_ALPHA to the compiler.
0efa8c
#endif
0efa8c
#endif
0efa8c
0efa8c
/* status codes */
0efa8c
#define PTYC_OK				0x00
0efa8c
#define PTYC_USAGE			0x01
0efa8c
#define PTYC_BAD_OPT			0x02
0efa8c
#define PTYC_BAD_OPT_VAL		0x03
0efa8c
#define PTYC_IO_ERROR			0xA0
0efa8c
#define PTYC_MAP_ERROR			0xA1
0efa8c
0efa8c
/* driver flags */
0efa8c
#define PTYC_DRIVER_VERBOSITY_NONE	0x0000
0efa8c
#define PTYC_DRIVER_VERBOSITY_ERRORS	0x0001
0efa8c
#define PTYC_DRIVER_VERBOSITY_STATUS	0x0002
0efa8c
#define PTYC_DRIVER_VERBOSITY_USAGE	0x0004
0efa8c
#define PTYC_DRIVER_CLONE_VECTOR	0x0008
0efa8c
0efa8c
#define PTYC_DRIVER_VERSION		0x0010
0efa8c
#define PTYC_DRIVER_DRY_RUN		0x0020
64c887
#define PTYC_DRIVER_DBG_EVENT		0x0040
64c887
#define PTYC_DRIVER_DBG_OVEN		0x0080
64c887
#define PTYC_DRIVER_DBG_RAW		0x0100
0efa8c
0efa8c
struct ptyc_source_version {
0efa8c
	int		major;
0efa8c
	int		minor;
0efa8c
	int		revision;
0efa8c
	const char *	commit;
0efa8c
};
0efa8c
0efa8c
struct ptyc_common_ctx {
0efa8c
	uint64_t			drvflags;
0efa8c
	uint64_t			actflags;
0efa8c
	uint64_t			fmtflags;
538c8a
	nt_pty *			hpts;
538c8a
	nt_pty *			hptm;
0efa8c
};
0efa8c
0efa8c
struct ptyc_driver_ctx {
0efa8c
	const char **			units;
0efa8c
	const char *			program;
0efa8c
	const char *			module;
0efa8c
	const struct ptyc_common_ctx *	cctx;
0efa8c
	void *				any;
0efa8c
	int				status;
0efa8c
	int				nerrors;
0efa8c
};
0efa8c
0efa8c
/* package info */
0efa8c
ptyc_api				const struct ptyc_source_version * ptyc_source_version(void);
0efa8c
0efa8c
/* driver api */
0efa8c
ptyc_api int  ptyc_get_driver_ctx	(char ** argv, char ** envp, uint32_t flags, struct ptyc_driver_ctx **);
0efa8c
ptyc_api int  ptyc_create_driver_ctx	(const struct ptyc_common_ctx *, struct ptyc_driver_ctx **);
0efa8c
ptyc_api void ptyc_free_driver_ctx	(struct ptyc_driver_ctx *);
0efa8c
538c8a
/* pty api */
538c8a
ptyc_api int  ptyc_alloc_pty		(struct ptyc_driver_ctx *);
538c8a
ptyc_api void ptyc_free_pty		(struct ptyc_driver_ctx *);
538c8a
0efa8c
/* utility api */
0efa8c
ptyc_api int  ptyc_main			(int, char **, char **);
0efa8c
0efa8c
#ifdef __cplusplus
0efa8c
}
0efa8c
#endif
0efa8c
0efa8c
#endif