summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/ptycon/ptycon.h76
-rw-r--r--include/ptycon/ptycon_api.h35
2 files changed, 111 insertions, 0 deletions
diff --git a/include/ptycon/ptycon.h b/include/ptycon/ptycon.h
new file mode 100644
index 0000000..9d10ff9
--- /dev/null
+++ b/include/ptycon/ptycon.h
@@ -0,0 +1,76 @@
+#ifndef PTYCON_H
+#define PTYCON_H
+
+#include <stdint.h>
+
+#include "ptycon_api.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* pre-alpha */
+#ifndef PTYC_APP
+#ifndef PTYC_PRE_ALPHA
+#error libptycon: pre-alpha: ABI is not final!
+#error to use the library, please pass -DPTYC_PRE_ALPHA to the compiler.
+#endif
+#endif
+
+/* status codes */
+#define PTYC_OK 0x00
+#define PTYC_USAGE 0x01
+#define PTYC_BAD_OPT 0x02
+#define PTYC_BAD_OPT_VAL 0x03
+#define PTYC_IO_ERROR 0xA0
+#define PTYC_MAP_ERROR 0xA1
+
+/* driver flags */
+#define PTYC_DRIVER_VERBOSITY_NONE 0x0000
+#define PTYC_DRIVER_VERBOSITY_ERRORS 0x0001
+#define PTYC_DRIVER_VERBOSITY_STATUS 0x0002
+#define PTYC_DRIVER_VERBOSITY_USAGE 0x0004
+#define PTYC_DRIVER_CLONE_VECTOR 0x0008
+
+#define PTYC_DRIVER_VERSION 0x0010
+#define PTYC_DRIVER_DRY_RUN 0x0020
+
+struct ptyc_source_version {
+ int major;
+ int minor;
+ int revision;
+ const char * commit;
+};
+
+struct ptyc_common_ctx {
+ uint64_t drvflags;
+ uint64_t actflags;
+ uint64_t fmtflags;
+};
+
+struct ptyc_driver_ctx {
+ const char ** units;
+ const char * program;
+ const char * module;
+ const struct ptyc_common_ctx * cctx;
+ void * any;
+ int status;
+ int nerrors;
+};
+
+/* package info */
+ptyc_api const struct ptyc_source_version * ptyc_source_version(void);
+
+/* driver api */
+ptyc_api int ptyc_get_driver_ctx (char ** argv, char ** envp, uint32_t flags, struct ptyc_driver_ctx **);
+ptyc_api int ptyc_create_driver_ctx (const struct ptyc_common_ctx *, struct ptyc_driver_ctx **);
+ptyc_api void ptyc_free_driver_ctx (struct ptyc_driver_ctx *);
+
+/* utility api */
+ptyc_api int ptyc_main (int, char **, char **);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/ptycon/ptycon_api.h b/include/ptycon/ptycon_api.h
new file mode 100644
index 0000000..35ba2a4
--- /dev/null
+++ b/include/ptycon/ptycon_api.h
@@ -0,0 +1,35 @@
+#ifndef PTYCON_API_H
+#define PTYCON_API_H
+
+#include <limits.h>
+
+/* ptyc_export */
+#if defined(__dllexport)
+#define ptyc_export __dllexport
+#else
+#define ptyc_export
+#endif
+
+/* ptyc_import */
+#if defined(__dllimport)
+#define ptyc_import __dllimport
+#else
+#define ptyc_import
+#endif
+
+/* ptyc_api */
+#ifndef PTYC_APP
+#if defined (PTYC_BUILD)
+#define ptyc_api ptyc_export
+#elif defined (PTYC_SHARED)
+#define ptyc_api ptyc_import
+#elif defined (PTYC_STATIC)
+#define ptyc_api
+#else
+#define ptyc_api
+#endif
+#else
+#define ptyc_api
+#endif
+
+#endif