diff --git a/src/classlib/remote.cc b/src/classlib/remote.cc
index f91fe3f..31def2f 100644
--- a/src/classlib/remote.cc
+++ b/src/classlib/remote.cc
@@ -667,7 +667,7 @@
#elif defined(HAVE_DBUS)
- int rc = query_intval("connect", DBUS_TYPE_STRING, &uri, DBUS_TYPE_INVALID);
+ rc = query_intval("connect", DBUS_TYPE_STRING, "", DBUS_TYPE_INVALID);
#else
rc = -1;
@@ -697,8 +697,7 @@
#elif defined(HAVE_DBUS)
- #warning Implementar
- return -1;
+ rc = query_intval("setHost", DBUS_TYPE_STRING, &uri, DBUS_TYPE_INVALID);
#else
diff --git a/src/include/lib3270.h b/src/include/lib3270.h
index 677ab52..8d247cb 100644
--- a/src/include/lib3270.h
+++ b/src/include/lib3270.h
@@ -419,6 +419,17 @@
LIB3270_EXPORT const char * lib3270_get_hostname(H3270 *h);
/**
+ * Get URL of the hostname for the connect/reconnect operations.
+ *
+ * @param h Session handle.
+ *
+ * @return Pointer to host URL set (internal data, do not change it)
+ *
+ */
+ LIB3270_EXPORT const char * lib3270_get_host(H3270 *h);
+
+
+ /**
* Network connect operation, keep main loop running
*
* @param h Session handle.
diff --git a/src/lib3270/connect.c b/src/lib3270/connect.c
index 1908359..386203e 100644
--- a/src/lib3270/connect.c
+++ b/src/lib3270/connect.c
@@ -136,7 +136,9 @@ static void net_connected(H3270 *hSession)
}
-#if defined(_WIN32) /*[*/
+
+#if defined(_WIN32)
+
static void sockstart(H3270 *session)
{
static int initted = 0;
@@ -171,15 +173,11 @@ static void net_connected(H3270 *hSession)
_exit(1);
}
}
-#endif /*]*/
+#endif // WIN32
LIB3270_EXPORT int lib3270_connect_host(H3270 *hSession, const char *hostname, const char *srvc, LIB3270_CONNECT_OPTION opt)
{
- int s;
- int optval;
- struct addrinfo hints;
- struct addrinfo * result = NULL;
- struct addrinfo * rp = NULL;
+ CHECK_SESSION_HANDLE(hSession);
if(!hostname)
return EINVAL;
@@ -187,6 +185,48 @@ static void net_connected(H3270 *hSession)
if(!srvc)
srvc = "telnet";
+ if(*hostname == '$')
+ {
+ const char *name = getenv(hostname+1);
+ if(!name)
+ {
+ lib3270_popup_dialog( hSession,
+ LIB3270_NOTIFY_ERROR,
+ _( "Connection error" ),
+ _( "Unable to find selected hostname." ),
+ _( "Can't determine value for environment variable \"%s\" " ),
+ hostname);
+ lib3270_set_disconnected(hSession);
+ return ENOENT;
+ }
+ hostname = name;
+ }
+
+ hSession->host.opt = opt & ~LIB3270_CONNECT_OPTION_WAIT;
+ Replace(hSession->host.current,strdup(hostname));
+ Replace(hSession->host.srvc,strdup(srvc));
+
+ Replace(hSession->host.full,
+ lib3270_strdup_printf(
+ "%s%s:%s",
+ opt&LIB3270_CONNECT_OPTION_SSL ? "tn3270s://" : "tn3270://",
+ hostname,
+ srvc ));
+
+ trace("current_host=\"%s\"",hSession->host.current);
+
+ return lib3270_connect(hSession,opt & LIB3270_CONNECT_OPTION_WAIT);
+
+ }
+
+ int lib3270_connect(H3270 *hSession, int wait)
+ {
+ int s;
+ int optval;
+ struct addrinfo hints;
+ struct addrinfo * result = NULL;
+ struct addrinfo * rp = NULL;
+
CHECK_SESSION_HANDLE(hSession);
lib3270_main_iterate(hSession,0);
@@ -201,20 +241,9 @@ static void net_connected(H3270 *hSession)
sockstart(hSession);
#endif
- hSession->host.opt = opt & ~LIB3270_CONNECT_OPTION_WAIT;
- Replace(hSession->host.current,strdup(hostname));
-
- Replace(hSession->host.full,
- lib3270_strdup_printf(
- "%s%s:%s",
- opt&LIB3270_CONNECT_OPTION_SSL ? "L:" : "",
- hostname,
- srvc ));
-
- trace("current_host=\"%s\"",hSession->host.current);
-
-
set_ssl_state(hSession,LIB3270_SSL_UNSECURE);
+ snprintf(hSession->full_model_name,LIB3270_FULL_MODEL_NAME_LENGTH,"IBM-327%c-%d",hSession->m3279 ? '9' : '8', hSession->model_num);
+
hSession->ever_3270 = False;
@@ -227,33 +256,17 @@ static void net_connected(H3270 *hSession)
hints.ai_addr = NULL;
hints.ai_next = NULL;
- if(*hostname == '$')
- {
- const char *name = getenv(hostname+1);
- if(!name)
- {
- lib3270_popup_dialog( hSession,
- LIB3270_NOTIFY_ERROR,
- _( "Connection error" ),
- _( "Unable to find selected hostname." ),
- _( "Can't determine value for environment variable \"%s\" " ),
- hostname);
- lib3270_set_disconnected(hSession);
- return ENOENT;
- }
- hostname = name;
- }
hSession->cstate = LIB3270_RESOLVING;
lib3270_st_changed(hSession, LIB3270_STATE_RESOLVING, True);
- s = getaddrinfo(hostname, srvc, &hints, &result);
+ s = getaddrinfo(hSession->host.current, hSession->host.srvc, &hints, &result);
if(s != 0)
{
char buffer[4096];
- snprintf(buffer,4095,_( "Can't connect to %s:%s"), hostname, srvc);
+ snprintf(buffer,4095,_( "Can't connect to %s:%s"), hSession->host.current, hSession->host.srvc);
#if defined(WIN32) && defined(HAVE_ICONV)
{
@@ -303,7 +316,7 @@ static void net_connected(H3270 *hSession)
hSession->ever_3270 = False;
hSession->ssl_host = 0;
- if(opt&LIB3270_CONNECT_OPTION_SSL)
+ if(hSession->host.opt&LIB3270_CONNECT_OPTION_SSL)
{
#if defined(HAVE_LIBSSL)
hSession->ssl_host = 1;
@@ -380,7 +393,7 @@ static void net_connected(H3270 *hSession)
if(err != WSAEWOULDBLOCK)
{
char buffer[4096];
- snprintf(buffer,4095,_( "Can't connect to %s:%s"), hostname, srvc);
+ snprintf(buffer,4095,_( "Can't connect to %s"), lib3270_get_host(hSession));
lib3270_popup_dialog( hSession,
LIB3270_NOTIFY_ERROR,
@@ -431,7 +444,7 @@ static void net_connected(H3270 *hSession)
if( errno != EINPROGRESS )
{
char buffer[4096];
- snprintf(buffer,4095,_( "Can't connect to %s:%s"), hostname, srvc);
+ snprintf(buffer,4095,_( "Can't connect to %s:%s"), hSession->host.current, hSession->host.srvc);
lib3270_popup_dialog( hSession,
LIB3270_NOTIFY_ERROR,
@@ -511,7 +524,7 @@ static void net_connected(H3270 *hSession)
trace("%s: Connection in progress",__FUNCTION__);
- if(opt&LIB3270_CONNECT_OPTION_WAIT)
+ if(wait)
{
time_t end = time(0)+120;
@@ -564,6 +577,7 @@ int non_blocking(H3270 *hSession, Boolean on)
_( "Connection error" ),
_( "ioctlsocket(FIONBIO) failed." ),
"%s", lib3270_win32_strerror(GetLastError()));
+ return -1;
}
#else
diff --git a/src/lib3270/globals.h b/src/lib3270/globals.h
index b35c256..f0e09f2 100644
--- a/src/lib3270/globals.h
+++ b/src/lib3270/globals.h
@@ -223,9 +223,21 @@ enum keytype
KT_GE
};
+LIB3270_INTERNAL struct _ansictl
+{
+ char vintr;
+ char vquit;
+ char verase;
+ char vkill;
+ char veof;
+ char vwerase;
+ char vrprnt;
+ char vlnext;
+} ansictl;
+
/* default charset translation tables */
-LIB3270_INTERNAL const unsigned short ebc2asc0[256];
-LIB3270_INTERNAL const unsigned short asc2ft0[256];
+// LIB3270_INTERNAL const unsigned short ebc2asc0[256];
+// LIB3270_INTERNAL const unsigned short asc2ft0[256];
/* Library internal calls */
diff --git a/src/lib3270/glue.c b/src/lib3270/glue.c
index 27c04e9..6114ecd 100644
--- a/src/lib3270/glue.c
+++ b/src/lib3270/glue.c
@@ -94,36 +94,80 @@
/*---[ Globals ]--------------------------------------------------------------------------------------------------------------*/
-#if defined WIN32
-
-BOOL WINAPI DllMain(HANDLE hinst, DWORD dwcallpurpose, LPVOID lpvResvd)
+/*
+ * parse_ctlchar
+ * Parse an stty control-character specification.
+ * A cheap, non-complaining implementation.
+ */
+static char parse_ctlchar(char *s)
{
-// Trace("%s - Library %s",__FUNCTION__,(dwcallpurpose == DLL_PROCESS_ATTACH) ? "Loaded" : "Unloaded");
-
- if(dwcallpurpose == DLL_PROCESS_ATTACH)
- get_version_info();
-
- return TRUE;
+ if (!s || !*s)
+ return 0;
+
+ if ((int) strlen(s) > 1)
+ {
+ if (*s != '^')
+ return 0;
+ else if (*(s+1) == '?')
+ return 0177;
+ else
+ return *(s+1) - '@';
+ } else
+ return *s;
}
-#else
-
int lib3270_loaded(void)
{
+ trace("%s",__FUNCTION__);
+
+ ansictl.vintr = parse_ctlchar("^C");
+ ansictl.vquit = parse_ctlchar("^\\");
+ ansictl.verase = parse_ctlchar("^H");
+ ansictl.vkill = parse_ctlchar("^U");
+ ansictl.veof = parse_ctlchar("^D");
+ ansictl.vwerase = parse_ctlchar("^W");
+ ansictl.vrprnt = parse_ctlchar("^R");
+ ansictl.vlnext = parse_ctlchar("^V");
+
return 0;
}
int lib3270_unloaded(void)
{
+ trace("%s",__FUNCTION__);
return 0;
}
+
+#if defined WIN32
+
+BOOL WINAPI DllMain(HANDLE hinst, DWORD dwcallpurpose, LPVOID lpvResvd)
+{
+// Trace("%s - Library %s",__FUNCTION__,(dwcallpurpose == DLL_PROCESS_ATTACH) ? "Loaded" : "Unloaded");
+
+ switch(dwcallpurpose)
+ {
+ case DLL_PROCESS_ATTACH:
+ get_version_info();
+ lib3270_loaded();
+ break;
+
+ case DLL_PROCESS_DETACH:
+ lib3270_unloaded();
+ break;
+
+ }
+
+ return TRUE;
+}
+
#endif
#ifdef DEBUG
extern void lib3270_initialize(void)
{
+ lib3270_loaded();
}
#endif
diff --git a/src/lib3270/host.c b/src/lib3270/host.c
index 6b825dc..f4eabee 100644
--- a/src/lib3270/host.c
+++ b/src/lib3270/host.c
@@ -312,151 +312,7 @@ split_success:
}
*/
-static int do_connect(H3270 *hSession)
-{
-// char nb[2048]; // name buffer
-// char *s; // temporary
- char *chost = NULL; // to whom we will connect
-// char *ps = CN;
-// char *port = CN;
- Boolean resolving;
- Boolean pending;
-// static Boolean ansi_host;
-// Boolean has_colons = False;
-
- if (lib3270_connected(hSession) || hSession->auto_reconnect_inprogress)
- return EBUSY;
-
- /*
- // Skip leading blanks.
- while (*n == ' ')
- n++;
-
- if (!*n)
- {
- popup_an_error(hSession,_( "Invalid (empty) hostname" ));
- return -1;
- }
- */
-
- /*
- // Save in a modifiable buffer.
- (void) strncpy(nb, n, 2047);
-
- // Strip trailing blanks.
- s = nb + strlen(nb) - 1;
- while (*s == ' ')
- *s-- = '\0';
- */
-
- /* Remember this hostname, as the last hostname we connected to. */
- // lib3270_set_host(hSession,nb);
-
- /*
- {
- Boolean needed;
-
- // Strip off and remember leading qualifiers.
- if ((s = split_host(hSession, nb, &ansi_host, &hSession->std_ds_host,
- &hSession->passthru_host, &hSession->non_tn3270e_host, &hSession->ssl_host,
- &hSession->no_login_host, hSession->luname, &port,
- &needed)) == CN)
- return EINVAL;
-
- chost = s;
-
- // Default the port.
- if (port == CN)
- port = "telnet";
- }
-
- //
- // Store the original name in globals, even if we fail the connect
- // later:
- // current_host is the hostname part, stripped of qualifiers, luname
- // and port number
- // full_current_host is the entire string, for use in reconnecting
- //
- //
- // Replace(hSession->current_host, CN);
-
- has_colons = (strchr(chost, ':') != NULL);
-
- Replace(hSession->host.qualified,
- xs_buffer("%s%s%s%s:%s",
- hSession->ssl_host? "L:": "",
- has_colons? "[": "",
- chost,
- has_colons? "]": "",
- port));
- */
-
- /* Attempt contact. */
- hSession->ever_3270 = False;
- hSession->ssl_host = 0;
-
- if(hSession->host.opt&LIB3270_CONNECT_OPTION_SSL)
- {
-#if defined(HAVE_LIBSSL)
- hSession->ssl_host = 1;
- ssl_init(hSession);
-#else
- popup_system_error(hSession, _( "SSL error" ),
- _( "Unable to connect to secure hosts" ),
- _( "This version of %s was built without support for secure sockets layer (SSL)." ),
- PACKAGE_NAME
- );
-#endif
- }
-
- trace("Conneting to hostname=[%s] service=[%s]",hSession->host.current, hSession->host.srvc);
- if(net_connect(hSession, hSession->host.current, hSession->host.srvc, 0, &resolving,&pending) != 0 && !resolving)
- {
- /* Redundantly signal a disconnect. */
- lib3270_set_disconnected(hSession);
- return -1;
- }
-
- chost = lib3270_free(chost);
-
- /* Still thinking about it? */
- if (resolving)
- {
- hSession->cstate = RESOLVING;
- lib3270_st_changed(hSession, LIB3270_STATE_RESOLVING, True);
- return 0;
- }
-
- /* Success. */
-
- /* Setup socket I/O. */
-// add_input_calls(hSession,net_input,net_exception);
-#ifdef _WIN32
- hSession->ns_exception_id = AddExcept(hSession->sockEvent, hSession, net_exception);
- hSession->ns_read_id = AddInput(hSession->sockEvent, hSession, net_input);
-#else
- hSession->ns_exception_id = AddExcept(hSession->sock, hSession, net_exception);
- hSession->ns_read_id = AddInput(hSession->sock, hSession, net_input);
-#endif // WIN32
-
- hSession->excepting = 1;
- hSession->reading = 1;
-
-
- /* Set state and tell the world. */
- if (pending)
- {
- hSession->cstate = PENDING;
- lib3270_st_changed(hSession, LIB3270_STATE_HALF_CONNECT, True);
- }
- else
- {
- lib3270_set_connected(hSession);
- }
-
- return 0;
-}
-
+/*
int lib3270_connect(H3270 *hSession, int wait)
{
int rc;
@@ -496,6 +352,7 @@ int lib3270_connect(H3270 *hSession, int wait)
return rc;
}
+*/
/*
* Called from timer to attempt an automatic reconnection.
@@ -725,6 +582,12 @@ LIB3270_EXPORT const char * lib3270_get_hostname(H3270 *h)
return h->host.current;
}
+LIB3270_EXPORT const char * lib3270_get_host(H3270 *h)
+{
+ CHECK_SESSION_HANDLE(h);
+ return h->host.full;
+}
+
/*
LIB3270_EXPORT int lib3270_reconnect(H3270 *hSession,int wait)
{
diff --git a/src/lib3270/sources.mak b/src/lib3270/sources.mak
index 181aae0..f58a492 100644
--- a/src/lib3270/sources.mak
+++ b/src/lib3270/sources.mak
@@ -33,7 +33,7 @@ TERMINAL_SOURCES = bounds.c ctlr.c util.c toggles.c screen.c selection.c kybd.c
# tables.c utf8.c
# Network I/O Sources
-NETWORK_SOURCES = iocalls.c proxy.c connect.c
+NETWORK_SOURCES = iocalls.c connect.c
# Full library sources
SOURCES = $(TERMINAL_SOURCES) $(NETWORK_SOURCES) ft.c ft_cut.c ft_dft.c glue.c resources.c \
diff --git a/src/lib3270/telnet.c b/src/lib3270/telnet.c
index 4542973..d3052d5 100644
--- a/src/lib3270/telnet.c
+++ b/src/lib3270/telnet.c
@@ -120,7 +120,8 @@
#define E_OPT(n) (1 << (n))
#endif // X3270_TN3270E
-#if defined(X3270_ANSI) /*[*/
+/*
+#if defined(X3270_ANSI)
static char vintr;
static char vquit;
static char verase;
@@ -129,7 +130,10 @@ static char veof;
static char vwerase;
static char vrprnt;
static char vlnext;
-#endif /*]*/
+#endif
+*/
+
+struct _ansictl ansictl = { 0 };
static int telnet_fsm(H3270 *session, unsigned char c);
static void net_rawout(H3270 *session, unsigned const char *buf, size_t len);
@@ -164,7 +168,7 @@ static void do_rprnt(H3270 *hSession, char c);
static void do_eof(H3270 *hSession, char c);
static void do_eol(H3270 *hSession, char c);
static void do_lnext(H3270 *hSession, char c);
-static char parse_ctlchar(char *s);
+// static char parse_ctlchar(char *s);
static void cooked_init(H3270 *hSession);
#endif /*]*/
@@ -270,7 +274,8 @@ static const char *trsp_flag[2] = { "POSITIVE-RESPONSE", "NEGATIVE-RESPONSE" };
/*--[ Implement ]------------------------------------------------------------------------------------*/
-#if defined(_WIN32) /*[*/
+/*
+#if defined(_WIN32)
void sockstart(H3270 *session)
{
static int initted = 0;
@@ -305,7 +310,8 @@ void sockstart(H3270 *session)
_exit(1);
}
}
-#endif /*]*/
+#endif
+*/
static union {
struct sockaddr sa;
@@ -323,6 +329,7 @@ void popup_a_sockerr(H3270 *hSession, char *fmt, ...)
#else
const char *msg = strerror(errno);
#endif // WIN32
+
va_list args;
char *text;
@@ -332,11 +339,17 @@ void popup_a_sockerr(H3270 *hSession, char *fmt, ...)
lib3270_write_log(hSession, "3270", "Network error:\n%s\n%s",text,msg);
- lib3270_popup_dialog(hSession, LIB3270_NOTIFY_ERROR, _( "Network error" ), text, "%s", msg);
+ lib3270_popup_dialog( hSession,
+ LIB3270_NOTIFY_ERROR,
+ _( "Network error" ),
+ text,
+ "%s", msg);
+
lib3270_free(text);
}
+/*
#pragma pack(1)
struct connect_parm
{
@@ -347,7 +360,9 @@ struct connect_parm
int err;
};
#pragma pack()
+*/
+/*
static int do_connect_sock(H3270 *h, struct connect_parm *p)
{
#ifdef WIN32
@@ -428,7 +443,9 @@ static int do_connect_sock(H3270 *h, struct connect_parm *p)
return 0;
}
+*/
+/*
static int connect_sock(H3270 *hSession, int sockfd, const struct sockaddr *addr, socklen_t addrlen)
{
struct connect_parm p = { sizeof(struct connect_parm), sockfd, addr, addrlen, -1 };
@@ -439,7 +456,7 @@ static int connect_sock(H3270 *hSession, int sockfd, const struct sockaddr *addr
return p.err;
}
-
+*/
/**
* Establish a telnet socket to the given host passed as an argument.
@@ -450,7 +467,7 @@ static int connect_sock(H3270 *hSession, int sockfd, const struct sockaddr *addr
* @param session Handle to the session descriptor.
*
* @return 0 if ok, non zero if failed
- */
+ */ /*
int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Boolean *resolving, Boolean *pending)
{
// struct servent * sp;
@@ -467,9 +484,9 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo
int optval;
char errmsg[1024];
int rc;
-#if defined(OMTU) /*[*/
+#if defined(OMTU)
int mtu = OMTU;
-#endif /*]*/
+#endif
#define close_fail { (void) SOCK_CLOSE(session->sock); session->sock = -1; return -1; }
@@ -482,7 +499,7 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo
// if (session->netrbuf == (unsigned char *)NULL)
// session->netrbuf = (unsigned char *)lib3270_malloc(BUFSZ);
-#if defined(X3270_ANSI) /*[*/
+#if defined(X3270_ANSI)
if (!t_valid)
{
vintr = parse_ctlchar("^C");
@@ -496,14 +513,14 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo
t_valid = 1;
}
-#endif /*]*/
+#endif
*resolving = False;
*pending = False;
// Replace(session->hostname, NewString(host));
- /* get the passthru host and port number */
+ // get the passthru host and port number
if (session->passthru_host)
{
#if defined(HAVE_GETADDRINFO)
@@ -567,7 +584,7 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo
return -1;
}
- /* fill in the socket address of the given host */
+ // fill in the socket address of the given host
(void) memset((char *) &haddr, 0, sizeof(haddr));
if (session->passthru_host)
{
@@ -593,14 +610,14 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo
}
}
- /* create the socket */
+ // create the socket
if((session->sock = socket(haddr.sa.sa_family, SOCK_STREAM, 0)) == -1)
{
popup_a_sockerr(session, N_( "socket" ) );
return -1;
}
- /* set options for inline out-of-band data and keepalives */
+ // set options for inline out-of-band data and keepalives
if (setsockopt(session->sock, SOL_SOCKET, SO_OOBINLINE, (char *)&on,sizeof(on)) < 0)
{
popup_a_sockerr(session, N_( "setsockopt(%s)" ), "SO_OOBINLINE");
@@ -615,22 +632,22 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo
}
#endif
- /* set the socket to be non-delaying during connect */
+ // set the socket to be non-delaying during connect
if(non_blocking(session,False) < 0)
close_fail;
#if !defined(_WIN32)
- /* don't share the socket with our children */
+ // don't share the socket with our children
(void) fcntl(session->sock, F_SETFD, 1);
#endif
- /* init ssl */
+ // init ssl
#if defined(HAVE_LIBSSL)
if (session->ssl_host)
ssl_init(session);
#endif
- /* connect */
+ // connect
status_connecting(session,1);
rc = connect_sock(session, session->sock, &haddr.sa,ha_len);
@@ -671,15 +688,8 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo
snprintf(session->full_model_name,LIB3270_FULL_MODEL_NAME_LENGTH,"IBM-327%c-%d",session->m3279 ? '9' : '8', session->model_num);
- /* set up temporary termtype
- if (session->termname == CN && session->std_ds_host)
- {
- sprintf(session->ttype_tmpval, "IBM-327%c-%d",session->m3279 ? '9' : '8', session->model_num);
- session->termtype = session->ttype_tmpval;
- }
- */
- /* all done */
+ // all done
#if defined(_WIN32)
if(session->sockEvent == NULL)
{
@@ -718,6 +728,7 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo
return 0;
}
#undef close_fail
+*/
/* Set up the LU list. */
static void setup_lus(H3270 *hSession)
@@ -2113,21 +2124,21 @@ static void net_cookout(H3270 *hSession, const char *buf, int len)
/* Control chars. */
if (c == '\n')
do_eol(hSession,c);
- else if (c == vintr)
+ else if (c == ansictl.vintr)
do_intr(hSession, c);
- else if (c == vquit)
+ else if (c == ansictl.vquit)
do_quit(hSession,c);
- else if (c == verase)
+ else if (c == ansictl.verase)
do_cerase(hSession,c);
- else if (c == vkill)
+ else if (c == ansictl.vkill)
do_kill(hSession,c);
- else if (c == vwerase)
+ else if (c == ansictl.vwerase)
do_werase(hSession,c);
- else if (c == vrprnt)
+ else if (c == ansictl.vrprnt)
do_rprnt(hSession,c);
- else if (c == veof)
+ else if (c == ansictl.veof)
do_eof(hSession,c);
- else if (c == vlnext)
+ else if (c == ansictl.vlnext)
do_lnext(hSession,c);
else if (c == 0x08 || c == 0x7f) /* Yes, a hack. */
do_cerase(hSession,c);
@@ -2873,7 +2884,7 @@ void net_sends(H3270 *hSession,const char *s)
*/
void net_send_erase(H3270 *hSession)
{
- net_cookout(hSession, &verase, 1);
+ net_cookout(hSession, &ansictl.verase, 1);
}
/**
@@ -2881,7 +2892,7 @@ void net_send_erase(H3270 *hSession)
*/
void net_send_kill(H3270 *hSession)
{
- net_cookout(hSession, &vkill, 1);
+ net_cookout(hSession, &ansictl.vkill, 1);
}
/**
@@ -2889,7 +2900,7 @@ void net_send_kill(H3270 *hSession)
*/
void net_send_werase(H3270 *hSession)
{
- net_cookout(hSession, &vwerase, 1);
+ net_cookout(hSession, &ansictl.vwerase, 1);
}
#endif /*]*/
@@ -2991,29 +3002,6 @@ void net_abort(H3270 *hSession)
}
#endif /*]*/
-#if defined(X3270_ANSI) /*[*/
-/*
- * parse_ctlchar
- * Parse an stty control-character specification.
- * A cheap, non-complaining implementation.
- */
-static char
-parse_ctlchar(char *s)
-{
- if (!s || !*s)
- return 0;
- if ((int) strlen(s) > 1) {
- if (*s != '^')
- return 0;
- else if (*(s+1) == '?')
- return 0177;
- else
- return *(s+1) - '@';
- } else
- return *s;
-}
-#endif /*]*/
-
/* Return the local address for the socket. */
int net_getsockname(const H3270 *session, void *buf, int *len)
{
diff --git a/src/plugins/dbus3270/gobject.c b/src/plugins/dbus3270/gobject.c
index b62720a..f8b016d 100644
--- a/src/plugins/dbus3270/gobject.c
+++ b/src/plugins/dbus3270/gobject.c
@@ -86,10 +86,30 @@ void pw3270_dbus_get_revision(PW3270Dbus *object, DBusGMethodInvocation *context
void pw3270_dbus_connect(PW3270Dbus *object, const gchar *uri, DBusGMethodInvocation *context)
{
+ H3270 *hSession = pw3270_dbus_get_session_handle(PW3270_DBUS(object));
+
trace("%s object=%p context=%p",__FUNCTION__,object,context);
- g_message("Connecting to \"%s\" by remote request",uri);
- dbus_g_method_return(context,lib3270_connect(pw3270_dbus_get_session_handle(PW3270_DBUS(object)),uri,0));
+ if(uri && *uri)
+ {
+ g_message("Connecting to \"%s\" by remote request",uri);
+ lib3270_set_host(hSession,uri);
+ }
+ else
+ {
+ g_message("%s","Connecting by remote request");
+ }
+
+ dbus_g_method_return(context,lib3270_connect(hSession,0));
+}
+
+void pw3270_dbus_set_host(PW3270Dbus *object, const gchar *uri, DBusGMethodInvocation *context)
+{
+ trace("%s object=%p context=%p",__FUNCTION__,object,context);
+
+ g_message("Changing host to \"%s\" by remote request",uri);
+
+ dbus_g_method_return(context,lib3270_set_host(pw3270_dbus_get_session_handle(PW3270_DBUS(object)),uri) != NULL);
}
void pw3270_dbus_disconnect(PW3270Dbus *object, DBusGMethodInvocation *context)
diff --git a/src/plugins/dbus3270/pw3270dbus.xml b/src/plugins/dbus3270/pw3270dbus.xml
index a47aabf..da44484 100644
--- a/src/plugins/dbus3270/pw3270dbus.xml
+++ b/src/plugins/dbus3270/pw3270dbus.xml
@@ -14,6 +14,11 @@
+
+
+
+
+
diff --git a/src/plugins/dbus3270/service.h b/src/plugins/dbus3270/service.h
index e9f0dc6..4c79df7 100644
--- a/src/plugins/dbus3270/service.h
+++ b/src/plugins/dbus3270/service.h
@@ -66,6 +66,7 @@
void pw3270_dbus_get_revision(PW3270Dbus *object, DBusGMethodInvocation *context);
void pw3270_dbus_quit(PW3270Dbus *object, DBusGMethodInvocation *context);
void pw3270_dbus_connect(PW3270Dbus *object, const gchar *uri, DBusGMethodInvocation *context);
+ void pw3270_dbus_set_host(PW3270Dbus *object, const gchar *uri, DBusGMethodInvocation *context);
void pw3270_dbus_disconnect(PW3270Dbus *object, DBusGMethodInvocation *context);
void pw3270_dbus_get_message_id(PW3270Dbus *object, DBusGMethodInvocation *context);
void pw3270_dbus_get_connection_state(PW3270Dbus *object, DBusGMethodInvocation *context);
--
libgit2 0.21.2