|
|
0efa8c |
#ifndef PTYCON_H
|
|
|
0efa8c |
#define PTYCON_H
|
|
|
0efa8c |
|
|
|
9a1750 |
#include <ntapi/ntapi.h>
|
|
|
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 |
|
|
|
a389fb |
/* daemon */
|
|
|
a389fb |
#define PTYC_PORT_GUID_DAEMON {0x38a31275, \
|
|
|
a389fb |
0x8c52, \
|
|
|
a389fb |
0x4285, \
|
|
|
a389fb |
{0xaa,0x34,0x70,0xe0,0x6c,0x30,0x6d,0xe5}}
|
|
|
a389fb |
|
|
|
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
|
|
|
fd0f9b |
#define PTYC_DRIVER_BELL 0x0020
|
|
|
324584 |
#define PTYC_DRIVER_DBG_EVENT 0x0100
|
|
|
324584 |
#define PTYC_DRIVER_DBG_OVEN 0x0200
|
|
|
324584 |
#define PTYC_DRIVER_DBG_RAW 0x0400
|
|
|
324584 |
#define PTYC_DRIVER_DBG_WAIT 0x0800
|
|
|
f67c20 |
#define PTYC_DRIVER_DAEMON_ALWAYS 0x1000
|
|
|
f67c20 |
#define PTYC_DRIVER_DAEMON_NEVER 0x2000
|
|
|
0efa8c |
|
|
|
690c8c |
#define PTYC_DRIVER_DBG_MODE (PTYC_DRIVER_DBG_EVENT \
|
|
|
690c8c |
| PTYC_DRIVER_DBG_OVEN \
|
|
|
690c8c |
| PTYC_DRIVER_DBG_RAW)
|
|
|
690c8c |
|
|
|
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;
|
|
|
d881b6 |
void * hroot;
|
|
|
d881b6 |
const char * sysroot;
|
|
|
2de078 |
char ** catv;
|
|
|
cc22da |
char ** eargv;
|
|
|
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 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 *);
|
|
|
9cd8e5 |
ptyc_api int ptyc_spawn (struct ptyc_driver_ctx *);
|
|
|
538c8a |
|
|
|
1bab02 |
/* console api */
|
|
|
1bab02 |
ptyc_api int ptyc_alloc_console (struct ptyc_driver_ctx *);
|
|
|
1bab02 |
ptyc_api int ptyc_wait_for_console (struct ptyc_driver_ctx *);
|
|
|
1bab02 |
ptyc_api void ptyc_free_console (struct ptyc_driver_ctx *);
|
|
|
1bab02 |
|
|
|
0efa8c |
/* utility api */
|
|
|
0efa8c |
ptyc_api int ptyc_main (int, char **, char **);
|
|
|
0efa8c |
|
|
|
0efa8c |
#ifdef __cplusplus
|
|
|
0efa8c |
}
|
|
|
0efa8c |
#endif
|
|
|
0efa8c |
|
|
|
0efa8c |
#endif
|