Annotation of 43BSDTahoe/ucb/tn3270/api/api_exch.h, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 1988 Regents of the University of California.
                      3:  * All rights reserved.
                      4:  *
                      5:  * Redistribution and use in source and binary forms are permitted
                      6:  * provided that this notice is preserved and that due credit is given
                      7:  * to the University of California at Berkeley. The name of the University
                      8:  * may not be used to endorse or promote products derived from this
                      9:  * software without specific prior written permission. This software
                     10:  * is provided ``as is'' without express or implied warranty.
                     11:  *
                     12:  *     @(#)api_exch.h  3.2 (Berkeley) 3/28/88
                     13:  */
                     14: 
                     15: /*
                     16:  * This file describes the structures passed back and forth
                     17:  * between the API client and API server on a Unix-based
                     18:  * tn3270 implementation.
                     19:  */
                     20: 
                     21: /*
                     22:  * The following are the low-level opcodes exchanged between the
                     23:  * two sides.  These are designed to allow for type, sequence number,
                     24:  * and direction checking.
                     25:  *
                     26:  * We enforce conversation flow.  There are three states: CONTENTION,
                     27:  * SEND, and RECEIVE.  Both sides start in CONTENTION.
                     28:  * We never leave RECEIVE state without first reading a TURNAROUND
                     29:  * opcode.  We never leave SEND state without first writing a TURNAROUND
                     30:  * opcode.  This scheme ensures that we always have conversation flowing
                     31:  * in a synchronized direction (or detect an application error), and that
                     32:  * we never hang with both sides trying to read from the "wire".
                     33:  *
                     34:  * State       event                   action
                     35:  *
                     36:  * CONTENTION  read request            send TURNAROUND
                     37:  *                                     read RTS
                     38:  *                                     enter RECEIVE
                     39:  * CONTENTION  write request           send RTS
                     40:  *                                     read TURNAROUND
                     41:  *                                     enter SEND
                     42:  *
                     43:  * RECEIVE     read request            read whatever
                     44:  * RECEIVE     write request           read TURNAROUND
                     45:  *
                     46:  * SEND                read request            send TURNAROUND
                     47:  * SEND                write                   write whatever
                     48:  */
                     49: 
                     50: #define        EXCH_EXCH_COMMAND       0       /* The following is a command */
                     51: #define        EXCH_EXCH_TURNAROUND    1       /* Your turn to send */
                     52: #define        EXCH_EXCH_RTS           2       /* Request to send */
                     53: #define        EXCH_EXCH_TYPE          3       /* The following is a type */
                     54: 
                     55: struct exch_exch {
                     56:     unsigned char
                     57:        opcode,                 /* COMMAND, TURNAROUND, or TYPE */
                     58:        my_sequence,            /* 0-ff, initially zero */
                     59:        your_sequence,          /* 0-ff, initially zero */
                     60:        command_or_type;        /* Application level command or type */
                     61:     unsigned short
                     62:        length;                 /* The length of any following data */
                     63: };
                     64: 
                     65: /*
                     66:  * The following are the command codes which the higher level protocols
                     67:  * send and receive.
                     68:  */
                     69: 
                     70: #define        EXCH_CMD_ASSOCIATE      0       /* Connect [client->server] */
                     71:        /*
                     72:         * struct storage_desc
                     73:         * char key[]
                     74:         */
                     75: #define        EXCH_CMD_DISASSOCIATE   1       /* Disconnect [client->server] */
                     76: #define        EXCH_CMD_SEND_AUTH      2       /* Send password [server->client] */
                     77:        /*
                     78:         * struct storage_desc
                     79:         * char prompt[]
                     80:         * struct storage_desc
                     81:         * char seed[]
                     82:         */
                     83: #define        EXCH_CMD_AUTH           3       /* Authorization [client->server] */
                     84:        /*
                     85:         * struct storage_desc
                     86:         * char authenticator[]
                     87:         */
                     88: #define        EXCH_CMD_ASSOCIATED     4       /* Connected [server->client] */
                     89: #define        EXCH_CMD_REJECTED       5       /* Too bad [server->client] */
                     90:        /*
                     91:         * struct storage_desc
                     92:         * char message[]
                     93:         */
                     94: 
                     95: #define        EXCH_CMD_REQUEST        6       /* A request [client->server] */
                     96:        /* struct regs,
                     97:         * struct sregs,
                     98:         * struct storage_desc
                     99:         * char bytes[]
                    100:         */
                    101: #define        EXCH_CMD_GIMME          7       /* Send storage [server->client] */
                    102:        /*
                    103:         * struct storage_desc
                    104:         */
                    105: #define        EXCH_CMD_HEREIS         8       /* Here is storage [BOTH WAYS] */
                    106:        /*
                    107:         * struct storage_desc
                    108:         * char bytes[]
                    109:         */
                    110: #define        EXCH_CMD_REPLY          9       /* End of discussion */
                    111:        /*
                    112:         * struct regs,
                    113:         * struct sregs,
                    114:         */
                    115: 
                    116: /*
                    117:  * The following are typed parameters sent across the wire.
                    118:  *
                    119:  * This should be done much more generally, with some form of
                    120:  * XDR or mapped conversation ability.
                    121:  */
                    122: 
                    123: #define        EXCH_TYPE_REGS          0
                    124: #define        EXCH_TYPE_SREGS         1
                    125: #define        EXCH_TYPE_STORE_DESC    2
                    126: #define        EXCH_TYPE_BYTES         3
                    127: 
                    128: /*
                    129:  * each parameter that comes over looks like:
                    130:  *
                    131:  *     char                    type of following
                    132:  *     short (2 bytes)         length of following (network byte order)
                    133:  *     following
                    134:  */
                    135: 
                    136: struct storage_descriptor {
                    137:     long       location;       /* In network byte order */
                    138:     short      length;         /* In network byte order */
                    139: };

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.