From cee740d62854e8dbcc34c00f6fe758d7d373ffb3 Mon Sep 17 00:00:00 2001 From: Gregory Minshall Date: Tue, 16 Jun 1987 06:26:23 -0800 Subject: [PATCH] Cut down on number of protocol exchanges by passing parm data over with the initial parameters. SCCS-vsn: usr.bin/tn3270/api/apilib.c 1.6 SCCS-vsn: usr.bin/tn3270/api/api_bsd.c 1.5 --- usr/src/usr.bin/tn3270/api/api_bsd.c | 10 ++++++-- usr/src/usr.bin/tn3270/api/apilib.c | 36 +++++++++++++++------------- 2 files changed, 27 insertions(+), 19 deletions(-) diff --git a/usr/src/usr.bin/tn3270/api/api_bsd.c b/usr/src/usr.bin/tn3270/api/api_bsd.c index 0eb5304e92..853104a6e7 100644 --- a/usr/src/usr.bin/tn3270/api/api_bsd.c +++ b/usr/src/usr.bin/tn3270/api/api_bsd.c @@ -149,9 +149,11 @@ char *string; /* if non-zero, where to connect to */ } -api_exch_api(regs, sregs) +api_exch_api(regs, sregs, parms, length) union REGS *regs; struct SREGS *sregs; +char *parms; +int length; { struct storage_descriptor sd; int i; @@ -165,10 +167,14 @@ struct SREGS *sregs; if (api_exch_outtype(EXCH_TYPE_SREGS, sizeof *sregs, (char *)sregs) == -1) { return -1; } - sd.length = 0; + sd.length = htons(length); + sd.location = htonl(parms); if (api_exch_outtype(EXCH_TYPE_STORE_DESC, sizeof sd, (char *)&sd) == -1) { return -1; } + if (api_exch_outtype(EXCH_TYPE_BYTES, length, parms) == -1) { + return -1; + } while ((i = api_exch_nextcommand()) != EXCH_CMD_REPLY) { switch (i) { case EXCH_CMD_GIMME: diff --git a/usr/src/usr.bin/tn3270/api/apilib.c b/usr/src/usr.bin/tn3270/api/apilib.c index 550067b381..1bb33954cc 100644 --- a/usr/src/usr.bin/tn3270/api/apilib.c +++ b/usr/src/usr.bin/tn3270/api/apilib.c @@ -20,10 +20,11 @@ static int * Only certain routines need this (supervisor services come to mind). */ -int -api_issue_regs(ah, al, bh, bl, cx, dx, parms, regs, sregs) +static int +api_issue_regs(ah, al, bh, bl, cx, dx, parms, length, regs, sregs) int ah, al, bh, bl, cx, dx; char *parms; +int length; union REGS *regs; struct SREGS *sregs; { @@ -42,7 +43,7 @@ struct SREGS *sregs; int86x(API_INTERRUPT_NUMBER, regs, regs, sregs); #endif /* defined(MSDOS) */ #if defined(unix) - api_exch_api(regs, sregs); + api_exch_api(regs, sregs, parms, length); #endif /* defined(unix) */ if (regs->h.cl != 0) { @@ -59,8 +60,8 @@ struct SREGS *sregs; * registers. Most routines use this. */ -int -api_issue(ah, al, bh, bl, cx, dx, parms) +static int +api_issue(ah, al, bh, bl, cx, dx, parms, length) int ah, al, @@ -69,11 +70,12 @@ int cx, dx; char *parms; +int length; /* Length of parms */ { union REGS regs; struct SREGS sregs; - return api_issue_regs(ah, al, bh, bl, cx, dx, parms, ®s, &sregs); + return api_issue_regs(ah, al, bh, bl, cx, dx, parms, length, ®s, &sregs); } /* @@ -97,7 +99,7 @@ char *name; } } - if (api_issue_regs(NAME_RESOLUTION, 0, 0, 0, 0, 0, &parms, ®s, &sregs) + if (api_issue_regs(NAME_RESOLUTION, 0, 0, 0, 0, 0, &parms, sizeof parms, ®s, &sregs) == -1) { return -1; } else { @@ -113,7 +115,7 @@ api_query_session_id(parms) QuerySessionIdParms *parms; { if (api_issue(0x09, QUERY_SESSION_ID, 0x80, 0x20, 0, - gate_sessmgr, (char *)parms) == -1) { + gate_sessmgr, (char *)parms, sizeof *parms) == -1) { api_fcn_errno = 0; api_fcn_fcn_id = 0; return -1; @@ -131,7 +133,7 @@ api_query_session_parameters(parms) QuerySessionParametersParms *parms; { if (api_issue(0x09, QUERY_SESSION_PARAMETERS, 0x80, 0x20, 0, - gate_sessmgr, (char *)parms) == -1) { + gate_sessmgr, (char *)parms, sizeof *parms) == -1) { api_fcn_errno = 0; api_fcn_fcn_id = 0; return -1; @@ -148,7 +150,7 @@ api_query_session_cursor(parms) QuerySessionCursorParms *parms; { if (api_issue(0x09, QUERY_SESSION_CURSOR, 0x80, 0x20, 0xff, - gate_sessmgr, (char *)parms) == -1) { + gate_sessmgr, (char *)parms, sizeof *parms) == -1) { api_fcn_errno = 0; api_fcn_fcn_id = 0; return -1; @@ -169,7 +171,7 @@ api_connect_to_keyboard(parms) ConnectToKeyboardParms *parms; { if (api_issue(0x09, CONNECT_TO_KEYBOARD, 0x80, 0x20, 0, - gate_keyboard, (char *)parms) == -1) { + gate_keyboard, (char *)parms, sizeof *parms) == -1) { api_fcn_errno = 0; api_fcn_fcn_id = 0; return -1; @@ -187,7 +189,7 @@ api_disconnect_from_keyboard(parms) DisconnectFromKeyboardParms *parms; { if (api_issue(0x09, DISCONNECT_FROM_KEYBOARD, 0x80, 0x20, 0, - gate_keyboard, (char *)parms) == -1) { + gate_keyboard, (char *)parms, sizeof *parms) == -1) { api_fcn_errno = 0; api_fcn_fcn_id = 0; return -1; @@ -205,7 +207,7 @@ api_write_keystroke(parms) WriteKeystrokeParms *parms; { if (api_issue(0x09, WRITE_KEYSTROKE, 0x80, 0x20, 0, - gate_keyboard, (char *)parms) == -1) { + gate_keyboard, (char *)parms, sizeof *parms) == -1) { api_fcn_errno = 0; api_fcn_fcn_id = 0; return -1; @@ -223,7 +225,7 @@ api_disable_input(parms) DisableInputParms *parms; { if (api_issue(0x09, DISABLE_INPUT, 0x80, 0x20, 0, - gate_keyboard, (char *)parms) == -1) { + gate_keyboard, (char *)parms, sizeof *parms) == -1) { api_fcn_errno = 0; api_fcn_fcn_id = 0; return -1; @@ -240,7 +242,7 @@ api_enable_input(parms) EnableInputParms *parms; { if (api_issue(0x09, ENABLE_INPUT, 0x80, 0x20, 0, - gate_keyboard, (char *)parms) == -1) { + gate_keyboard, (char *)parms, sizeof *parms) == -1) { api_fcn_errno = 0; api_fcn_fcn_id = 0; return -1; @@ -261,7 +263,7 @@ api_copy_string(parms) CopyStringParms *parms; { if (api_issue(0x09, COPY_STRING, 0x80, 0x20, 0xff, - gate_copy, (char *)parms) == -1) { + gate_copy, (char *)parms, sizeof *parms) == -1) { api_fcn_errno = 0; api_fcn_fcn_id = 0; return -1; @@ -282,7 +284,7 @@ api_read_oia_group(parms) ReadOiaGroupParms *parms; { if (api_issue(0x09, READ_OIA_GROUP, 0x80, 0x20, 0xff, - gate_oiam, (char *)parms) == -1) { + gate_oiam, (char *)parms, sizeof *parms) == -1) { api_fcn_errno = 0; api_fcn_fcn_id = 0; return -1; -- 2.20.1