Annotation of 43BSDReno/contrib/isode-beta/acsap/acsapblock.c, revision 1.1.1.1

1.1       root        1: /* acsapblock.c - manage association blocks */
                      2: 
                      3: #ifndef        lint
                      4: static char *rcsid = "$Header: /f/osi/acsap/RCS/acsapblock.c,v 7.0 89/11/23 21:21:46 mrose Rel $";
                      5: #endif
                      6: 
                      7: /* 
                      8:  * $Header: /f/osi/acsap/RCS/acsapblock.c,v 7.0 89/11/23 21:21:46 mrose Rel $
                      9:  *
                     10:  *
                     11:  * $Log:       acsapblock.c,v $
                     12:  * Revision 7.0  89/11/23  21:21:46  mrose
                     13:  * Release 6.0
                     14:  * 
                     15:  */
                     16: 
                     17: /*
                     18:  *                               NOTICE
                     19:  *
                     20:  *    Acquisition, use, and distribution of this module and related
                     21:  *    materials are subject to the restrictions of a license agreement.
                     22:  *    Consult the Preface in the User's Manual for the full terms of
                     23:  *    this agreement.
                     24:  *
                     25:  */
                     26: 
                     27: 
                     28: /* LINTLIBRARY */
                     29: 
                     30: #include <stdio.h>
                     31: #include "acpkt.h"
                     32: 
                     33: /*    DATA */
                     34: 
                     35: static int  once_only = 0;
                     36: static struct assocblk assocque;
                     37: static struct assocblk *ACHead = &assocque;
                     38: 
                     39: /*    ASSOCIATION BLOCKS */
                     40: 
                     41: struct assocblk  *newacblk () {
                     42:     register struct assocblk *acb;
                     43: 
                     44:     acb = (struct assocblk   *) calloc (1, sizeof *acb);
                     45:     if (acb == NULL)
                     46:        return NULL;
                     47: 
                     48:     acb -> acb_fd = NOTOK;
                     49: 
                     50:     if (once_only == 0) {
                     51:        ACHead -> acb_forw = ACHead -> acb_back = ACHead;
                     52:        once_only++;
                     53:     }
                     54: 
                     55:     insque (acb, ACHead -> acb_back);
                     56: 
                     57:     return acb;
                     58: }
                     59: 
                     60: /*  */
                     61: 
                     62: freeacblk (acb)
                     63: register struct assocblk *acb;
                     64: {
                     65:     if (acb == NULL)
                     66:        return;
                     67: 
                     68:     if (acb -> acb_flags & ACB_STICKY) {
                     69:        acb -> acb_flags &= ~ACB_STICKY;
                     70:        return;
                     71:     }
                     72: 
                     73:     if (acb -> acb_fd != NOTOK && acb -> acb_uabort)
                     74:        if (acb -> acb_flags & ACB_ACS) {
                     75:            if (acb -> acb_flags & ACB_RTS) {/* recurse */
                     76:                struct AcSAPindication  acis;
                     77: 
                     78:                (void) (*acb -> acb_uabort) (acb -> acb_fd, NULLPEP, 0, &acis);
                     79:                return;
                     80:            }
                     81:            else {
                     82:                struct PSAPindication   pis;
                     83: 
                     84:                (void) (*acb -> acb_uabort) (acb -> acb_fd, NULLPEP, 0, &pis);
                     85:            }
                     86:        }
                     87:        else {
                     88:            struct SSAPindication   sis;
                     89: 
                     90:            (void) (*acb -> acb_uabort) (acb -> acb_fd, NULLCP, 0, &sis);
                     91:        }
                     92: 
                     93:     if (acb -> acb_flags & ACB_FINISH)
                     94:        ACFFREE (&acb -> acb_finish);
                     95: 
                     96:     if (acb -> acb_context)
                     97:        oid_free (acb -> acb_context);
                     98:     if (acb -> acb_retry)
                     99:        pe_free (acb -> acb_retry);
                    100: 
                    101:     FREEACB (acb);
                    102: 
                    103:     if (acb -> acb_apdu)
                    104:        pe_free (acb -> acb_apdu);
                    105: 
                    106:     remque (acb);
                    107: 
                    108:     free ((char *) acb);
                    109: }
                    110: 
                    111: /*  */
                    112: 
                    113: struct assocblk   *findacblk (sd)
                    114: register int sd;
                    115: {
                    116:     register struct assocblk *acb;
                    117: 
                    118:     if (once_only == 0)
                    119:        return NULL;
                    120: 
                    121:     for (acb = ACHead -> acb_forw; acb != ACHead; acb = acb -> acb_forw)
                    122:        if (acb -> acb_fd == sd)
                    123:            return acb;
                    124: 
                    125:     return NULL;
                    126: }

unix.superglobalmegacorp.com

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