|
@@ -112,9 +112,8 @@ int woe_client_send(struct woe_client * client, const char *buffer, unsigned int
|
|
}
|
|
}
|
|
|
|
|
|
int woe_client_input(struct woe_client * cli, const char *buffer, size_t size) {
|
|
int woe_client_input(struct woe_client * cli, const char *buffer, size_t size) {
|
|
- unsigned int i;
|
|
|
|
mrb_state * mrb;
|
|
mrb_state * mrb;
|
|
- LOG_NOTE("Received input for client %d");
|
|
|
|
|
|
+ LOG_NOTE("Received input for client %d", cli->index);
|
|
mrb = woe_server_get_mrb(cli->server);
|
|
mrb = woe_server_get_mrb(cli->server);
|
|
if (mrb) {
|
|
if (mrb) {
|
|
rh_run_toplevel(mrb, "woe_on_input", "is", cli->index, buffer, size);
|
|
rh_run_toplevel(mrb, "woe_on_input", "is", cli->index, buffer, size);
|
|
@@ -122,21 +121,122 @@ int woe_client_input(struct woe_client * cli, const char *buffer, size_t size) {
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
-int woe_client_zmp(struct woe_client * cli, int argc, char *argv[]) {
|
|
|
|
|
|
+int woe_client_zmp(struct woe_client * cli, int argc, const char *argv[]) {
|
|
unsigned int i;
|
|
unsigned int i;
|
|
mrb_state * mrb;
|
|
mrb_state * mrb;
|
|
- LOG_NOTE("Received ZMP reply for client %d");
|
|
|
|
|
|
+ LOG_NOTE("Received ZMP reply for client %d", cli->index);
|
|
mrb = woe_server_get_mrb(cli->server);
|
|
mrb = woe_server_get_mrb(cli->server);
|
|
if (mrb) {
|
|
if (mrb) {
|
|
rh_run_toplevel(mrb, "woe_begin_zmp", "ii", cli->index, argc);
|
|
rh_run_toplevel(mrb, "woe_begin_zmp", "ii", cli->index, argc);
|
|
for (i=0; i < argc; i++) {
|
|
for (i=0; i < argc; i++) {
|
|
- rh_run_toplevel(mrb, "woe_zmp_arg", "is", cli->index, argv[i]);
|
|
|
|
|
|
+ rh_run_toplevel(mrb, "woe_zmp_arg", "iiz", cli->index, i, argv[i]);
|
|
}
|
|
}
|
|
rh_run_toplevel(mrb, "woe_finish_zmp", "ii", cli->index, argc);
|
|
rh_run_toplevel(mrb, "woe_finish_zmp", "ii", cli->index, argc);
|
|
}
|
|
}
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+int woe_client_iac(struct woe_client * cli, int cmd) {
|
|
|
|
+ mrb_state * mrb;
|
|
|
|
+ LOG_NOTE("Received iac for client %d %d", cli->index, cmd);
|
|
|
|
+ mrb = woe_server_get_mrb(cli->server);
|
|
|
|
+ if (mrb) {
|
|
|
|
+ rh_run_toplevel(mrb, "woe_on_iac", "i", cli->index, cmd);
|
|
|
|
+ }
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+int woe_client_negotiate(struct woe_client * cli, int how, int option) {
|
|
|
|
+ mrb_state * mrb;
|
|
|
|
+ LOG_NOTE("Received negotiate for client %d %d %d", cli->index, how, option);
|
|
|
|
+ mrb = woe_server_get_mrb(cli->server);
|
|
|
|
+ if (mrb) {
|
|
|
|
+ rh_run_toplevel(mrb, "woe_on_negotiate", "iii", cli->index, how, option);
|
|
|
|
+ }
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+int woe_client_subnegotiate(struct woe_client * cli, const char * buf, int len, int telopt) {
|
|
|
|
+ mrb_state * mrb;
|
|
|
|
+ LOG_NOTE("Received subnegotiate for client %d", cli->index);
|
|
|
|
+ mrb = woe_server_get_mrb(cli->server);
|
|
|
|
+ if (mrb) {
|
|
|
|
+ rh_run_toplevel(mrb, "woe_on_subnegotiate", "iis", cli->index, telopt, buf, len);
|
|
|
|
+ }
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+int woe_client_ttype(struct woe_client * cli, int cmd, const char * name) {
|
|
|
|
+ mrb_state * mrb;
|
|
|
|
+ LOG_NOTE("Received ttype for client %d %d %s", cli->index, cmd, name);
|
|
|
|
+ mrb = woe_server_get_mrb(cli->server);
|
|
|
|
+ if (mrb) {
|
|
|
|
+ rh_run_toplevel(mrb, "woe_on_ttype", "iz", cli->index, cmd, name);
|
|
|
|
+ }
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
|
|
|
|
|
|
|
|
+int woe_client_error(struct woe_client * cli, int code, const char * msg) {
|
|
|
|
+ mrb_state * mrb;
|
|
|
|
+ LOG_NOTE("Received error for client %d %d %s", cli->index, code, msg);
|
|
|
|
+ mrb = woe_server_get_mrb(cli->server);
|
|
|
|
+ if (mrb) {
|
|
|
|
+ rh_run_toplevel(mrb, "woe_on_error", "iz", cli->index, code, msg);
|
|
|
|
+ }
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+int woe_client_warning(struct woe_client * cli, int code, const char * msg) {
|
|
|
|
+ mrb_state * mrb;
|
|
|
|
+ LOG_NOTE("Received warning for client %d %d %s", cli->index, code, msg);
|
|
|
|
+ mrb = woe_server_get_mrb(cli->server);
|
|
|
|
+ if (mrb) {
|
|
|
|
+ rh_run_toplevel(mrb, "woe_on_warning", "iz", cli->index, code, msg);
|
|
|
|
+ }
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+int woe_client_compress(struct woe_client * cli, int state) {
|
|
|
|
+ mrb_state * mrb;
|
|
|
|
+ LOG_NOTE("Received compress for client %d %d", cli->index, state);
|
|
|
|
+ mrb = woe_server_get_mrb(cli->server);
|
|
|
|
+ if (mrb) {
|
|
|
|
+ rh_run_toplevel(mrb, "woe_on_compress", "ii", cli->index, state);
|
|
|
|
+ }
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+int woe_client_environ(struct woe_client * cli, int cmd, const struct telnet_environ_t *values, size_t size) {
|
|
|
|
+ int i;
|
|
|
|
+ mrb_state * mrb;
|
|
|
|
+ LOG_NOTE("Received environ for client %d %d", cli->index, cmd);
|
|
|
|
+ mrb = woe_server_get_mrb(cli->server);
|
|
|
|
+ if (mrb) {
|
|
|
|
+ rh_run_toplevel(mrb, "woe_begin_environ", "iii", cli->index, cmd, size);
|
|
|
|
+ for (i=0; i < size; i++) {
|
|
|
|
+ rh_run_toplevel(mrb, "woe_environ_arg", "iiizz", cli->index, i, values[i].type, values[i].var, values[i].value);
|
|
|
|
+ }
|
|
|
|
+ rh_run_toplevel(mrb, "woe_end_environ", "iii", cli->index, cmd, size);
|
|
|
|
+ }
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+int woe_client_mssp(struct woe_client * cli, const struct telnet_environ_t *values, size_t size) {
|
|
|
|
+ int i;
|
|
|
|
+ mrb_state * mrb;
|
|
|
|
+ LOG_NOTE("Received mssp for client %d", cli->index);
|
|
|
|
+ mrb = woe_server_get_mrb(cli->server);
|
|
|
|
+ if (mrb) {
|
|
|
|
+ rh_run_toplevel(mrb, "woe_begin_mssp", "ii", cli->index, size);
|
|
|
|
+ for (i=0; i < size; i++) {
|
|
|
|
+ rh_run_toplevel(mrb, "woe_mssp_arg", "iiizz", cli->index, i, values[i].type, values[i].var, values[i].value);
|
|
|
|
+ }
|
|
|
|
+ rh_run_toplevel(mrb, "woe_end_mssp", "iii", cli->index, size);
|
|
|
|
+ }
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
|