io_commands.h 2.75 KB
Newer Older
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
/* io_commands.h
 *
 * $Id$
 */

/* lsh, an implementation of the ssh protocol
 *
 * Copyright (C) 1998 Niels Möller
 *
 * 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 LSH_IO_COMMANDS_H_INCLUDED
#define LSH_IO_COMMANDS_H_INCLUDED

Niels Möller's avatar
Niels Möller committed
28
#include "command.h"
29
#include "connection.h"
30
31
#include "io.h"

32
33
34
35
#define GABA_DECLARE
#include "io_commands.h.x"
#undef GABA_DECLARE

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
69
70
71
72
73
74
/* GABA:
   (class
     (name io_write_file_info)
     (vars
       (name . "const char *")
       (flags . int)
       (mode . int)
       (block_size . UINT32)))
*/

struct io_write_file_info *
make_io_write_file_info(const char *name, int flags, int mode, UINT32 block_size);

extern struct command_simple io_write_file_command;

#define IO_WRITE_FILE (&io_write_file_command.super.super)

/* Read a certain fd */

/* GABA:
   (class
     (name io_read_fd)
     (super command)
     (vars
       (fd . int)))
*/

void do_io_read_fd(struct command *s,
		   struct lsh_object *a,
		   struct command_continuation *c,
		   struct exception_handler *e);

#define STATIC_IO_READ_FD(fd) \
{ STATIC_COMMAND(do_io_read_fd), fd }

extern struct io_read_fd io_read_stdin;
#define IO_READ_STDIN (&io_read_stdin.super.super)


75
76
77
78
struct command *make_listen_command(struct command *callback,
				    struct io_backend *backend);

extern struct collect_info_1 listen_command;
79
#define LISTEN_COMMAND (&listen_command.super.super.super)
80

81
82
83
extern struct collect_info_1 connect_with_port;
#define CONNECT_COMMAND (&connect_with_port.super.super.super)

84
struct command *make_connect_port(struct io_backend *backend,
85
				  struct address_info *target);
86
struct command *make_connect_connection(struct io_backend *backend);
87
88
89

extern struct collect_info_1 connect_with_connection;

90
91
struct command *make_simple_connect(struct io_backend *backend,
				    struct resource_list *resources);
Niels Möller's avatar
Niels Möller committed
92
93
struct command *make_connect_command(struct io_backend *backend);

94
95
96
97
98
struct command *
make_simple_listen(struct io_backend *backend,
		   struct resource_list *resources);

extern struct command_simple io_log_peer_command;
99
#define LOG_PEER (&io_log_peer_command.super.super)
100

101
#endif /* LSH_IO_COMMANDS_H_INCLUDED */