Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
LSH
lsh
Commits
0c014357
Commit
0c014357
authored
Jun 17, 1999
by
Niels Möller
Browse files
* src/io_commands.c (make_connect_connection): New function.
Rev: src/io_commands.c:1.10 Rev: src/io_commands.h:1.8
parent
6a61a1ae
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/io_commands.c
View file @
0c014357
...
...
@@ -148,11 +148,11 @@ struct command *make_listen_command(struct command *callback,
static
struct
lsh_object
*
collect_listen
(
struct
collect_info_2
*
info
,
struct
lsh_object
*
b
,
struct
lsh_object
*
c
)
struct
lsh_object
*
a
,
struct
lsh_object
*
b
)
{
CAST
_SUBTYPE
(
command
,
call
back
,
c
);
CAST
(
io_backend
,
back
end
,
b
);
CAST
(
io_backend
,
back
end
,
a
);
CAST
_SUBTYPE
(
command
,
call
back
,
b
);
assert
(
!
info
);
return
&
make_listen_command
(
callback
,
backend
)
->
super
;
...
...
@@ -164,6 +164,8 @@ STATIC_COLLECT_2_FINAL(collect_listen);
struct
collect_info_1
listen_command
=
STATIC_COLLECT_1
(
&
collect_info_listen_2
);
/* GABA:
(class
(name connect_command_callback)
...
...
@@ -223,10 +225,61 @@ static int do_connect(struct io_backend *backend,
return
LSH_OK
|
LSH_GOON
;
}
/* Simple connect function taking port only as argument. Also used for
* listen.
*
* (connect address) */
/* Connect variant, taking a connection object as argument (used for
* rememembering the connected fd). */
/* GABA:
(class
(name connect_connection)
(super command)
(vars
(backend object io_backend)
(target object address_info)))
*/
static
int
do_connect_connection
(
struct
command
*
s
,
struct
lsh_object
*
x
,
struct
command_continuation
*
c
)
{
CAST
(
connect_connection
,
self
,
s
);
CAST
(
ssh_connection
,
connection
,
x
);
return
do_connect
(
self
->
backend
,
self
->
target
,
connection
->
resources
,
c
);
}
struct
command
*
make_connect_connection
(
struct
io_backend
*
backend
,
struct
address_info
*
target
)
{
NEW
(
connect_connection
,
self
);
self
->
super
.
call
=
do_connect_connection
;
self
->
backend
=
backend
;
self
->
target
=
target
;
return
&
self
->
super
;
}
static
struct
lsh_object
*
collect_connect_connection
(
struct
collect_info_2
*
info
,
struct
lsh_object
*
a
,
struct
lsh_object
*
b
)
{
CAST
(
io_backend
,
backend
,
a
);
CAST
(
address_info
,
target
,
b
);
assert
(
!
info
);
assert
(
backend
);
assert
(
target
);
return
&
make_connect_connection
(
backend
,
target
)
->
super
;
}
static
struct
collect_info_2
collect_info_connect_2
=
STATIC_COLLECT_2_FINAL
(
collect_connect_connection
);
struct
collect_info_1
connect_with_connection
=
STATIC_COLLECT_1
(
&
collect_info_connect_2
);
/* GABA:
(class
...
...
@@ -237,6 +290,11 @@ static int do_connect(struct io_backend *backend,
(resources object resource_list)))
*/
/* Simple connect function taking port only as argument. Also used for
* listen.
*
* (connect address) */
static
int
do_simple_connect
(
struct
command
*
s
,
struct
lsh_object
*
a
,
struct
command_continuation
*
c
)
...
...
@@ -260,6 +318,7 @@ make_simple_connect(struct io_backend *backend,
return
&
self
->
super
;
}
static
int
do_simple_listen
(
struct
command
*
s
,
struct
lsh_object
*
a
,
struct
command_continuation
*
c
)
...
...
src/io_commands.h
View file @
0c014357
...
...
@@ -48,6 +48,11 @@ struct command *make_listen_command(struct command *callback,
extern
struct
collect_info_1
listen_command
;
#define LISTEN_COMMAND (&listen_command.super.super.super)
struct
command
*
make_connect_connection
(
struct
io_backend
*
backend
,
struct
address_info
*
target
);
extern
struct
collect_info_1
connect_with_connection
;
struct
command
*
make_simple_connect
(
struct
io_backend
*
backend
,
struct
resource_list
*
resources
);
struct
command
*
make_connect_command
(
struct
io_backend
*
backend
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment