44 #include "net/rime/meshconn.h"
49 static struct meshconn_conn meshconn;
50 static struct process *front_process;
52 static int initiator = 0;
55 PROCESS(shell_rsh_process,
"rsh");
58 "rsh <node>: remote login to another node",
60 PROCESS(shell_rsh_server_process,
"rsh server");
68 static linkaddr_t receiver;
76 if(nextptr == data || *nextptr !=
'.') {
78 "rsh <node>: node address must be specified",
"");
84 sprintf(buf,
"%d.%d", receiver.u8[0], receiver.u8[1]);
88 meshconn_connect(&meshconn, &receiver);
94 if(input->len1 + input->len2 == 0) {
95 meshconn_close_connection(&meshconn);
104 input->data2, input->len2);
106 meshconn_send(&meshconn);
122 (ev == PROCESS_EVENT_EXITED &&
123 data == front_process));
124 if(ev == PROCESS_EVENT_EXITED) {
125 front_process =
NULL;
131 input->data2, input->len2);
135 meshconn_send(&meshconn);
143 connected_meshconn(
struct meshconn_conn *c)
148 recv_meshconn(
struct meshconn_conn *c)
162 if(front_process !=
NULL &&
173 &rsh_server_command, &started_process);
175 if(started_process !=
NULL &&
176 ret == SHELL_FOREGROUND &&
178 front_process = started_process;
186 closed_meshconn(
struct meshconn_conn *c)
191 timedout_meshconn(
struct meshconn_conn *c)
196 reset_meshconn(
struct meshconn_conn *c)
201 static struct meshconn_callbacks meshconn_callbacks = { connected_meshconn,
210 meshconn_open(&meshconn, 23, &meshconn_callbacks);
int process_is_running(struct process *p)
Check if a process is running.
int packetbuf_copyfrom(const void *from, uint16_t len)
Copy from external data into the packetbuf.
void shell_output_str(struct shell_command *c, char *text1, const char *text2)
Output strings from a shell command.
int shell_start_command(char *commandline, int commandline_len, struct shell_command *child, struct process **started_process)
Start a shell command from another shell command.
#define PROCESS_EXIT()
Exit the currently running process.
#define PROCESS_BEGIN()
Define the beginning of a process.
void process_post_synch(struct process *p, process_event_t ev, process_data_t data)
Post a synchronous event to a process.
Main header file for the Contiki shell
#define NULL
The null pointer.
void packetbuf_set_datalen(uint16_t len)
Set the length of the data in the packetbuf.
Header file for the Rime stack
uint16_t packetbuf_datalen(void)
Get the length of the data in the packetbuf.
#define PROCESS_THREAD(name, ev, data)
Define the body of a process.
#define PROCESS_END()
Define the end of a process.
unsigned long shell_strtolong(const char *str, const char **retstr)
Convert a string to a number.
Structure for shell input data.
void shell_register_command(struct shell_command *c)
Register a command with the shell.
#define PROCESS_WAIT_EVENT_UNTIL(c)
Wait for an event to be posted to the process, with an extra condition.
#define PROCESS_WAIT_EVENT()
Wait for an event to be posted to the process.
#define PROCESS(name, strname)
Declare a process.
int shell_event_input
The event number for shell input data.
void packetbuf_clear(void)
Clear and reset the packetbuf.
void process_start(struct process *p, process_data_t data)
Start a process.
#define PACKETBUF_SIZE
The size of the packetbuf, in bytes.
void * packetbuf_dataptr(void)
Get a pointer to the data in the packetbuf.
#define SHELL_COMMAND(name, command, description, process)
Define a shell command.