diff --git a/src/plugins/remotectl/calls.c b/src/plugins/remotectl/calls.c index d4bdca9..2fda904 100644 --- a/src/plugins/remotectl/calls.c +++ b/src/plugins/remotectl/calls.c @@ -72,14 +72,14 @@ { (void **) &host_disconnect, (void *) hllapi_pipe_disconnect, "lib3270_disconnect" }, { (void **) &wait_for_ready, (void *) NULL, "lib3270_wait_for_ready" }, { (void **) &script_sleep, (void *) NULL, "lib3270_wait" }, - { (void **) &get_message, (void *) NULL, "lib3270_get_program_message" }, - { (void **) &get_text, (void *) NULL, "lib3270_get_text_at" }, + { (void **) &get_message, (void *) hllapi_pipe_get_message, "lib3270_get_program_message" }, + { (void **) &get_text, (void *) hllapi_pipe_get_text_at, "lib3270_get_text_at" }, { (void **) &release_memory, (void *) hllapi_pipe_release_memory, "lib3270_free" }, - { (void **) &action_enter, (void *) NULL, "lib3270_enter" }, - { (void **) &set_text_at, (void *) NULL, "lib3270_set_string_at" }, - { (void **) &cmp_text_at, (void *) NULL, "lib3270_cmp_text_at" }, - { (void **) &pfkey, (void *) NULL, "lib3270_pfkey" }, - { (void **) &pakey, (void *) NULL, "lib3270_pakey" }, + { (void **) &action_enter, (void *) hllapi_pipe_enter, "lib3270_enter" }, + { (void **) &set_text_at, (void *) hllapi_pipe_set_text_at, "lib3270_set_string_at" }, + { (void **) &cmp_text_at, (void *) hllapi_pipe_cmp_text_at, "lib3270_cmp_text_at" }, + { (void **) &pfkey, (void *) hllapi_pipe_pfkey, "lib3270_pfkey" }, + { (void **) &pakey, (void *) hllapi_pipe_pakey, "lib3270_pakey" }, { NULL, NULL } }; diff --git a/src/plugins/remotectl/client.h b/src/plugins/remotectl/client.h index 3e6bb3a..ff82e68 100644 --- a/src/plugins/remotectl/client.h +++ b/src/plugins/remotectl/client.h @@ -44,15 +44,15 @@ void hllapi_pipe_release_memory(void *p); int hllapi_pipe_connect(void *h, const char *n, int wait); void hllapi_pipe_disconnect(void *h); - -/* - int hllapi_pipe_wait_for_ready(void *h, int seconds); - int hllapi_pipe_sleep(void *h, int seconds); LIB3270_MESSAGE hllapi_pipe_get_message(void *h); - char * hllapi_pipe_get_text(void *h, int row, int col, int len); + char * hllapi_pipe_get_text_at(void *h, int row, int col, int len); int hllapi_pipe_enter(void *h); int hllapi_pipe_set_text_at(void *h, int row, int col, const unsigned char *str); int hllapi_pipe_cmp_text_at(void *h, int row, int col, const char *text); int hllapi_pipe_pfkey(void *h, int key); int hllapi_pipe_pakey(void *h, int key); + +/* + int hllapi_pipe_wait_for_ready(void *h, int seconds); + int hllapi_pipe_sleep(void *h, int seconds); */ diff --git a/src/plugins/remotectl/packets.h b/src/plugins/remotectl/packets.h index db07d63..d40b1a3 100644 --- a/src/plugins/remotectl/packets.h +++ b/src/plugins/remotectl/packets.h @@ -31,48 +31,65 @@ struct hllapi_packet_result { - int rc; + int rc; }; struct hllapi_packet_query { - unsigned char packet_id; + int packet_id; }; struct hllapi_packet_connect { - unsigned char packet_id; + int packet_id; unsigned char wait; char hostname[1]; }; struct hllapi_packet_keycode { - unsigned char packet_id; + int packet_id; unsigned short keycode; }; struct hllapi_packet_cursor { - unsigned char packet_id; + int packet_id; unsigned short row; unsigned short col; }; struct hllapi_packet_text { - unsigned char packet_id; + int packet_id; char text[1]; }; +struct hllapi_packet_at +{ + int packet_id; + unsigned short row; + unsigned short col; + unsigned short len; +}; struct hllapi_packet_text_at { - unsigned char packet_id; + int packet_id; unsigned short row; unsigned short col; char text[1]; }; +struct hllapi_packet_query_at +{ + int packet_id; + unsigned short row; + unsigned short col; + unsigned short len; +}; + + + #pragma pack() diff --git a/src/plugins/remotectl/pluginmain.c b/src/plugins/remotectl/pluginmain.c index 9458bfa..fc13b52 100644 --- a/src/plugins/remotectl/pluginmain.c +++ b/src/plugins/remotectl/pluginmain.c @@ -134,13 +134,28 @@ return FALSE; } -/* - static void send_message(pipe_source *source, const void *pkt, int sz) + static void send_text(pipe_source *source, char *text) { - WriteFile(qry->hPipe,&data,wrote,&wrote,NULL); + struct hllapi_packet_text *pkt; + DWORD szBlock; + if(text) + { + szBlock = sizeof(struct hllapi_packet_text)+strlen(text); + pkt = g_malloc0(szBlock); + pkt->packet_id = 0; + strcpy(pkt->text,text); + lib3270_free(text); + } + else + { + szBlock = sizeof(struct hllapi_packet_text); + pkt = g_malloc0(szBlock); + pkt->packet_id = errno ? errno : -1; + } + + WriteFile(source->hPipe,&pkt,szBlock,&szBlock,NULL); } -*/ static void send_result(pipe_source *source, int rc) { @@ -197,6 +212,13 @@ (unsigned char *) ((struct hllapi_packet_text_at *) source->buffer)->text)); break; + case HLLAPI_PACKET_GET_TEXT_AT: + send_text(source,lib3270_get_text_at( lib3270_get_default_session_handle(), + ((struct hllapi_packet_at *) source->buffer)->row, + ((struct hllapi_packet_at *) source->buffer)->col, + ((struct hllapi_packet_at *) source->buffer)->len)); + break; + case HLLAPI_PACKET_CMP_TEXT_AT: send_result(source,lib3270_cmp_text_at( lib3270_get_default_session_handle(), ((struct hllapi_packet_text_at *) source->buffer)->row, -- libgit2 0.21.2