Annotation of 43BSDReno/contrib/isode-beta/dsap/x500as/qu-enc.py, revision 1.1.1.1

1.1       root        1: -- quipu-enc.py - additional QUIPU directory type definitions module
                      2: 
                      3: -- $Header: /f/osi/dsap/x500as/RCS/qu-enc.py,v 7.0 89/11/23 21:50:47 mrose Rel $
                      4: --
                      5: --
                      6: -- $Log:       qu-enc.py,v $
                      7: -- Revision 7.0  89/11/23  21:50:47  mrose
                      8: -- Release 6.0
                      9: -- 
                     10: 
                     11: --
                     12: --                               NOTICE
                     13: --
                     14: --    Acquisition, use, and distribution of this module and related
                     15: --    materials are subject to the restrictions of a license agreement.
                     16: --    Consult the Preface in the User's Manual for the full terms of
                     17: --    this agreement.
                     18: --
                     19: --
                     20: 
                     21: 
                     22: Quipu
                     23:        {
                     24:        ccitt
                     25:        data(9)
                     26:        pss(2342)
                     27:        ucl(19200300)
                     28:        quipu(99)
                     29:        directoryDefinitions(1)
                     30:        }
                     31: 
                     32: DEFINITIONS ::=
                     33: 
                     34: %{
                     35: #include <stdio.h>
                     36: #include "quipu/util.h"
                     37: #include "quipu/entry.h"
                     38: #include "quipu/authen.h"
                     39: 
                     40: extern  LLog    * log_dsap;
                     41: #define encode_UNIV_PrintableString build_UNIV_PrintableString
                     42: #define encode_UNIV_UTCTime build_UNIV_UTCTime
                     43: %}
                     44: 
                     45: PREFIXES encode decode print
                     46: 
                     47: BEGIN
                     48: 
                     49: IMPORTS
                     50:        NameError ,
                     51:        ServiceError ,
                     52:        SecurityError
                     53:                FROM DAS
                     54:                        {
                     55:                        joint-iso-ccitt
                     56:                        ds(5)
                     57:                        modules(1)
                     58:                        directoryAbstractService(2)
                     59:                        }
                     60: 
                     61:        DistinguishedName ,
                     62:        RelativeDistinguishedName ,
                     63:        Attribute ,
                     64:        AttributeType
                     65:                FROM IF
                     66:                        {
                     67:                        joint-iso-ccitt
                     68:                        ds(5)
                     69:                        modules(1)
                     70:                        informationFramework(1)
                     71:                        }
                     72:        AlgorithmIdentifier
                     73:                FROM AF {
                     74:                        joint-iso-ccitt
                     75:                        ds(5)
                     76:                        modules(1)
                     77:                        authenticationFramework(7)
                     78:                        };
                     79: 
                     80: -- ReliableROSData
                     81: --     ::=
                     82: --     SEQUENCE
                     83: --     {
                     84: --     rosOperation
                     85: --             INTEGER ,
                     86:                -- the operation being applied
                     87: --     data
                     88: --             ANY ,
                     89:                -- the Operation Argument
                     90: --     oldVersion
                     91: --             ANY ,
                     92:                -- data version to which operation should be applied
                     93: --     newVersion
                     94: --             ANY
                     95:                -- version number which results from operation
                     96: --     }
                     97: 
                     98: ENCODER encode
                     99: 
                    100: AccessSelector [[P struct acl_info *]]
                    101:         ::=
                    102:         %{
                    103:                 DLOG(log_dsap, LLOG_PDUS, ("About to encode AccessSelector"));
                    104:         %}
                    105:         CHOICE <<parm->acl_selector_type + 1>>
                    106:         {
                    107:         entry
                    108:                 [0] NULL ,
                    109:         other
                    110:                 [2] NULL ,
                    111:         prefix
                    112:                 [3] NameList [[p parm->acl_name]] ,
                    113:         group
                    114:                 [4] NameList [[p parm->acl_name]]
                    115:         }
                    116:         %{
                    117:                 DLOG(log_dsap, LLOG_PDUS, ("Done encode AccessSelector"));
                    118:         %}
                    119: 
                    120: AccessCategories [[P u_char]]
                    121:         ::=
                    122:         %{
                    123:                 DLOG(log_dsap, LLOG_PDUS, ("About to encode AccessCategories"));
                    124:         %}
                    125:         ENUMERATED [[i parm]]
                    126:         {
                    127:                 none (0) ,
                    128:                 detect (1) ,
                    129:                 compare (2) ,
                    130:                 read (3) ,
                    131:                 add (4) ,
                    132:                 write (5)
                    133:         }
                    134:         %{
                    135:                 DLOG(log_dsap, LLOG_PDUS, ("Done encode AccessCategories"));
                    136:         %}
                    137: 
                    138: ACLInfo [[P struct acl_info *]]
                    139: %{
                    140: struct acl_info * ai_tmp;
                    141: %}
                    142:         ::=
                    143:         %{
                    144:                 DLOG(log_dsap, LLOG_PDUS, ("About to encode ACLInfo"));
                    145:         %}
                    146:         SET OF
                    147:         <<ai_tmp=parm; ai_tmp != NULLACL_INFO; ai_tmp=ai_tmp->acl_next>>
                    148:                 SEQUENCE
                    149:                 {
                    150:                         AccessSelector [[p ai_tmp]] ,
                    151:                         AccessCategories [[p ai_tmp->acl_categories]]
                    152:                 }
                    153:         %{
                    154:                 DLOG(log_dsap, LLOG_PDUS, ("Done encode ACLInfo"));
                    155:         %}
                    156: 
                    157: AttributeACL [[P struct acl_attr *]]
                    158: %{
                    159: struct oid_seq  * os_tmp;
                    160: %}
                    161:         ::=
                    162:         %{
                    163:                 DLOG(log_dsap, LLOG_PDUS, ("About to encode AttributeACL"));
                    164:         %}
                    165:         SEQUENCE
                    166:         {
                    167:                 SET OF
                    168:                 <<os_tmp=parm->aa_types; os_tmp != NULLOIDSEQ; os_tmp=os_tmp->oid_next>>
                    169:                        -- AttributeType
                    170:                         OBJECT IDENTIFIER [[O os_tmp->oid_oid]] ,
                    171:                 ACLInfo [[p parm->aa_acl]]
                    172:                     -- DEFAULT {{other , read}, {entry, write}}
                    173:                     OPTIONAL <<test_acl_default(parm->aa_acl) != OK>>
                    174:         }
                    175:         %{
                    176:                 DLOG(log_dsap, LLOG_PDUS, ("Done encode AttributeACL"));
                    177:         %}
                    178: 
                    179: ACLSyntax [[P struct acl *]]
                    180: %{
                    181: struct acl_attr *       aa_tmp;
                    182: %}
                    183:         ::=
                    184:         %{
                    185:                 DLOG(log_dsap, LLOG_PDUS, ("About to encode ACLSyntax"));
                    186:         %}
                    187:         SEQUENCE
                    188:         {
                    189:         childACL
                    190:                 [0] ACLInfo [[p parm->ac_child]]
                    191:                     -- DEFAULT {{other , read}, {entry, write}} ,
                    192:                     OPTIONAL <<test_acl_default(parm->ac_child) != OK>> ,
                    193:         entryACL
                    194:                 [1] ACLInfo [[p parm->ac_entry]]
                    195:                     -- DEFAULT {{other , read}, {entry, write}} ,
                    196:                     OPTIONAL <<test_acl_default(parm->ac_entry) != OK>> ,
                    197:         defaultAttributeACL
                    198:                 [2] ACLInfo [[p parm->ac_default]]
                    199:                     -- DEFAULT {{other , read}, {entry, write}} ,
                    200:                     OPTIONAL <<test_acl_default(parm->ac_default) != OK>> ,
                    201:                 [3] SET OF
                    202:                 <<aa_tmp=parm->ac_attributes; aa_tmp!=NULLACL_ATTR; aa_tmp=aa_tmp->aa_next>>
                    203:                         AttributeACL [[p aa_tmp]]
                    204:         }
                    205:         %{
                    206:                 DLOG(log_dsap, LLOG_PDUS, ("Done encode ACLSyntax"));
                    207:         %}
                    208: 
                    209: NameList [[P struct dn_seq *]]
                    210: %{
                    211: struct dn_seq   *       dns_tmp;
                    212: %}
                    213:         ::=
                    214:         %{
                    215:                 DLOG(log_dsap, LLOG_PDUS, ("About to encode NameList"));
                    216:         %}
                    217:         SET OF
                    218:         <<dns_tmp=parm; dns_tmp!=NULLDNSEQ; dns_tmp=dns_tmp->dns_next>>
                    219:                 DistinguishedName [[p dns_tmp->dns_dn]]
                    220:         %{
                    221:                 DLOG(log_dsap, LLOG_PDUS, ("Done encode NameList"));
                    222:         %}
                    223: 
                    224: EDBInfoSyntax [[P struct edb_info *]]
                    225:         ::=
                    226:         %{
                    227:                 DLOG(log_dsap, LLOG_PDUS, ("About to encode EDBInfoSyntax"));
                    228:         %}
                    229:         SEQUENCE
                    230:         {
                    231:         edb
                    232:                 DistinguishedName [[p parm->edb_name]] ,
                    233:         getFromDSA
                    234:                 DistinguishedName [[p parm->edb_getfrom]]
                    235:                    OPTIONAL <<parm->edb_getfrom != NULLDN>> ,
                    236:         sendToDSAs
                    237:                 NameList [[p parm->edb_sendto]] ,
                    238:        getEDBAllowed
                    239:                NameList [[p parm->edb_allowed]]
                    240:         }
                    241:         %{
                    242:                 DLOG(log_dsap, LLOG_PDUS, ("Done encode EDBInfoSyntax"));
                    243:         %}
                    244: 
                    245: TreeStructureSyntax [[P struct tree_struct *]]
                    246: %{
                    247: OID     oid_tmp;
                    248: int    do_once;
                    249: %}
                    250:         ::=
                    251:         %{
                    252:                 DLOG(log_dsap, LLOG_PDUS, ("About to encode TreeStructureSyntax"));
                    253:                if (parm->tree_object == NULLOBJECTCLASS) {
                    254:                        DLOG(log_dsap, LLOG_DEBUG, ("NULL OID in tree structure"));
                    255:                        oid_tmp = NULLOID;
                    256:                } else {
                    257:                        oid_tmp = oid_cpy(parm->tree_object->oc_ot.ot_oid);
                    258:                        DLOG(log_dsap, LLOG_DEBUG, ("oc encodes as oid: %s", sprintoid(oid_tmp)));
                    259:                }
                    260:         %}
                    261:         SET
                    262:        {
                    263:        mandatoryObjectClasses
                    264:                [1] SET OF
                    265:                %{
                    266:                        DLOG(log_dsap, LLOG_DEBUG, ("Another mandatory oc"));
                    267:                %}
                    268:                <<do_once = 1; do_once != 0; do_once = 0>>
                    269:                        OBJECT IDENTIFIER [[O oid_tmp]] ,
                    270:        optionalObjectClasses
                    271:                [2] SET OF
                    272:                        OBJECT IDENTIFIER
                    273:                    -- OPTIONAL <<FALSE>> ,
                    274:                    OPTIONAL ,
                    275:        permittedRDNs
                    276:                [3] SET OF
                    277:                        SET OF
                    278:                                AttributeType [[p NULLAttrT]]
                    279:        }
                    280:         %{
                    281:                if(oid_tmp != NULLOID)
                    282:                    oid_free (oid_tmp);
                    283:                 DLOG(log_dsap, LLOG_PDUS, ("Done encode TreeStructureSyntax"));
                    284:         %}
                    285: 
                    286: EntryDataBlock [[P struct entry *]]
                    287: %{
                    288: struct entry    * ent_tmp;
                    289: %}
                    290:         ::=
                    291:         %{
                    292:                 DLOG(log_dsap, LLOG_TRACE, ("About to encode EntryDataBlock"));
                    293:         %}
                    294:         SEQUENCE OF
                    295:         <<ent_tmp = parm; ent_tmp != NULLENTRY; ent_tmp=ent_tmp->e_sibling>>
                    296:                 RelativeEntry [[p ent_tmp]]
                    297:         %{
                    298:                 DLOG(log_dsap, LLOG_TRACE, ("Done encode EntryDataBlock"));
                    299:         %}
                    300: 
                    301: RelativeEntry [[P struct entry *]]
                    302: %{
                    303: Attr_Sequence   as_tmp;
                    304: %}
                    305:         ::=
                    306:         %{
                    307:                 DLOG(log_dsap, LLOG_PDUS, ("About to encode RelativeEntry"));
                    308:         %}
                    309:         SEQUENCE
                    310:         {
                    311:                 RelativeDistinguishedName [[p parm->e_name]] ,
                    312:                 SET OF
                    313:                 <<as_tmp = parm->e_attributes; as_tmp != NULLATTR; as_tmp=as_tmp->attr_link>>
                    314:                         Attribute [[p as_tmp]]
                    315:         }
                    316:         %{
                    317:                 DLOG(log_dsap, LLOG_PDUS, ("Done encode RelativeEntry"));
                    318:         %}
                    319: 
                    320: EDBVersion [[P char *]]
                    321: %{
                    322: %}
                    323:        ::=
                    324:         %{
                    325:                 DLOG(log_dsap, LLOG_PDUS, ("About to encode EDBVersion"));
                    326:                if(parm == NULLCP)
                    327:                    LLOG(log_dsap, LLOG_EXCEPTIONS, ("NULL CP Version encoded!"));
                    328:         %}
                    329:        UTCTime [[s parm]]
                    330:         %{
                    331:                 DLOG(log_dsap, LLOG_PDUS, ("Done encode EDBVersion"));
                    332:         %}
                    333: 
                    334: GetEntryDataBlockArgument [[P struct getedb_arg *]]
                    335:        ::=
                    336:         %{
                    337:                 DLOG(log_dsap, LLOG_TRACE, ("About to encode GetEntryDataBlockArgument"));
                    338:         %}
                    339:        SET
                    340:        {
                    341:        entry
                    342:                [0] DistinguishedName [[p parm->ga_entry]] ,
                    343:        sendIfMoreRecentThan
                    344:                [1] EDBVersion [[p parm->ga_version]]
                    345:                    OPTIONAL <<parm->ga_version != NULL>>
                    346:                        -- if omitted, send in any case
                    347:        }
                    348:         %{
                    349:                 DLOG(log_dsap, LLOG_TRACE, ("Done encode GetEntryDataBlockArgument"));
                    350:         %}
                    351: 
                    352: GetEntryDataBlockResult [[P struct getedb_result *]]
                    353:        ::=
                    354:         %{
                    355:                 DLOG(log_dsap, LLOG_TRACE, ("About to encode GetEntryDataBlockResult"));
                    356:         %}
                    357:        SEQUENCE
                    358:        {
                    359:        versionHeld
                    360:                [0] EDBVersion [[p parm->gr_version]] ,
                    361:                [1] EntryDataBlock [[p parm->gr_edb]]
                    362:                    OPTIONAL <<parm->gr_edb != NULLENTRY>>
                    363:        }
                    364:         %{
                    365:                 DLOG(log_dsap, LLOG_TRACE, ("Done encode GetEntryDataBlockResult"));
                    366:         %}
                    367: 
                    368: 
                    369: ProtectedPassword [[P struct protected_password *]]
                    370:        ::=
                    371:        %{
                    372:                DLOG(log_dsap, LLOG_TRACE, ("About to encode ProtectedPassword"));
                    373:        %}
                    374:        SEQUENCE 
                    375:        {
                    376:                algorithm [0] AlgorithmIdentifier [[p (struct alg_id *)0 ]]
                    377:                        -- OPTIONAL <<FALSE>>,
                    378:                        OPTIONAL ,
                    379:                salt [1] SET 
                    380:                        {
                    381:                        time1 [0] UTCTime [[s parm->time1]]
                    382:                                OPTIONAL <<parm->time1 != NULLCP>>,
                    383:                        time2 [1] UTCTime [[s parm->time2]]
                    384:                                OPTIONAL <<parm->time2 != NULLCP>>,
                    385:                        random1 [2] BIT STRING
                    386:                                -- OPTIONAL <<FALSE>>,
                    387:                                OPTIONAL ,
                    388:                        random2 [3] BIT STRING
                    389:                                -- OPTIONAL <<FALSE>> 
                    390:                                OPTIONAL 
                    391:                        }
                    392:                        OPTIONAL <<(parm->protected != '\0')>>,
                    393:                password [2] OCTET STRING 
                    394:                        [[o (parm->passwd) $ (parm->n_octets)]]
                    395:        }
                    396:        %{
                    397:                DLOG(log_dsap, LLOG_TRACE, ("Done decode ProtectedPassword"));
                    398:        %}
                    399:                
                    400:        
                    401: END

unix.superglobalmegacorp.com

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