| 1 |
/* |
|---|
| 2 |
* Copyright (c) 2007, OmniTI Computer Consulting, Inc. |
|---|
| 3 |
* All rights reserved. |
|---|
| 4 |
*/ |
|---|
| 5 |
|
|---|
| 6 |
#ifndef _NOIT_CONSOLE_H |
|---|
| 7 |
#define _NOIT_CONSOLE_H |
|---|
| 8 |
|
|---|
| 9 |
#include "noit_defines.h" |
|---|
| 10 |
#include "eventer/eventer.h" |
|---|
| 11 |
#include "noitedit/histedit.h" |
|---|
| 12 |
#include "noit_console_telnet.h" |
|---|
| 13 |
|
|---|
| 14 |
typedef struct __noit_console_closure { |
|---|
| 15 |
eventer_t e; /* The event it is attached to. This |
|---|
| 16 |
* is needed so it can write itself out */ |
|---|
| 17 |
int wants_shutdown; /* Set this to 1 to have it die */ |
|---|
| 18 |
|
|---|
| 19 |
/* nice console support */ |
|---|
| 20 |
EditLine *el; |
|---|
| 21 |
History *hist; |
|---|
| 22 |
|
|---|
| 23 |
int pty_master; |
|---|
| 24 |
int pty_slave; |
|---|
| 25 |
|
|---|
| 26 |
/* Output buffer for non-blocking sends */ |
|---|
| 27 |
char *outbuf; |
|---|
| 28 |
int outbuf_allocd; |
|---|
| 29 |
int outbuf_len; |
|---|
| 30 |
int outbuf_completed; |
|---|
| 31 |
|
|---|
| 32 |
/* This tracks telnet protocol state (if we're doing telnet) */ |
|---|
| 33 |
noit_console_telnet_closure_t telnet; |
|---|
| 34 |
|
|---|
| 35 |
} * noit_console_closure_t;; |
|---|
| 36 |
|
|---|
| 37 |
API_EXPORT(void) noit_console_init(); |
|---|
| 38 |
|
|---|
| 39 |
API_EXPORT(int) |
|---|
| 40 |
noit_console_handler(eventer_t e, int mask, void *closure, |
|---|
| 41 |
struct timeval *now); |
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 |
API_EXPORT(int) |
|---|
| 45 |
nc_printf(noit_console_closure_t ncct, const char *fmt, ...); |
|---|
| 46 |
|
|---|
| 47 |
API_EXPORT(int) |
|---|
| 48 |
nc_vprintf(noit_console_closure_t ncct, const char *fmt, va_list arg); |
|---|
| 49 |
|
|---|
| 50 |
API_EXPORT(int) |
|---|
| 51 |
nc_write(noit_console_closure_t ncct, void *buf, int len); |
|---|
| 52 |
|
|---|
| 53 |
API_EXPORT(int) |
|---|
| 54 |
noit_console_continue_sending(noit_console_closure_t ncct, |
|---|
| 55 |
int *mask); |
|---|
| 56 |
#endif |
|---|