forked from chargebyte/ser2net
-
Notifications
You must be signed in to change notification settings - Fork 0
/
devio.h
68 lines (61 loc) · 2.69 KB
/
devio.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
* ser2net - A program for allowing telnet connection to serial ports
* Copyright (C) 2001 Corey Minyard <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef SER2NET_IO_H
#define SER2NET_IO_H
struct absout;
struct devio_f;
struct devio {
char *devname;
int read_disabled; /* A printer port */
void *my_data;
struct devio_f *f;
void *user_data;
void (*read_handler)(struct devio *io);
void (*write_handler)(struct devio *io);
void (*except_handler)(struct devio *io);
void (*modem_state_handler)(struct devio *io, int modem_state);
};
struct devio_f {
int (*setup)(struct devio *io, const char *name, const char **errstr);
void (*shutdown)(struct devio *io);
int (*reconfig)(struct devio *io, struct absout *eout, const char *instr,
int (*otherconfig)(void *data, struct absout *eout,
const char *item),
void *data);
int (*read)(struct devio *io, void *buf, size_t size);
int (*write)(struct devio *io, void *buf, size_t size);
void (*read_handler_enable)(struct devio *io, int enabled);
void (*write_handler_enable)(struct devio *io, int enabled);
void (*except_handler_enable)(struct devio *io, int enabled);
int (*send_break)(struct devio *io);
int (*get_modem_state)(struct devio *io, unsigned char *val);
int (*set_devcontrol)(struct devio *io, const char *controls);
void (*show_devcontrol)(struct devio *io, struct absout *out);
void (*show_devcfg)(struct devio *io, struct absout *out);
int (*baud_rate)(struct devio *io, int *val, int cisco);
int (*data_size)(struct devio *io, unsigned char *val);
int (*parity)(struct devio *io, unsigned char *val);
int (*stop_size)(struct devio *io, unsigned char *val);
int (*control)(struct devio *io, unsigned char *val);
int (*flow_control)(struct devio *io, unsigned char val);
int (*flush)(struct devio *io, int *val);
void (*serparm_to_str)(struct devio *io, char *str, int strlen);
void (*free)(struct devio *io);
};
#endif /* SER2NET_IO_H */