Annotation of 43BSDReno/contrib/isode-beta/h/quipu/connection.h, revision 1.1.1.1

1.1       root        1: /* connection.h - directory internal structures */
                      2: 
                      3: /*
                      4:  * $Header: /f/osi/h/quipu/RCS/connection.h,v 7.1 90/07/09 14:38:23 mrose Exp $
                      5:  *
                      6:  *
                      7:  * $Log:       connection.h,v $
                      8:  * Revision 7.1  90/07/09  14:38:23  mrose
                      9:  * sync
                     10:  * 
                     11:  * Revision 7.0  89/11/23  21:56:28  mrose
                     12:  * Release 6.0
                     13:  * 
                     14:  */
                     15: 
                     16: /*
                     17:  *                               NOTICE
                     18:  *
                     19:  *    Acquisition, use, and distribution of this module and related
                     20:  *    materials are subject to the restrictions of a license agreement.
                     21:  *    Consult the Preface in the User's Manual for the full terms of
                     22:  *    this agreement.
                     23:  *
                     24:  */
                     25: 
                     26: 
                     27: #ifndef QUIPUCON
                     28: #define QUIPUCON
                     29: 
                     30: #include "quipu/common.h"
                     31: #include "quipu/dsargument.h"
                     32: #include "quipu/dsap.h"
                     33: 
                     34: #define DSA_PRIO_LOW            1
                     35: #define DSA_PRIO_MED            2
                     36: #define DSA_PRIO_HIGH           3
                     37: #define DSA_MAX_PRIO            3
                     38: 
                     39: #define MAX_CONNS              20      /* Maximum concurrent connections */
                     40: #define CONNS_RESERVED_DI      2       /* Reserved for Get DSA Info ops */
                     41: #define CONNS_RESERVED_X500    10      /* Reserved for normal operations */
                     42: 
                     43: /*
                     44: *  If the connection definitions are altered bear in mind that 
                     45: *  MAX_CONNS - CONNS_RESERVED_FOR_DI - CONNS_RESERVED_FOR_X500
                     46: *  must be at least 1 to allow get edb ops to happen, and should
                     47: *  probably be at least 2 to allow one get edb operation to block.
                     48: */
                     49: 
                     50: /*
                     51: *  The following structures form the basis of the connection mesh
                     52: *  which is central to the scheduling of the DSA.
                     53: */
                     54: 
                     55: /*
                     56: *  The di_block structure is used to generate lists of dsa information
                     57: *  blocks even when the information is not yet available.
                     58: *  There are 3 states which a di_block can be in:
                     59: *      DI_ACCESSPOINT: di_block contains access point only.
                     60: *      DI_COMPLETE:    di_block contains entry for dsa.
                     61: *      DI_DEFERRED:    di_block is waiting for a dsa entry.
                     62: *
                     63: *  The links in this structure need to be handled with care!!
                     64: *  di_next is used to link the "di_block"s on
                     65: *      1) the global list if that is where this block is kept
                     66: *      2) the requesting operation if that is where this block is kept
                     67: *      3) the requesting task if that is where this block is kept
                     68: *
                     69: *  di_wake_next is used to link the "di_block"s for the performing
                     70: *  operation, so that it is obvious what needs to be alerted.
                     71: *
                     72: *  di_task points to the task to be alerted from type DI_TASK
                     73: *  di_oper points to the operation to be alerted from type DI_OPERATION
                     74: *  di_perform points to the operation performing the get dsa info operation
                     75: */
                     76: struct di_block
                     77: {
                     78:        DN        di_dn;        /* Name of dsa this block refers to */
                     79: 
                     80:        char      di_type;      /* Global list, operation list or task list */
                     81: #define DI_GLOBAL      1       /* deferred_dis lists this block */
                     82: #define DI_OPERATION   2       /* di_oper lists this block */
                     83: #define DI_TASK                3       /* di_task lists this block */
                     84: 
                     85:        struct task_act         * di_task;
                     86:        struct oper_act         * di_oper;
                     87: 
                     88: /*
                     89: *  The following are needed to generate chaining arguments from DSAInformation
                     90: *  in the case of chaining (DI_OPERATION); and to generate continuation
                     91: *  references in the case of referring (DI_TASK). Not present for DI_GLOBAL
                     92: */
                     93:        DN                        di_target;
                     94:        int                       di_reftype;
                     95:        int                       di_rdn_resolved;
                     96:        int                       di_aliasedRDNs;
                     97: 
                     98:        char      di_state;     /* How the dsa information is formed */
                     99: #define DI_COMPLETE    1       /* di_entry filled out */
                    100: #define DI_ACCESSPOINT 2       /* di_accesspoints filled out */
                    101: #define DI_DEFERRED    3       /* di_perform still generating di_entry */
                    102: 
                    103:        struct access_point     * di_accesspoints;
                    104: 
                    105:        Entry                     di_entry;
                    106: 
                    107:        struct oper_act         * di_perform;
                    108: 
                    109:        struct di_block         * di_wake_next; /* List of blocks to wake */
                    110:        struct di_block         * di_next;      /* List of blocks */
                    111: };
                    112: #define NULL_DI_BLOCK  ((struct di_block *) NULL)
                    113: 
                    114: /*
                    115: * Operations received over a bound association are represented as a
                    116: * linked list of task blocks. The following task block structure 
                    117: * contains the invocation (including decoded argument) received,
                    118: * representations of the progress of the task and fields to be
                    119: * used for generating the response.
                    120: */
                    121: struct task_act
                    122: {
                    123:        int                       tk_prio;
                    124:        char                      tk_state;
                    125: #define TK_ACTIVE                1     /* Task ready to have work done */
                    126: #define TK_PASSIVE               2     /* Task waiting for operation */
                    127: #define TK_SUSPEND               3     /* Giving the network a chance */
                    128: 
                    129:        struct DSAPinvoke         tk_dx;
                    130:        struct di_block         * tk_dsas;      /* di_blocks for referral */
                    131: 
                    132:        struct DSAPindication     tk_resp;
                    133:        struct ds_op_res        * tk_result;
                    134:        struct DSError          * tk_error;
                    135: 
                    136:        /* Specific additions to provide multi-subtask search implementation */
                    137:        struct ds_search_task   * local_st;
                    138:        struct ds_search_task   * refer_st;
                    139:        struct ds_search_task   * referred_st;
                    140: 
                    141:        char                      tk_timed;
                    142:        time_t                    tk_timeout;
                    143: 
                    144:        struct oper_act         * tk_operlist;
                    145:        struct task_act         * tk_next;
                    146: 
                    147:        struct connection       * tk_conn;
                    148: };
                    149: #define NULLTASK ((struct task_act *) NULL)
                    150: 
                    151: struct oper_act
                    152: {
                    153:        int                       on_id;
                    154:        char                      on_state;
                    155: #define ON_DEFERRED              1     /* Waiting for DSA INFO */
                    156: #define ON_CHAINED               2     /* Waiting for a response */
                    157: #define ON_COMPLETE              3     /* Waiting to be used by task */
                    158: #define ON_ABANDONED             4     /* Waiting for response - no task */
                    159: 
                    160:        char                      on_type;
                    161: #define ON_TYPE_X500             1
                    162: #define ON_TYPE_BIND_COMPARE     2
                    163: #define ON_TYPE_GET_DSA_INFO     3
                    164: #define ON_TYPE_GET_EDB                  4
                    165: #define ON_TYPE_SUBTASK                  5
                    166: 
                    167: /* Specific to ON_TYPE_X500 */
                    168:        struct task_act         *on_task;               /* Task to wake */
                    169: 
                    170: /* Specific to ON_TYPE_BIND_COMPARE */
                    171:        struct connection       *on_bind_compare;       /* Bind to wake */
                    172: 
                    173: /* Specific to ON_TYPE_GET_DSA_INFO */
                    174:        struct di_block         * on_wake_list;         /* di_blocks to wake */
                    175: 
                    176: /* Specific to ON_TYPE_GET_EDB */
                    177:        Entry                     on_getedb_eptr;       /* previous entry */
                    178:        char                    * on_getedb_ver;        /* previous version */
                    179: 
                    180: /* Specific to ON_TYPE_SUBTASK */
                    181:        struct ds_search_task   * on_subtask;
                    182: 
                    183:        struct di_block         * on_dsas;      /* DSAInfos for chaining */
                    184: 
                    185:        struct ds_op_arg        on_req;         /* Argument stuff */
                    186:        struct ds_op_arg        *on_arg;
                    187: 
                    188:        struct DSAPindication     on_resp;      /* Response stuff */
                    189: 
                    190:        char                    on_relay;       /* if TRUE try Relay DSA */
                    191: 
                    192:        struct oper_act         *on_next_conn;
                    193:        struct oper_act         *on_next_task;
                    194: 
                    195:        struct connection       *on_conn;
                    196: };
                    197: #define NULLOPER ((struct oper_act *) NULL)
                    198: 
                    199: struct conn_start
                    200: {
                    201:        /* Values stored after call to TNetAccept */
                    202:        int                       cs_vecp;
                    203:        char                    * cs_vec[4];
                    204:        char                    * cs_svec[4];
                    205: 
                    206:        /* Value extracted from above by conn_init() */
                    207:        struct DSAPstart          cs_ds;
                    208: 
                    209:        /* Operation carrying out compare for binding */
                    210:        struct oper_act         * cs_bind_compare;
                    211: 
                    212:        /* Result or error generated for response */
                    213:        struct ds_bind_arg        cs_res;
                    214:        struct ds_bind_error      cs_err;
                    215: };
                    216: 
                    217: struct conn_connect
                    218: {
                    219:        /* Bind argument used in conn_request() */
                    220:        struct ds_bind_arg              cc_req;
                    221: 
                    222:        struct DSAPconnect              cc_dc;
                    223: };
                    224: 
                    225: /*
                    226: * Conn is the structure used to represent external connections
                    227: */
                    228: struct connection
                    229: {
                    230:        char                      cn_state;
                    231: /* State of the connection */
                    232: #define CN_INDICATED             1
                    233: #define CN_WAITING               2
                    234: #define CN_CONNECTING1           3
                    235: #define CN_CONNECTING2           4
                    236: #define CN_OPEN                          5
                    237: #define CN_FAILED                6
                    238: #define CN_CLOSING               7
                    239: #define CN_OPENING               8
                    240: 
                    241:        char                      cn_ctx; 
                    242: /* DS_CTX_* values defined in dsap.h for use by decoders */
                    243: 
                    244:        char                      cn_initiator;
                    245:        /* TRUE: this DSA is initiator, FALSE: this DSA is responder */
                    246: 
                    247:        /* Information used during initialisation of the connection */
                    248:         union
                    249:         {
                    250:                struct conn_start       cn_start_un_start;      /* responder */
                    251:                struct conn_connect     cn_start_un_connect;    /* initiator */
                    252:        } cn_start_un;
                    253: #define cn_start       cn_start_un.cn_start_un_start
                    254: #define cn_connect     cn_start_un.cn_start_un_connect
                    255: 
                    256: /*
                    257:        struct ds_bind_arg      * cn_res;
                    258:        struct ds_bind_error            * cn_err;
                    259: 
                    260:        struct init_activity      cn_init_act;
                    261:        struct oper_act         * cn_bind_compare;
                    262: */
                    263: 
                    264:         time_t                   cn_last_used;
                    265: /* Time at which this connection was last used */
                    266: 
                    267:         time_t                   cn_last_release;
                    268: /* Time at which this connection release was last attempted */
                    269: 
                    270:        DN                        cn_dn;
                    271: /* Name of the entity at the far end of the connection */
                    272: 
                    273:        struct PSAPaddr           cn_addr;
                    274: /* Address of the entity at the far end of the connection */
                    275: 
                    276:        int                       cn_ad;
                    277: /* Descriptor identifying the association on which the connection is based */
                    278: 
                    279: /*
                    280:        int                       cn_context_id;
                    281: */
                    282: /* Context identifier of context to be used for user-data. */
                    283: 
                    284:        int                       cn_op_id;
                    285: /* Used to ensure unique invoke id's are used when invoking operations. */
                    286: 
                    287:        struct task_act         * cn_tasklist;
                    288: /* List of tasks received over this connection. */
                    289: 
                    290:        struct oper_act         * cn_operlist;
                    291: /* List of operations sent over this connection. */
                    292: 
                    293:        struct connection       * cn_next;
                    294: /* Rest of list of connections. */
                    295: 
                    296:        int                     cn_authen;
                    297: /* Takes a value from bind.h -> level to which the association is authenticated */
                    298: 
                    299: };
                    300: #define NULLCONN ((struct connection *) NULL)
                    301: 
                    302: /*
                    303: *  Global variables are nasty but useful. Here the external definitions
                    304: *  for the most crucial are given:
                    305: *      a handle on the connections being processed
                    306: *      info describing how this DSA wants the lower layers parameterised
                    307: *      a handle on current deferred get dsa info operations
                    308: *      a handle on current get_edb operations
                    309: */
                    310: extern struct connection       * connlist;     /* Connection blocks */
                    311: extern int                       conns_used;   /* No. conns in connlist */
                    312: extern struct connection       * connwaitlist; /* Connection blocks to be */
                    313: extern struct di_block         * deferred_dis; /* deferred di_blocks */
                    314: extern struct oper_act         * get_edb_ops;  /* GET_EDB operations */
                    315: extern struct PSAPaddr         * mydsaaddr;    /* PSAP of this DSA */
                    316: 
                    317: #endif

unix.superglobalmegacorp.com

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