Commit a3cd3d81937fe2ee4e6ba3993423c4691f4c3413
1 parent
42e5209b
Exists in
master
and in
5 other branches
Movend a função de conexão por URL para a biblioteca principal para simplificar a biblioteca de IPC.
Showing
4 changed files
with
27 additions
and
6 deletions
Show diff stats
pw3270.cbp
... | ... | @@ -89,11 +89,11 @@ |
89 | 89 | <Unit filename="src/include/lib3270/trace.h" /> |
90 | 90 | <Unit filename="src/include/plugin.mak.in" /> |
91 | 91 | <Unit filename="src/include/pw3270.h" /> |
92 | - <Unit filename="src/include/pw3270/class.h" /> | |
93 | 92 | <Unit filename="src/include/pw3270/hllapi.h" /> |
94 | 93 | <Unit filename="src/include/pw3270/ipcpackets.h" /> |
95 | 94 | <Unit filename="src/include/pw3270/plugin.h" /> |
96 | 95 | <Unit filename="src/include/pw3270/trace.h" /> |
96 | + <Unit filename="src/include/pw3270cpp.h" /> | |
97 | 97 | <Unit filename="src/include/rules.mak.in" /> |
98 | 98 | <Unit filename="src/java/Makefile.in"> |
99 | 99 | <Option target="Debug" /> | ... | ... |
src/include/lib3270.h
... | ... | @@ -499,6 +499,18 @@ |
499 | 499 | */ |
500 | 500 | LIB3270_EXPORT int lib3270_connect_host(H3270 *hSession, const char *hostname, const char *srvc, LIB3270_OPTION opt); |
501 | 501 | |
502 | + /** | |
503 | + * @brief Connect by URL | |
504 | + * | |
505 | + * @param hSession Session handle. | |
506 | + * @param url Host URL | |
507 | + * @param wait Seconds to wait for connection. | |
508 | + * | |
509 | + * @see lib3270_wait | |
510 | + * | |
511 | + * @return 0 for success, EAGAIN if auto-reconnect is in progress, EBUSY if connected, ENOTCONN if connection has failed, -1 on unexpected failure. | |
512 | + */ | |
513 | + LIB3270_EXPORT int lib3270_connect_url(H3270 *hSession, const char *url, int wait); | |
502 | 514 | |
503 | 515 | /** |
504 | 516 | * Disconnect from host. | ... | ... |
src/include/pw3270cpp.h
... | ... | @@ -180,12 +180,8 @@ |
180 | 180 | virtual string get_display_charset(void); |
181 | 181 | |
182 | 182 | // Connection & Network |
183 | - int connect(const char *host, time_t wait = 0); | |
183 | + virtual int connect(const char *host = "", time_t wait = 0) = 0; | |
184 | 184 | int set_host(const char *host); |
185 | - virtual int connect(void) = 0; | |
186 | - | |
187 | - virtual int set_url(const char *hostname) = 0; | |
188 | - virtual string get_url() = 0; | |
189 | 185 | |
190 | 186 | virtual int disconnect(void) = 0; |
191 | 187 | virtual int wait_for_ready(int seconds) = 0; | ... | ... |
src/lib3270/connect.c
... | ... | @@ -180,6 +180,19 @@ static void net_connected(H3270 *hSession, int fd, LIB3270_IO_FLAG flag, void *d |
180 | 180 | } |
181 | 181 | #endif // WIN32 |
182 | 182 | |
183 | + LIB3270_EXPORT int lib3270_connect_url(H3270 *hSession, const char *url, int wait) | |
184 | + { | |
185 | + CHECK_SESSION_HANDLE(hSession); | |
186 | + | |
187 | + if(url && *url) | |
188 | + { | |
189 | + lib3270_set_url(hSession,url); | |
190 | + } | |
191 | + | |
192 | + return lib3270_connect(hSession, wait); | |
193 | + | |
194 | + } | |
195 | + | |
183 | 196 | LIB3270_EXPORT int lib3270_connect_host(H3270 *hSession, const char *hostname, const char *srvc, LIB3270_OPTION opt) |
184 | 197 | { |
185 | 198 | CHECK_SESSION_HANDLE(hSession); | ... | ... |