Commit 11f4b82e3cd5786d0c08fa96c782d0ba751b891c
1 parent
6c517eb6
Exists in
master
and in
5 other branches
Migração para multi-sessão, mais ajustes. Migrando gtkbox para versão 3
Showing
7 changed files
with
164 additions
and
128 deletions
Show diff stats
src/include/lib3270/session.h
| @@ -36,6 +36,7 @@ | @@ -36,6 +36,7 @@ | ||
| 36 | 36 | ||
| 37 | #define LIB3270_LUNAME_LENGTH 16 | 37 | #define LIB3270_LUNAME_LENGTH 16 |
| 38 | #define LIB3270_FULL_MODEL_NAME_LENGTH 13 | 38 | #define LIB3270_FULL_MODEL_NAME_LENGTH 13 |
| 39 | + #define LIB3270_LU_MAX 32 | ||
| 39 | 40 | ||
| 40 | #define LIB3270_TELNET_N_OPTS 256 | 41 | #define LIB3270_TELNET_N_OPTS 256 |
| 41 | 42 | ||
| @@ -207,6 +208,8 @@ | @@ -207,6 +208,8 @@ | ||
| 207 | char * proxy_host; | 208 | char * proxy_host; |
| 208 | char * proxy_portname; | 209 | char * proxy_portname; |
| 209 | unsigned short proxy_port; | 210 | unsigned short proxy_port; |
| 211 | + char reported_lu[LIB3270_LU_MAX+1]; | ||
| 212 | + char reported_type[LIB3270_LU_MAX+1]; | ||
| 210 | 213 | ||
| 211 | enum | 214 | enum |
| 212 | { | 215 | { |
src/lib3270/telnet.c
| @@ -215,14 +215,14 @@ static void check_linemode(H3270 *hSession, Boolean init); | @@ -215,14 +215,14 @@ static void check_linemode(H3270 *hSession, Boolean init); | ||
| 215 | static int non_blocking(H3270 *session, Boolean on); | 215 | static int non_blocking(H3270 *session, Boolean on); |
| 216 | static void net_connected(H3270 *session); | 216 | static void net_connected(H3270 *session); |
| 217 | #if defined(X3270_TN3270E) /*[*/ | 217 | #if defined(X3270_TN3270E) /*[*/ |
| 218 | -static int tn3270e_negotiate(void); | 218 | +static int tn3270e_negotiate(H3270 *hSession); |
| 219 | #endif /*]*/ | 219 | #endif /*]*/ |
| 220 | static int process_eor(void); | 220 | static int process_eor(void); |
| 221 | #if defined(X3270_TN3270E) /*[*/ | 221 | #if defined(X3270_TN3270E) /*[*/ |
| 222 | #if defined(X3270_TRACE) /*[*/ | 222 | #if defined(X3270_TRACE) /*[*/ |
| 223 | static const char *tn3270e_function_names(const unsigned char *, int); | 223 | static const char *tn3270e_function_names(const unsigned char *, int); |
| 224 | #endif /*]*/ | 224 | #endif /*]*/ |
| 225 | -static void tn3270e_subneg_send(unsigned char, unsigned long); | 225 | +static void tn3270e_subneg_send(H3270 *hSession, unsigned char, unsigned long); |
| 226 | static unsigned long tn3270e_fdecode(const unsigned char *, int); | 226 | static unsigned long tn3270e_fdecode(const unsigned char *, int); |
| 227 | static void tn3270e_ack(void); | 227 | static void tn3270e_ack(void); |
| 228 | static void tn3270e_nak(enum pds); | 228 | static void tn3270e_nak(enum pds); |
| @@ -240,7 +240,7 @@ static void do_eof(char c); | @@ -240,7 +240,7 @@ static void do_eof(char c); | ||
| 240 | static void do_eol(char c); | 240 | static void do_eol(char c); |
| 241 | static void do_lnext(char c); | 241 | static void do_lnext(char c); |
| 242 | static char parse_ctlchar(char *s); | 242 | static char parse_ctlchar(char *s); |
| 243 | -static void cooked_init(void); | 243 | +static void cooked_init(H3270 *hSession); |
| 244 | #endif /*]*/ | 244 | #endif /*]*/ |
| 245 | 245 | ||
| 246 | #if defined(X3270_TRACE) /*[*/ | 246 | #if defined(X3270_TRACE) /*[*/ |
| @@ -1149,8 +1149,7 @@ set16(char *buf, int n) | @@ -1149,8 +1149,7 @@ set16(char *buf, int n) | ||
| 1149 | * send_naws | 1149 | * send_naws |
| 1150 | * Send a Telnet window size sub-option negotation. | 1150 | * Send a Telnet window size sub-option negotation. |
| 1151 | */ | 1151 | */ |
| 1152 | -static void | ||
| 1153 | -send_naws(void) | 1152 | +static void send_naws(H3270 *hSession) |
| 1154 | { | 1153 | { |
| 1155 | char naws_msg[14]; | 1154 | char naws_msg[14]; |
| 1156 | int naws_len = 0; | 1155 | int naws_len = 0; |
| @@ -1161,18 +1160,17 @@ send_naws(void) | @@ -1161,18 +1160,17 @@ send_naws(void) | ||
| 1161 | naws_len += set16(naws_msg + naws_len, XMIT_ROWS); | 1160 | naws_len += set16(naws_msg + naws_len, XMIT_ROWS); |
| 1162 | (void) sprintf(naws_msg + naws_len, "%c%c", IAC, SE); | 1161 | (void) sprintf(naws_msg + naws_len, "%c%c", IAC, SE); |
| 1163 | naws_len += 2; | 1162 | naws_len += 2; |
| 1164 | - net_rawout(&h3270,(unsigned char *)naws_msg, naws_len); | 1163 | + net_rawout(hSession,(unsigned char *)naws_msg, naws_len); |
| 1165 | trace_dsn("SENT %s NAWS %d %d %s\n", cmd(SB), XMIT_COLS, XMIT_ROWS, cmd(SE)); | 1164 | trace_dsn("SENT %s NAWS %d %d %s\n", cmd(SB), XMIT_COLS, XMIT_ROWS, cmd(SE)); |
| 1166 | } | 1165 | } |
| 1167 | 1166 | ||
| 1168 | 1167 | ||
| 1169 | 1168 | ||
| 1170 | /* Advance 'try_lu' to the next desired LU name. */ | 1169 | /* Advance 'try_lu' to the next desired LU name. */ |
| 1171 | -static void | ||
| 1172 | -next_lu(void) | 1170 | +static void next_lu(H3270 *hSession) |
| 1173 | { | 1171 | { |
| 1174 | - if (h3270.curr_lu != (char **)NULL && (h3270.try_lu = *++h3270.curr_lu) == CN) | ||
| 1175 | - h3270.curr_lu = (char **)NULL; | 1172 | + if (hSession->curr_lu != (char **)NULL && (hSession->try_lu = *++hSession->curr_lu) == CN) |
| 1173 | + hSession->curr_lu = (char **)NULL; | ||
| 1176 | } | 1174 | } |
| 1177 | 1175 | ||
| 1178 | /* | 1176 | /* |
| @@ -1202,7 +1200,7 @@ static int telnet_fsm(H3270 *session, unsigned char c) | @@ -1202,7 +1200,7 @@ static int telnet_fsm(H3270 *session, unsigned char c) | ||
| 1202 | if (IN_NEITHER) { /* now can assume ANSI mode */ | 1200 | if (IN_NEITHER) { /* now can assume ANSI mode */ |
| 1203 | #if defined(X3270_ANSI)/*[*/ | 1201 | #if defined(X3270_ANSI)/*[*/ |
| 1204 | if (session->linemode) | 1202 | if (session->linemode) |
| 1205 | - cooked_init(); | 1203 | + cooked_init(session); |
| 1206 | #endif /*]*/ | 1204 | #endif /*]*/ |
| 1207 | host_in3270(session,CONNECTED_ANSI); | 1205 | host_in3270(session,CONNECTED_ANSI); |
| 1208 | kybdlock_clr(session,KL_AWAITING_FIRST, "telnet_fsm"); | 1206 | kybdlock_clr(session,KL_AWAITING_FIRST, "telnet_fsm"); |
| @@ -1393,7 +1391,7 @@ static int telnet_fsm(H3270 *session, unsigned char c) | @@ -1393,7 +1391,7 @@ static int telnet_fsm(H3270 *session, unsigned char c) | ||
| 1393 | check_linemode(&h3270,False); | 1391 | check_linemode(&h3270,False); |
| 1394 | } | 1392 | } |
| 1395 | if (c == TELOPT_NAWS) | 1393 | if (c == TELOPT_NAWS) |
| 1396 | - send_naws(); | 1394 | + send_naws(&h3270); |
| 1397 | #if defined(HAVE_LIBSSL) /*[*/ | 1395 | #if defined(HAVE_LIBSSL) /*[*/ |
| 1398 | if (c == TELOPT_STARTTLS) { | 1396 | if (c == TELOPT_STARTTLS) { |
| 1399 | static unsigned char follows_msg[] = { | 1397 | static unsigned char follows_msg[] = { |
| @@ -1485,12 +1483,12 @@ static int telnet_fsm(H3270 *session, unsigned char c) | @@ -1485,12 +1483,12 @@ static int telnet_fsm(H3270 *session, unsigned char c) | ||
| 1485 | lib3270_free(tt_out); | 1483 | lib3270_free(tt_out); |
| 1486 | 1484 | ||
| 1487 | /* Advance to the next LU name. */ | 1485 | /* Advance to the next LU name. */ |
| 1488 | - next_lu(); | 1486 | + next_lu(&h3270); |
| 1489 | } | 1487 | } |
| 1490 | #if defined(X3270_TN3270E) /*[*/ | 1488 | #if defined(X3270_TN3270E) /*[*/ |
| 1491 | else if (h3270.myopts[TELOPT_TN3270E] && | 1489 | else if (h3270.myopts[TELOPT_TN3270E] && |
| 1492 | h3270.sbbuf[0] == TELOPT_TN3270E) { | 1490 | h3270.sbbuf[0] == TELOPT_TN3270E) { |
| 1493 | - if (tn3270e_negotiate()) | 1491 | + if (tn3270e_negotiate(&h3270)) |
| 1494 | return -1; | 1492 | return -1; |
| 1495 | } | 1493 | } |
| 1496 | #endif /*]*/ | 1494 | #endif /*]*/ |
| @@ -1575,35 +1573,35 @@ backoff_tn3270e(const char *why) | @@ -1575,35 +1573,35 @@ backoff_tn3270e(const char *why) | ||
| 1575 | * Negotiation of TN3270E options. | 1573 | * Negotiation of TN3270E options. |
| 1576 | * Returns 0 if okay, -1 if we have to give up altogether. | 1574 | * Returns 0 if okay, -1 if we have to give up altogether. |
| 1577 | */ | 1575 | */ |
| 1578 | -static int | ||
| 1579 | -tn3270e_negotiate(void) | 1576 | +static int tn3270e_negotiate(H3270 *hSession) |
| 1580 | { | 1577 | { |
| 1581 | -#define LU_MAX 32 | ||
| 1582 | - static char reported_lu[LU_MAX+1]; | ||
| 1583 | - static char reported_type[LU_MAX+1]; | 1578 | +// #define LU_MAX 32 |
| 1579 | +// static char reported_lu[LU_MAX+1]; | ||
| 1580 | +// static char reported_type[LU_MAX+1]; | ||
| 1581 | + | ||
| 1584 | int sblen; | 1582 | int sblen; |
| 1585 | unsigned long e_rcvd; | 1583 | unsigned long e_rcvd; |
| 1586 | 1584 | ||
| 1587 | /* Find out how long the subnegotiation buffer is. */ | 1585 | /* Find out how long the subnegotiation buffer is. */ |
| 1588 | for (sblen = 0; ; sblen++) { | 1586 | for (sblen = 0; ; sblen++) { |
| 1589 | - if (h3270.sbbuf[sblen] == SE) | 1587 | + if (hSession->sbbuf[sblen] == SE) |
| 1590 | break; | 1588 | break; |
| 1591 | } | 1589 | } |
| 1592 | 1590 | ||
| 1593 | trace_dsn("TN3270E "); | 1591 | trace_dsn("TN3270E "); |
| 1594 | 1592 | ||
| 1595 | - switch (h3270.sbbuf[1]) { | 1593 | + switch (hSession->sbbuf[1]) { |
| 1596 | 1594 | ||
| 1597 | case TN3270E_OP_SEND: | 1595 | case TN3270E_OP_SEND: |
| 1598 | 1596 | ||
| 1599 | - if (h3270.sbbuf[2] == TN3270E_OP_DEVICE_TYPE) { | 1597 | + if (hSession->sbbuf[2] == TN3270E_OP_DEVICE_TYPE) { |
| 1600 | 1598 | ||
| 1601 | /* Host wants us to send our device type. */ | 1599 | /* Host wants us to send our device type. */ |
| 1602 | trace_dsn("SEND DEVICE-TYPE SE\n"); | 1600 | trace_dsn("SEND DEVICE-TYPE SE\n"); |
| 1603 | 1601 | ||
| 1604 | tn3270e_request(); | 1602 | tn3270e_request(); |
| 1605 | } else { | 1603 | } else { |
| 1606 | - trace_dsn("SEND ??%u SE\n", h3270.sbbuf[2]); | 1604 | + trace_dsn("SEND ??%u SE\n", hSession->sbbuf[2]); |
| 1607 | } | 1605 | } |
| 1608 | break; | 1606 | break; |
| 1609 | 1607 | ||
| @@ -1612,7 +1610,7 @@ tn3270e_negotiate(void) | @@ -1612,7 +1610,7 @@ tn3270e_negotiate(void) | ||
| 1612 | /* Device type negotiation. */ | 1610 | /* Device type negotiation. */ |
| 1613 | trace_dsn("DEVICE-TYPE "); | 1611 | trace_dsn("DEVICE-TYPE "); |
| 1614 | 1612 | ||
| 1615 | - switch (h3270.sbbuf[2]) { | 1613 | + switch (hSession->sbbuf[2]) { |
| 1616 | case TN3270E_OP_IS: { | 1614 | case TN3270E_OP_IS: { |
| 1617 | int tnlen, snlen; | 1615 | int tnlen, snlen; |
| 1618 | 1616 | ||
| @@ -1620,57 +1618,55 @@ tn3270e_negotiate(void) | @@ -1620,57 +1618,55 @@ tn3270e_negotiate(void) | ||
| 1620 | 1618 | ||
| 1621 | /* Isolate the terminal type and session. */ | 1619 | /* Isolate the terminal type and session. */ |
| 1622 | tnlen = 0; | 1620 | tnlen = 0; |
| 1623 | - while (h3270.sbbuf[3+tnlen] != SE && | ||
| 1624 | - h3270.sbbuf[3+tnlen] != TN3270E_OP_CONNECT) | 1621 | + while (hSession->sbbuf[3+tnlen] != SE && |
| 1622 | + hSession->sbbuf[3+tnlen] != TN3270E_OP_CONNECT) | ||
| 1625 | tnlen++; | 1623 | tnlen++; |
| 1626 | snlen = 0; | 1624 | snlen = 0; |
| 1627 | - if (h3270.sbbuf[3+tnlen] == TN3270E_OP_CONNECT) { | ||
| 1628 | - while(h3270.sbbuf[3+tnlen+1+snlen] != SE) | 1625 | + if (hSession->sbbuf[3+tnlen] == TN3270E_OP_CONNECT) { |
| 1626 | + while(hSession->sbbuf[3+tnlen+1+snlen] != SE) | ||
| 1629 | snlen++; | 1627 | snlen++; |
| 1630 | } | 1628 | } |
| 1631 | trace_dsn("IS %.*s CONNECT %.*s SE\n", | 1629 | trace_dsn("IS %.*s CONNECT %.*s SE\n", |
| 1632 | - tnlen, &h3270.sbbuf[3], | ||
| 1633 | - snlen, &h3270.sbbuf[3+tnlen+1]); | 1630 | + tnlen, &hSession->sbbuf[3], |
| 1631 | + snlen, &hSession->sbbuf[3+tnlen+1]); | ||
| 1634 | 1632 | ||
| 1635 | /* Remember the LU. */ | 1633 | /* Remember the LU. */ |
| 1636 | if (tnlen) { | 1634 | if (tnlen) { |
| 1637 | - if (tnlen > LU_MAX) | ||
| 1638 | - tnlen = LU_MAX; | ||
| 1639 | - (void)strncpy(reported_type, | ||
| 1640 | - (char *)&h3270.sbbuf[3], tnlen); | ||
| 1641 | - reported_type[tnlen] = '\0'; | ||
| 1642 | - h3270.connected_type = reported_type; | 1635 | + if (tnlen > LIB3270_LU_MAX) |
| 1636 | + tnlen = LIB3270_LU_MAX; | ||
| 1637 | + (void)strncpy(hSession->reported_type,(char *)&hSession->sbbuf[3], tnlen); | ||
| 1638 | + hSession->reported_type[tnlen] = '\0'; | ||
| 1639 | + hSession->connected_type = hSession->reported_type; | ||
| 1643 | } | 1640 | } |
| 1644 | if (snlen) { | 1641 | if (snlen) { |
| 1645 | - if (snlen > LU_MAX) | ||
| 1646 | - snlen = LU_MAX; | ||
| 1647 | - (void)strncpy(reported_lu, | ||
| 1648 | - (char *)&h3270.sbbuf[3+tnlen+1], snlen); | ||
| 1649 | - reported_lu[snlen] = '\0'; | ||
| 1650 | - h3270.connected_lu = reported_lu; | ||
| 1651 | - status_lu(&h3270,h3270.connected_lu); | 1642 | + if (snlen > LIB3270_LU_MAX) |
| 1643 | + snlen = LIB3270_LU_MAX; | ||
| 1644 | + (void)strncpy(hSession->reported_lu,(char *)&hSession->sbbuf[3+tnlen+1], snlen); | ||
| 1645 | + hSession->reported_lu[snlen] = '\0'; | ||
| 1646 | + hSession->connected_lu = hSession->reported_lu; | ||
| 1647 | + status_lu(hSession,hSession->connected_lu); | ||
| 1652 | } | 1648 | } |
| 1653 | 1649 | ||
| 1654 | /* Tell them what we can do. */ | 1650 | /* Tell them what we can do. */ |
| 1655 | - tn3270e_subneg_send(TN3270E_OP_REQUEST, h3270.e_funcs); | 1651 | + tn3270e_subneg_send(hSession, TN3270E_OP_REQUEST, hSession->e_funcs); |
| 1656 | break; | 1652 | break; |
| 1657 | } | 1653 | } |
| 1658 | case TN3270E_OP_REJECT: | 1654 | case TN3270E_OP_REJECT: |
| 1659 | 1655 | ||
| 1660 | /* Device type failure. */ | 1656 | /* Device type failure. */ |
| 1661 | 1657 | ||
| 1662 | - trace_dsn("REJECT REASON %s SE\n", rsn(h3270.sbbuf[4])); | ||
| 1663 | - if (h3270.sbbuf[4] == TN3270E_REASON_INV_DEVICE_TYPE || | ||
| 1664 | - h3270.sbbuf[4] == TN3270E_REASON_UNSUPPORTED_REQ) { | 1658 | + trace_dsn("REJECT REASON %s SE\n", rsn(hSession->sbbuf[4])); |
| 1659 | + if (hSession->sbbuf[4] == TN3270E_REASON_INV_DEVICE_TYPE || | ||
| 1660 | + hSession->sbbuf[4] == TN3270E_REASON_UNSUPPORTED_REQ) { | ||
| 1665 | backoff_tn3270e(_( "Host rejected device type or request type" )); | 1661 | backoff_tn3270e(_( "Host rejected device type or request type" )); |
| 1666 | break; | 1662 | break; |
| 1667 | } | 1663 | } |
| 1668 | 1664 | ||
| 1669 | - next_lu(); | ||
| 1670 | - if (h3270.try_lu != CN) { | 1665 | + next_lu(hSession); |
| 1666 | + if (hSession->try_lu != CN) { | ||
| 1671 | /* Try the next LU. */ | 1667 | /* Try the next LU. */ |
| 1672 | tn3270e_request(); | 1668 | tn3270e_request(); |
| 1673 | - } else if (h3270.lus != (char **)NULL) { | 1669 | + } else if (hSession->lus != (char **)NULL) { |
| 1674 | /* No more LUs to try. Give up. */ | 1670 | /* No more LUs to try. Give up. */ |
| 1675 | backoff_tn3270e(_("Host rejected resource(s)")); | 1671 | backoff_tn3270e(_("Host rejected resource(s)")); |
| 1676 | } else { | 1672 | } else { |
| @@ -1679,7 +1675,7 @@ tn3270e_negotiate(void) | @@ -1679,7 +1675,7 @@ tn3270e_negotiate(void) | ||
| 1679 | 1675 | ||
| 1680 | break; | 1676 | break; |
| 1681 | default: | 1677 | default: |
| 1682 | - trace_dsn("??%u SE\n", h3270.sbbuf[2]); | 1678 | + trace_dsn("??%u SE\n", hSession->sbbuf[2]); |
| 1683 | break; | 1679 | break; |
| 1684 | } | 1680 | } |
| 1685 | break; | 1681 | break; |
| @@ -1689,46 +1685,45 @@ tn3270e_negotiate(void) | @@ -1689,46 +1685,45 @@ tn3270e_negotiate(void) | ||
| 1689 | /* Functions negotiation. */ | 1685 | /* Functions negotiation. */ |
| 1690 | trace_dsn("FUNCTIONS "); | 1686 | trace_dsn("FUNCTIONS "); |
| 1691 | 1687 | ||
| 1692 | - switch (h3270.sbbuf[2]) { | 1688 | + switch (hSession->sbbuf[2]) { |
| 1693 | 1689 | ||
| 1694 | case TN3270E_OP_REQUEST: | 1690 | case TN3270E_OP_REQUEST: |
| 1695 | 1691 | ||
| 1696 | /* Host is telling us what functions they want. */ | 1692 | /* Host is telling us what functions they want. */ |
| 1697 | trace_dsn("REQUEST %s SE\n", | 1693 | trace_dsn("REQUEST %s SE\n", |
| 1698 | - tn3270e_function_names(h3270.sbbuf+3, sblen-3)); | 1694 | + tn3270e_function_names(hSession->sbbuf+3, sblen-3)); |
| 1699 | 1695 | ||
| 1700 | - e_rcvd = tn3270e_fdecode(h3270.sbbuf+3, sblen-3); | ||
| 1701 | - if ((e_rcvd == h3270.e_funcs) || (h3270.e_funcs & ~e_rcvd)) { | 1696 | + e_rcvd = tn3270e_fdecode(hSession->sbbuf+3, sblen-3); |
| 1697 | + if ((e_rcvd == hSession->e_funcs) || (hSession->e_funcs & ~e_rcvd)) { | ||
| 1702 | /* They want what we want, or less. Done. */ | 1698 | /* They want what we want, or less. Done. */ |
| 1703 | - h3270.e_funcs = e_rcvd; | ||
| 1704 | - tn3270e_subneg_send(TN3270E_OP_IS, h3270.e_funcs); | ||
| 1705 | - h3270.tn3270e_negotiated = 1; | 1699 | + hSession->e_funcs = e_rcvd; |
| 1700 | + tn3270e_subneg_send(hSession, TN3270E_OP_IS, hSession->e_funcs); | ||
| 1701 | + hSession->tn3270e_negotiated = 1; | ||
| 1706 | trace_dsn("TN3270E option negotiation complete.\n"); | 1702 | trace_dsn("TN3270E option negotiation complete.\n"); |
| 1707 | - check_in3270(&h3270); | 1703 | + check_in3270(hSession); |
| 1708 | } else { | 1704 | } else { |
| 1709 | /* | 1705 | /* |
| 1710 | * They want us to do something we can't. | 1706 | * They want us to do something we can't. |
| 1711 | * Request the common subset. | 1707 | * Request the common subset. |
| 1712 | */ | 1708 | */ |
| 1713 | - h3270.e_funcs &= e_rcvd; | ||
| 1714 | - tn3270e_subneg_send(TN3270E_OP_REQUEST,h3270.e_funcs); | 1709 | + hSession->e_funcs &= e_rcvd; |
| 1710 | + tn3270e_subneg_send(hSession, TN3270E_OP_REQUEST,hSession->e_funcs); | ||
| 1715 | } | 1711 | } |
| 1716 | break; | 1712 | break; |
| 1717 | 1713 | ||
| 1718 | case TN3270E_OP_IS: | 1714 | case TN3270E_OP_IS: |
| 1719 | 1715 | ||
| 1720 | /* They accept our last request, or a subset thereof. */ | 1716 | /* They accept our last request, or a subset thereof. */ |
| 1721 | - trace_dsn("IS %s SE\n", | ||
| 1722 | - tn3270e_function_names(h3270.sbbuf+3, sblen-3)); | ||
| 1723 | - e_rcvd = tn3270e_fdecode(h3270.sbbuf+3, sblen-3); | ||
| 1724 | - if (e_rcvd != h3270.e_funcs) { | ||
| 1725 | - if (h3270.e_funcs & ~e_rcvd) { | 1717 | + trace_dsn("IS %s SE\n",tn3270e_function_names(hSession->sbbuf+3, sblen-3)); |
| 1718 | + e_rcvd = tn3270e_fdecode(hSession->sbbuf+3, sblen-3); | ||
| 1719 | + if (e_rcvd != hSession->e_funcs) { | ||
| 1720 | + if (hSession->e_funcs & ~e_rcvd) { | ||
| 1726 | /* | 1721 | /* |
| 1727 | * They've removed something. This is | 1722 | * They've removed something. This is |
| 1728 | * technically illegal, but we can | 1723 | * technically illegal, but we can |
| 1729 | * live with it. | 1724 | * live with it. |
| 1730 | */ | 1725 | */ |
| 1731 | - h3270.e_funcs = e_rcvd; | 1726 | + hSession->e_funcs = e_rcvd; |
| 1732 | } else { | 1727 | } else { |
| 1733 | /* | 1728 | /* |
| 1734 | * They've added something. Abandon | 1729 | * They've added something. Abandon |
| @@ -1738,19 +1733,19 @@ tn3270e_negotiate(void) | @@ -1738,19 +1733,19 @@ tn3270e_negotiate(void) | ||
| 1738 | break; | 1733 | break; |
| 1739 | } | 1734 | } |
| 1740 | } | 1735 | } |
| 1741 | - h3270.tn3270e_negotiated = 1; | 1736 | + hSession->tn3270e_negotiated = 1; |
| 1742 | trace_dsn("TN3270E option negotiation complete.\n"); | 1737 | trace_dsn("TN3270E option negotiation complete.\n"); |
| 1743 | - check_in3270(&h3270); | 1738 | + check_in3270(hSession); |
| 1744 | break; | 1739 | break; |
| 1745 | 1740 | ||
| 1746 | default: | 1741 | default: |
| 1747 | - trace_dsn("??%u SE\n", h3270.sbbuf[2]); | 1742 | + trace_dsn("??%u SE\n", hSession->sbbuf[2]); |
| 1748 | break; | 1743 | break; |
| 1749 | } | 1744 | } |
| 1750 | break; | 1745 | break; |
| 1751 | 1746 | ||
| 1752 | default: | 1747 | default: |
| 1753 | - trace_dsn("??%u SE\n", h3270.sbbuf[1]); | 1748 | + trace_dsn("??%u SE\n", hSession->sbbuf[1]); |
| 1754 | } | 1749 | } |
| 1755 | 1750 | ||
| 1756 | /* Good enough for now. */ | 1751 | /* Good enough for now. */ |
| @@ -1776,7 +1771,7 @@ tn3270e_function_names(const unsigned char *buf, int len) | @@ -1776,7 +1771,7 @@ tn3270e_function_names(const unsigned char *buf, int len) | ||
| 1776 | } | 1771 | } |
| 1777 | #endif /*]*/ | 1772 | #endif /*]*/ |
| 1778 | 1773 | ||
| 1779 | -/* Expand the current TN3270E function codes into text. */ | 1774 | +/* Expand the current TN3270E function codes into text. */ /* |
| 1780 | const char * | 1775 | const char * |
| 1781 | tn3270e_current_opts(void) | 1776 | tn3270e_current_opts(void) |
| 1782 | { | 1777 | { |
| @@ -1793,10 +1788,10 @@ tn3270e_current_opts(void) | @@ -1793,10 +1788,10 @@ tn3270e_current_opts(void) | ||
| 1793 | } | 1788 | } |
| 1794 | return text_buf; | 1789 | return text_buf; |
| 1795 | } | 1790 | } |
| 1791 | +*/ | ||
| 1796 | 1792 | ||
| 1797 | /* Transmit a TN3270E FUNCTIONS REQUEST or FUNCTIONS IS message. */ | 1793 | /* Transmit a TN3270E FUNCTIONS REQUEST or FUNCTIONS IS message. */ |
| 1798 | -static void | ||
| 1799 | -tn3270e_subneg_send(unsigned char op, unsigned long funcs) | 1794 | +static void tn3270e_subneg_send(H3270 *hSession, unsigned char op, unsigned long funcs) |
| 1800 | { | 1795 | { |
| 1801 | unsigned char proto_buf[7 + 32]; | 1796 | unsigned char proto_buf[7 + 32]; |
| 1802 | int proto_len; | 1797 | int proto_len; |
| @@ -1814,7 +1809,7 @@ tn3270e_subneg_send(unsigned char op, unsigned long funcs) | @@ -1814,7 +1809,7 @@ tn3270e_subneg_send(unsigned char op, unsigned long funcs) | ||
| 1814 | /* Complete and send out the protocol message. */ | 1809 | /* Complete and send out the protocol message. */ |
| 1815 | proto_buf[proto_len++] = IAC; | 1810 | proto_buf[proto_len++] = IAC; |
| 1816 | proto_buf[proto_len++] = SE; | 1811 | proto_buf[proto_len++] = SE; |
| 1817 | - net_rawout(&h3270, proto_buf, proto_len); | 1812 | + net_rawout(hSession, proto_buf, proto_len); |
| 1818 | 1813 | ||
| 1819 | /* Complete and send out the trace text. */ | 1814 | /* Complete and send out the trace text. */ |
| 1820 | trace_dsn("SENT %s %s FUNCTIONS %s %s %s\n", | 1815 | trace_dsn("SENT %s %s FUNCTIONS %s %s %s\n", |
| @@ -1841,12 +1836,11 @@ tn3270e_fdecode(const unsigned char *buf, int len) | @@ -1841,12 +1836,11 @@ tn3270e_fdecode(const unsigned char *buf, int len) | ||
| 1841 | #endif /*]*/ | 1836 | #endif /*]*/ |
| 1842 | 1837 | ||
| 1843 | #if defined(X3270_TN3270E) /*[*/ | 1838 | #if defined(X3270_TN3270E) /*[*/ |
| 1844 | -static void | ||
| 1845 | -process_bind(unsigned char *buf, int buflen) | 1839 | +static void process_bind(H3270 *hSession, unsigned char *buf, int buflen) |
| 1846 | { | 1840 | { |
| 1847 | int namelen, i; | 1841 | int namelen, i; |
| 1848 | 1842 | ||
| 1849 | - (void) memset(h3270.plu_name, '\0', sizeof(h3270.plu_name)); | 1843 | + (void) memset(hSession->plu_name, '\0', sizeof(hSession->plu_name)); |
| 1850 | 1844 | ||
| 1851 | /* Make sure it's a BIND. */ | 1845 | /* Make sure it's a BIND. */ |
| 1852 | if (buflen < 1 || buf[0] != BIND_RU) { | 1846 | if (buflen < 1 || buf[0] != BIND_RU) { |
| @@ -1862,7 +1856,7 @@ process_bind(unsigned char *buf, int buflen) | @@ -1862,7 +1856,7 @@ process_bind(unsigned char *buf, int buflen) | ||
| 1862 | if (namelen > BIND_PLU_NAME_MAX) | 1856 | if (namelen > BIND_PLU_NAME_MAX) |
| 1863 | namelen = BIND_PLU_NAME_MAX; | 1857 | namelen = BIND_PLU_NAME_MAX; |
| 1864 | for (i = 0; i < namelen; i++) { | 1858 | for (i = 0; i < namelen; i++) { |
| 1865 | - h3270.plu_name[i] = ebc2asc0[buf[BIND_OFF_PLU_NAME + i]]; | 1859 | + hSession->plu_name[i] = ebc2asc0[buf[BIND_OFF_PLU_NAME + i]]; |
| 1866 | } | 1860 | } |
| 1867 | } | 1861 | } |
| 1868 | #endif /*]*/ | 1862 | #endif /*]*/ |
| @@ -1906,7 +1900,7 @@ process_eor(void) | @@ -1906,7 +1900,7 @@ process_eor(void) | ||
| 1906 | case TN3270E_DT_BIND_IMAGE: | 1900 | case TN3270E_DT_BIND_IMAGE: |
| 1907 | if (!(h3270.e_funcs & E_OPT(TN3270E_FUNC_BIND_IMAGE))) | 1901 | if (!(h3270.e_funcs & E_OPT(TN3270E_FUNC_BIND_IMAGE))) |
| 1908 | return 0; | 1902 | return 0; |
| 1909 | - process_bind(h3270.ibuf + EH_SIZE, (h3270.ibptr - h3270.ibuf) - EH_SIZE); | 1903 | + process_bind(&h3270, h3270.ibuf + EH_SIZE, (h3270.ibptr - h3270.ibuf) - EH_SIZE); |
| 1910 | trace_dsn("< BIND PLU-name '%s'\n", h3270.plu_name); | 1904 | trace_dsn("< BIND PLU-name '%s'\n", h3270.plu_name); |
| 1911 | h3270.tn3270e_bound = 1; | 1905 | h3270.tn3270e_bound = 1; |
| 1912 | check_in3270(&h3270); | 1906 | check_in3270(&h3270); |
| @@ -2051,14 +2045,14 @@ net_rawout(H3270 *session, unsigned const char *buf, int len) | @@ -2051,14 +2045,14 @@ net_rawout(H3270 *session, unsigned const char *buf, int len) | ||
| 2051 | return; | 2045 | return; |
| 2052 | } | 2046 | } |
| 2053 | } | 2047 | } |
| 2054 | - h3270.ns_bsent += nw; | 2048 | + session->ns_bsent += nw; |
| 2055 | len -= nw; | 2049 | len -= nw; |
| 2056 | buf += nw; | 2050 | buf += nw; |
| 2057 | bot: | 2051 | bot: |
| 2058 | -#if defined(OMTU) /*[*/ | 2052 | +#if defined(OMTU) |
| 2059 | if (pause) | 2053 | if (pause) |
| 2060 | sleep(1); | 2054 | sleep(1); |
| 2061 | -#endif /*]*/ | 2055 | +#endif |
| 2062 | ; | 2056 | ; |
| 2063 | } | 2057 | } |
| 2064 | } | 2058 | } |
| @@ -2069,7 +2063,7 @@ net_rawout(H3270 *session, unsigned const char *buf, int len) | @@ -2069,7 +2063,7 @@ net_rawout(H3270 *session, unsigned const char *buf, int len) | ||
| 2069 | * net_hexansi_out | 2063 | * net_hexansi_out |
| 2070 | * Send uncontrolled user data to the host in ANSI mode, performing IAC | 2064 | * Send uncontrolled user data to the host in ANSI mode, performing IAC |
| 2071 | * and CR quoting as necessary. | 2065 | * and CR quoting as necessary. |
| 2072 | - */ | 2066 | + */ /* |
| 2073 | void | 2067 | void |
| 2074 | net_hexansi_out(unsigned char *buf, int len) | 2068 | net_hexansi_out(unsigned char *buf, int len) |
| 2075 | { | 2069 | { |
| @@ -2079,8 +2073,8 @@ net_hexansi_out(unsigned char *buf, int len) | @@ -2079,8 +2073,8 @@ net_hexansi_out(unsigned char *buf, int len) | ||
| 2079 | if (!len) | 2073 | if (!len) |
| 2080 | return; | 2074 | return; |
| 2081 | 2075 | ||
| 2082 | -#if defined(X3270_TRACE) /*[*/ | ||
| 2083 | - /* Trace the data. */ | 2076 | +#if defined(X3270_TRACE) |
| 2077 | + // Trace the data. | ||
| 2084 | if (lib3270_get_toggle(&h3270,LIB3270_TOGGLE_DS_TRACE)) { | 2078 | if (lib3270_get_toggle(&h3270,LIB3270_TOGGLE_DS_TRACE)) { |
| 2085 | int i; | 2079 | int i; |
| 2086 | 2080 | ||
| @@ -2089,9 +2083,9 @@ net_hexansi_out(unsigned char *buf, int len) | @@ -2089,9 +2083,9 @@ net_hexansi_out(unsigned char *buf, int len) | ||
| 2089 | trace_dsn(" %s", ctl_see((int) *(buf+i))); | 2083 | trace_dsn(" %s", ctl_see((int) *(buf+i))); |
| 2090 | trace_dsn("\n"); | 2084 | trace_dsn("\n"); |
| 2091 | } | 2085 | } |
| 2092 | -#endif /*]*/ | 2086 | +#endif |
| 2093 | 2087 | ||
| 2094 | - /* Expand it. */ | 2088 | + // Expand it |
| 2095 | tbuf = xbuf = (unsigned char *)lib3270_malloc(2*len); | 2089 | tbuf = xbuf = (unsigned char *)lib3270_malloc(2*len); |
| 2096 | while (len) { | 2090 | while (len) { |
| 2097 | unsigned char c = *buf++; | 2091 | unsigned char c = *buf++; |
| @@ -2104,10 +2098,11 @@ net_hexansi_out(unsigned char *buf, int len) | @@ -2104,10 +2098,11 @@ net_hexansi_out(unsigned char *buf, int len) | ||
| 2104 | *tbuf++ = '\0'; | 2098 | *tbuf++ = '\0'; |
| 2105 | } | 2099 | } |
| 2106 | 2100 | ||
| 2107 | - /* Send it to the host. */ | 2101 | + // Send it to the host |
| 2108 | net_rawout(&h3270,xbuf, tbuf - xbuf); | 2102 | net_rawout(&h3270,xbuf, tbuf - xbuf); |
| 2109 | lib3270_free(xbuf); | 2103 | lib3270_free(xbuf); |
| 2110 | } | 2104 | } |
| 2105 | +*/ | ||
| 2111 | 2106 | ||
| 2112 | /* | 2107 | /* |
| 2113 | * net_cookedout | 2108 | * net_cookedout |
| @@ -2195,14 +2190,13 @@ static void net_cookout(H3270 *hSession, const char *buf, int len) | @@ -2195,14 +2190,13 @@ static void net_cookout(H3270 *hSession, const char *buf, int len) | ||
| 2195 | * Cooked mode input processing. | 2190 | * Cooked mode input processing. |
| 2196 | */ | 2191 | */ |
| 2197 | 2192 | ||
| 2198 | -static void | ||
| 2199 | -cooked_init(void) | 2193 | +static void cooked_init(H3270 *hSession) |
| 2200 | { | 2194 | { |
| 2201 | - if (h3270.lbuf == (unsigned char *)NULL) | ||
| 2202 | - h3270.lbuf = (unsigned char *)lib3270_malloc(BUFSZ); | ||
| 2203 | - h3270.lbptr = h3270.lbuf; | ||
| 2204 | - h3270.lnext = 0; | ||
| 2205 | - h3270.backslashed = 0; | 2195 | + if (hSession->lbuf == (unsigned char *)NULL) |
| 2196 | + hSession->lbuf = (unsigned char *)lib3270_malloc(BUFSZ); | ||
| 2197 | + hSession->lbptr = hSession->lbuf; | ||
| 2198 | + hSession->lnext = 0; | ||
| 2199 | + hSession->backslashed = 0; | ||
| 2206 | } | 2200 | } |
| 2207 | 2201 | ||
| 2208 | static void | 2202 | static void |
| @@ -2216,7 +2210,7 @@ static void | @@ -2216,7 +2210,7 @@ static void | ||
| 2216 | forward_data(void) | 2210 | forward_data(void) |
| 2217 | { | 2211 | { |
| 2218 | net_cookedout(&h3270, (char *) h3270.lbuf, h3270.lbptr - h3270.lbuf); | 2212 | net_cookedout(&h3270, (char *) h3270.lbuf, h3270.lbptr - h3270.lbuf); |
| 2219 | - cooked_init(); | 2213 | + cooked_init(&h3270); |
| 2220 | } | 2214 | } |
| 2221 | 2215 | ||
| 2222 | static void | 2216 | static void |
| @@ -2244,7 +2238,7 @@ static void do_intr(H3270 *hSession, char c) | @@ -2244,7 +2238,7 @@ static void do_intr(H3270 *hSession, char c) | ||
| 2244 | return; | 2238 | return; |
| 2245 | } | 2239 | } |
| 2246 | ansi_process_s(ctl_see((int) c)); | 2240 | ansi_process_s(ctl_see((int) c)); |
| 2247 | - cooked_init(); | 2241 | + cooked_init(hSession); |
| 2248 | net_interrupt(); | 2242 | net_interrupt(); |
| 2249 | } | 2243 | } |
| 2250 | 2244 | ||
| @@ -2256,7 +2250,7 @@ static void do_quit(H3270 *hSession, char c) | @@ -2256,7 +2250,7 @@ static void do_quit(H3270 *hSession, char c) | ||
| 2256 | return; | 2250 | return; |
| 2257 | } | 2251 | } |
| 2258 | ansi_process_s(ctl_see((int) c)); | 2252 | ansi_process_s(ctl_see((int) c)); |
| 2259 | - cooked_init(); | 2253 | + cooked_init(hSession); |
| 2260 | net_break(); | 2254 | net_break(); |
| 2261 | } | 2255 | } |
| 2262 | 2256 | ||
| @@ -2422,10 +2416,10 @@ check_in3270(H3270 *session) | @@ -2422,10 +2416,10 @@ check_in3270(H3270 *session) | ||
| 2422 | #endif /*]*/ | 2416 | #endif /*]*/ |
| 2423 | 2417 | ||
| 2424 | #if defined(X3270_TN3270E) /*[*/ | 2418 | #if defined(X3270_TN3270E) /*[*/ |
| 2425 | - if (h3270.myopts[TELOPT_TN3270E]) { | ||
| 2426 | - if (!h3270.tn3270e_negotiated) | 2419 | + if (session->myopts[TELOPT_TN3270E]) { |
| 2420 | + if (!session->tn3270e_negotiated) | ||
| 2427 | new_cstate = CONNECTED_INITIAL_E; | 2421 | new_cstate = CONNECTED_INITIAL_E; |
| 2428 | - else switch (h3270.tn3270e_submode) { | 2422 | + else switch (session->tn3270e_submode) { |
| 2429 | case E_NONE: | 2423 | case E_NONE: |
| 2430 | new_cstate = CONNECTED_INITIAL_E; | 2424 | new_cstate = CONNECTED_INITIAL_E; |
| 2431 | break; | 2425 | break; |
| @@ -2441,11 +2435,11 @@ check_in3270(H3270 *session) | @@ -2441,11 +2435,11 @@ check_in3270(H3270 *session) | ||
| 2441 | } | 2435 | } |
| 2442 | } else | 2436 | } else |
| 2443 | #endif /*]*/ | 2437 | #endif /*]*/ |
| 2444 | - if (h3270.myopts[TELOPT_BINARY] && | ||
| 2445 | - h3270.myopts[TELOPT_EOR] && | ||
| 2446 | - h3270.myopts[TELOPT_TTYPE] && | ||
| 2447 | - h3270.hisopts[TELOPT_BINARY] && | ||
| 2448 | - h3270.hisopts[TELOPT_EOR]) { | 2438 | + if (session->myopts[TELOPT_BINARY] && |
| 2439 | + session->myopts[TELOPT_EOR] && | ||
| 2440 | + session->myopts[TELOPT_TTYPE] && | ||
| 2441 | + session->hisopts[TELOPT_BINARY] && | ||
| 2442 | + session->hisopts[TELOPT_EOR]) { | ||
| 2449 | new_cstate = CONNECTED_3270; | 2443 | new_cstate = CONNECTED_3270; |
| 2450 | } else if (session->cstate == CONNECTED_INITIAL) { | 2444 | } else if (session->cstate == CONNECTED_INITIAL) { |
| 2451 | /* Nothing has happened, yet. */ | 2445 | /* Nothing has happened, yet. */ |
| @@ -2465,33 +2459,33 @@ check_in3270(H3270 *session) | @@ -2465,33 +2459,33 @@ check_in3270(H3270 *session) | ||
| 2465 | * TN3270E mode, reset the LU list so we can try again | 2459 | * TN3270E mode, reset the LU list so we can try again |
| 2466 | * in the new mode. | 2460 | * in the new mode. |
| 2467 | */ | 2461 | */ |
| 2468 | - if (h3270.lus != (char **)NULL && was_in_e != IN_E) { | ||
| 2469 | - h3270.curr_lu = h3270.lus; | ||
| 2470 | - h3270.try_lu = *h3270.curr_lu; | 2462 | + if (session->lus != (char **)NULL && was_in_e != IN_E) { |
| 2463 | + session->curr_lu = session->lus; | ||
| 2464 | + session->try_lu = *session->curr_lu; | ||
| 2471 | } | 2465 | } |
| 2472 | #endif /*]*/ | 2466 | #endif /*]*/ |
| 2473 | 2467 | ||
| 2474 | /* Allocate the initial 3270 input buffer. */ | 2468 | /* Allocate the initial 3270 input buffer. */ |
| 2475 | - if(new_cstate >= CONNECTED_INITIAL && !(h3270.ibuf_size && h3270.ibuf)) | 2469 | + if(new_cstate >= CONNECTED_INITIAL && !(session->ibuf_size && session->ibuf)) |
| 2476 | { | 2470 | { |
| 2477 | - h3270.ibuf = (unsigned char *) lib3270_malloc(BUFSIZ); | ||
| 2478 | - h3270.ibuf_size = BUFSIZ; | ||
| 2479 | - h3270.ibptr = h3270.ibuf; | 2471 | + session->ibuf = (unsigned char *) lib3270_malloc(BUFSIZ); |
| 2472 | + session->ibuf_size = BUFSIZ; | ||
| 2473 | + session->ibptr = session->ibuf; | ||
| 2480 | } | 2474 | } |
| 2481 | 2475 | ||
| 2482 | #if defined(X3270_ANSI) /*[*/ | 2476 | #if defined(X3270_ANSI) /*[*/ |
| 2483 | /* Reinitialize line mode. */ | 2477 | /* Reinitialize line mode. */ |
| 2484 | - if ((new_cstate == CONNECTED_ANSI && h3270.linemode) || | 2478 | + if ((new_cstate == CONNECTED_ANSI && session->linemode) || |
| 2485 | new_cstate == CONNECTED_NVT) | 2479 | new_cstate == CONNECTED_NVT) |
| 2486 | - cooked_init(); | 2480 | + cooked_init(session); |
| 2487 | #endif /*]*/ | 2481 | #endif /*]*/ |
| 2488 | 2482 | ||
| 2489 | #if defined(X3270_TN3270E) /*[*/ | 2483 | #if defined(X3270_TN3270E) /*[*/ |
| 2490 | /* If we fell out of TN3270E, remove the state. */ | 2484 | /* If we fell out of TN3270E, remove the state. */ |
| 2491 | - if (!h3270.myopts[TELOPT_TN3270E]) { | ||
| 2492 | - h3270.tn3270e_negotiated = 0; | ||
| 2493 | - h3270.tn3270e_submode = E_NONE; | ||
| 2494 | - h3270.tn3270e_bound = 0; | 2485 | + if (!session->myopts[TELOPT_TN3270E]) { |
| 2486 | + session->tn3270e_negotiated = 0; | ||
| 2487 | + session->tn3270e_submode = E_NONE; | ||
| 2488 | + session->tn3270e_bound = 0; | ||
| 2495 | } | 2489 | } |
| 2496 | #endif /*]*/ | 2490 | #endif /*]*/ |
| 2497 | trace_dsn("Now operating in %s mode.\n",state_name[new_cstate]); | 2491 | trace_dsn("Now operating in %s mode.\n",state_name[new_cstate]); |
| @@ -2575,7 +2569,7 @@ static void check_linemode(H3270 *hSession, Boolean init) | @@ -2575,7 +2569,7 @@ static void check_linemode(H3270 *hSession, Boolean init) | ||
| 2575 | } | 2569 | } |
| 2576 | #if defined(X3270_ANSI) /*[*/ | 2570 | #if defined(X3270_ANSI) /*[*/ |
| 2577 | if (IN_ANSI && hSession->linemode) | 2571 | if (IN_ANSI && hSession->linemode) |
| 2578 | - cooked_init(); | 2572 | + cooked_init(hSession); |
| 2579 | #endif /*]*/ | 2573 | #endif /*]*/ |
| 2580 | } | 2574 | } |
| 2581 | } | 2575 | } |
src/lib3270/telnetc.h
| @@ -37,7 +37,7 @@ LIB3270_INTERNAL void net_charmode(void); | @@ -37,7 +37,7 @@ LIB3270_INTERNAL void net_charmode(void); | ||
| 37 | LIB3270_INTERNAL int net_connect(H3270 *session, const char *, char *, Boolean, Boolean *, Boolean *); | 37 | LIB3270_INTERNAL int net_connect(H3270 *session, const char *, char *, Boolean, Boolean *, Boolean *); |
| 38 | LIB3270_INTERNAL void net_disconnect(H3270 *session); | 38 | LIB3270_INTERNAL void net_disconnect(H3270 *session); |
| 39 | LIB3270_INTERNAL void net_exception(H3270 *session); | 39 | LIB3270_INTERNAL void net_exception(H3270 *session); |
| 40 | -LIB3270_INTERNAL void net_hexansi_out(unsigned char *buf, int len); | 40 | +// LIB3270_INTERNAL void net_hexansi_out(unsigned char *buf, int len); |
| 41 | LIB3270_INTERNAL void net_input(H3270 *session); | 41 | LIB3270_INTERNAL void net_input(H3270 *session); |
| 42 | LIB3270_INTERNAL void net_interrupt(void); | 42 | LIB3270_INTERNAL void net_interrupt(void); |
| 43 | LIB3270_INTERNAL void net_linemode(void); | 43 | LIB3270_INTERNAL void net_linemode(void); |
| @@ -54,7 +54,7 @@ LIB3270_INTERNAL void net_send_kill(void); | @@ -54,7 +54,7 @@ LIB3270_INTERNAL void net_send_kill(void); | ||
| 54 | LIB3270_INTERNAL void net_send_werase(void); | 54 | LIB3270_INTERNAL void net_send_werase(void); |
| 55 | LIB3270_INTERNAL Boolean net_snap_options(void); | 55 | LIB3270_INTERNAL Boolean net_snap_options(void); |
| 56 | LIB3270_INTERNAL void space3270out(int n); | 56 | LIB3270_INTERNAL void space3270out(int n); |
| 57 | -LIB3270_INTERNAL const char *tn3270e_current_opts(void); | 57 | +// LIB3270_INTERNAL const char *tn3270e_current_opts(void); |
| 58 | LIB3270_INTERNAL char *net_proxy_type(void); | 58 | LIB3270_INTERNAL char *net_proxy_type(void); |
| 59 | LIB3270_INTERNAL char *net_proxy_host(void); | 59 | LIB3270_INTERNAL char *net_proxy_host(void); |
| 60 | LIB3270_INTERNAL char *net_proxy_port(void); | 60 | LIB3270_INTERNAL char *net_proxy_port(void); |
src/pw3270/colors.c
| @@ -416,7 +416,12 @@ static void load_color_scheme(GKeyFile *conf, const gchar *group, GdkColor *clr) | @@ -416,7 +416,12 @@ static void load_color_scheme(GKeyFile *conf, const gchar *group, GdkColor *clr) | ||
| 416 | GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, | 416 | GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, |
| 417 | GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, | 417 | GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, |
| 418 | NULL ); | 418 | NULL ); |
| 419 | +#if GTK_CHECK_VERSION(3,0,0) | ||
| 420 | + GtkWidget * panned = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,2); | ||
| 421 | +#else | ||
| 419 | GtkWidget * panned = gtk_hbox_new(FALSE,2); | 422 | GtkWidget * panned = gtk_hbox_new(FALSE,2); |
| 423 | +#endif // GTK(3,0,0) | ||
| 424 | + | ||
| 420 | GtkWidget * tree; | 425 | GtkWidget * tree; |
| 421 | GtkWidget * color; | 426 | GtkWidget * color; |
| 422 | GdkColor saved[V3270_COLOR_COUNT]; | 427 | GdkColor saved[V3270_COLOR_COUNT]; |
| @@ -489,7 +494,11 @@ static void load_color_scheme(GKeyFile *conf, const gchar *group, GdkColor *clr) | @@ -489,7 +494,11 @@ static void load_color_scheme(GKeyFile *conf, const gchar *group, GdkColor *clr) | ||
| 489 | 494 | ||
| 490 | // Color scheme combo | 495 | // Color scheme combo |
| 491 | { | 496 | { |
| 497 | +#if GTK_CHECK_VERSION(3,0,0) | ||
| 498 | + GtkWidget * box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,2); | ||
| 499 | +#else | ||
| 492 | GtkWidget * box = gtk_hbox_new(FALSE,2); | 500 | GtkWidget * box = gtk_hbox_new(FALSE,2); |
| 501 | +#endif // GTK(3,0,0) | ||
| 493 | GtkWidget * button = color_scheme_new(v3270_get_color_table(widget)); | 502 | GtkWidget * button = color_scheme_new(v3270_get_color_table(widget)); |
| 494 | 503 | ||
| 495 | g_object_set_data(G_OBJECT(button),"terminal_widget",widget); | 504 | g_object_set_data(G_OBJECT(button),"terminal_widget",widget); |
src/pw3270/dialog.c
| @@ -67,7 +67,12 @@ | @@ -67,7 +67,12 @@ | ||
| 67 | 67 | ||
| 68 | static void add_option_menus(GtkWidget *widget, GtkAction *action, gchar **encoding) | 68 | static void add_option_menus(GtkWidget *widget, GtkAction *action, gchar **encoding) |
| 69 | { | 69 | { |
| 70 | - GtkWidget *box = gtk_hbox_new(FALSE,6); | 70 | +#if GTK_CHECK_VERSION(3,0,0) |
| 71 | + GtkWidget *box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,6); | ||
| 72 | +#else | ||
| 73 | + GtkWidget *box = gtk_hbox_new(FALSE,6); | ||
| 74 | +#endif // GTK(3,0,0) | ||
| 75 | + | ||
| 71 | gchar *ptr = g_object_get_data(G_OBJECT(action),"charset"); | 76 | gchar *ptr = g_object_get_data(G_OBJECT(action),"charset"); |
| 72 | 77 | ||
| 73 | if(ptr) | 78 | if(ptr) |
src/pw3270/filetransfer.c
| @@ -482,7 +482,12 @@ static void run_ft_dialog(GObject *action, GtkWidget *widget, struct ftdialog *d | @@ -482,7 +482,12 @@ static void run_ft_dialog(GObject *action, GtkWidget *widget, struct ftdialog *d | ||
| 482 | GTK_STOCK_CLOSE,GTK_RESPONSE_CLOSE ); | 482 | GTK_STOCK_CLOSE,GTK_RESPONSE_CLOSE ); |
| 483 | 483 | ||
| 484 | 484 | ||
| 485 | +#if GTK_CHECK_VERSION(3,0,0) | ||
| 486 | + container = gtk_box_new(GTK_ORIENTATION_VERTICAL,2); | ||
| 487 | +#else | ||
| 485 | container = gtk_vbox_new(FALSE,2); | 488 | container = gtk_vbox_new(FALSE,2); |
| 489 | +#endif // GTK(3,0,0) | ||
| 490 | + | ||
| 486 | gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(ftdialog))),container,TRUE,TRUE,2); | 491 | gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(ftdialog))),container,TRUE,TRUE,2); |
| 487 | 492 | ||
| 488 | // Information frame | 493 | // Information frame |
| @@ -653,7 +658,11 @@ void download_action(GtkAction *action, GtkWidget *widget) | @@ -653,7 +658,11 @@ void download_action(GtkAction *action, GtkWidget *widget) | ||
| 653 | 658 | ||
| 654 | { | 659 | { |
| 655 | /* Add dft option */ | 660 | /* Add dft option */ |
| 656 | - GtkWidget *hbox = gtk_hbox_new(FALSE,2); | 661 | +#if GTK_CHECK_VERSION(3,0,0) |
| 662 | + GtkWidget *hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,2); | ||
| 663 | +#else | ||
| 664 | + GtkWidget *hbox = gtk_hbox_new(FALSE,2); | ||
| 665 | +#endif // GTK(3,0,0) | ||
| 657 | GtkWidget *label = NULL; | 666 | GtkWidget *label = NULL; |
| 658 | 667 | ||
| 659 | gtk_container_set_border_width(GTK_CONTAINER(hbox),4); | 668 | gtk_container_set_border_width(GTK_CONTAINER(hbox),4); |
| @@ -738,16 +747,27 @@ void upload_action(GtkAction *action, GtkWidget *widget) | @@ -738,16 +747,27 @@ void upload_action(GtkAction *action, GtkWidget *widget) | ||
| 738 | { N_( "Space allocation units" ), "allocationunits", units } | 747 | { N_( "Space allocation units" ), "allocationunits", units } |
| 739 | }; | 748 | }; |
| 740 | 749 | ||
| 741 | - GtkWidget *box = gtk_hbox_new(TRUE,2); | 750 | + |
| 742 | int f; | 751 | int f; |
| 743 | 752 | ||
| 753 | +#if GTK_CHECK_VERSION(3,0,0) | ||
| 754 | + GtkWidget *box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,2); | ||
| 755 | +#else | ||
| 756 | + GtkWidget *box = gtk_hbox_new(TRUE,2); | ||
| 757 | +#endif // GTK(3,0,0) | ||
| 758 | + | ||
| 744 | for(f=0;f<2;f++) | 759 | for(f=0;f<2;f++) |
| 745 | { | 760 | { |
| 746 | GtkWidget * frame = gtk_frame_new(gettext(fdesk[f].title)); | 761 | GtkWidget * frame = gtk_frame_new(gettext(fdesk[f].title)); |
| 747 | - GtkWidget * vbox = gtk_vbox_new(TRUE,2); | ||
| 748 | GSList * group = NULL; | 762 | GSList * group = NULL; |
| 749 | gchar * setup = get_attribute(G_OBJECT(action),&dlg,fdesk[f].name); | 763 | gchar * setup = get_attribute(G_OBJECT(action),&dlg,fdesk[f].name); |
| 750 | int p; | 764 | int p; |
| 765 | +#if GTK_CHECK_VERSION(3,0,0) | ||
| 766 | + GtkWidget * vbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,2); | ||
| 767 | + gtk_box_set_homogeneous(GTK_BOX(vbox),TRUE); | ||
| 768 | +#else | ||
| 769 | + GtkWidget * vbox = gtk_vbox_new(TRUE,2); | ||
| 770 | +#endif // GTK(3,0,0) | ||
| 751 | 771 | ||
| 752 | for(p=0;p<4;p++) | 772 | for(p=0;p<4;p++) |
| 753 | { | 773 | { |
src/pw3270/uiparser/parser.c
| @@ -161,8 +161,13 @@ static void release_action_group(GtkActionGroup ** group) | @@ -161,8 +161,13 @@ static void release_action_group(GtkActionGroup ** group) | ||
| 161 | void parser_build(struct parser *p, GtkWidget *widget) | 161 | void parser_build(struct parser *p, GtkWidget *widget) |
| 162 | { | 162 | { |
| 163 | struct action_info a_info; | 163 | struct action_info a_info; |
| 164 | + | ||
| 165 | +#if GTK_CHECK_VERSION(3,0,0) | ||
| 166 | + GtkWidget * vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL,0); | ||
| 167 | +#else | ||
| 164 | GtkWidget * vbox = gtk_vbox_new(FALSE,0); | 168 | GtkWidget * vbox = gtk_vbox_new(FALSE,0); |
| 165 | -// GtkWidget * hbox = gtk_hbox_new(FALSE,0); | 169 | +#endif // GTK(3,0,0) |
| 170 | + | ||
| 166 | GtkWidget * parent; | 171 | GtkWidget * parent; |
| 167 | int f; | 172 | int f; |
| 168 | 173 |