386BSD 0.1 development
[unix-history] / usr / othersrc / contrib / isode / acsap / aetseq.c
CommitLineData
48435ab0
WJ
1/* aetseq.c - application entity titles -- sequential lookup */
2
3#ifndef lint
4static char *rcsid = "$Header: /f/osi/acsap/RCS/aetseq.c,v 7.1 91/02/22 09:14:30 mrose Interim $";
5#endif
6
7/*
8 * $Header: /f/osi/acsap/RCS/aetseq.c,v 7.1 91/02/22 09:14:30 mrose Interim $
9 *
10 *
11 * $Log: aetseq.c,v $
12 * Revision 7.1 91/02/22 09:14:30 mrose
13 * Interim 6.8
14 *
15 * Revision 7.0 89/11/23 21:22:07 mrose
16 * Release 6.0
17 *
18 */
19
20/*
21 * NOTICE
22 *
23 * Acquisition, use, and distribution of this module and related
24 * materials are subject to the restrictions of a license agreement.
25 * Consult the Preface in the User's Manual for the full terms of
26 * this agreement.
27 *
28 */
29
30
31/* LINTLIBRARY */
32
33#include <stdio.h>
34#include "psap.h"
35#include "isoaddrs.h"
36
37/* \f DATA */
38
39static char objent[BUFSIZ];
40static struct isoentity ies;
41
42/* \f */
43
44int str2aet_seq (designator, qualifier, iep)
45char *designator,
46 *qualifier;
47struct isoentity *iep;
48{
49 int hitdes,
50 hitqual;
51 char descriptor[BUFSIZ],
52 desdflt[BUFSIZ],
53 qualdflt[BUFSIZ];
54 register struct isoentity *ie;
55 struct isoentity ids,
56 iqs;
57
58 (void) sprintf (objent, "%s-%s", designator, qualifier);
59 (void) sprintf (desdflt, "%s-%s", designator, "default");
60 (void) sprintf (qualdflt, "%s-%s", "default", qualifier);
61 hitdes = hitqual = 0;
62 bzero ((char *) &ids, sizeof ids);
63 bzero ((char *) &iqs, sizeof iqs);
64
65 ie = NULL;
66
67 if (!setisoentity (0))
68 return NOTOK;
69 while (_startisoentity (descriptor) == OK) {
70 if (strcmp (descriptor, objent) == 0) {
71 if (_stopisoentity (descriptor, &ies) != OK)
72 continue;
73
74 ie = &ies;
75 break;
76 }
77
78 if (!hitdes && strcmp (descriptor, desdflt) == 0) {
79 if (_stopisoentity (descriptor, &ies) != OK)
80 continue;
81 ies.ie_descriptor = objent;
82
83 hitdes++;
84 ids = ies; /* struct copy */
85 continue;
86 }
87
88 if (!hitqual && strcmp (descriptor, qualdflt) == 0) {
89 if (_stopisoentity (descriptor, &ies) != OK)
90 continue;
91 ies.ie_descriptor = objent;
92
93 hitqual++;
94 iqs = ies; /* struct copy */
95 continue;
96 }
97 }
98 (void) endisoentity ();
99
100 if (!ie && hitqual) {
101 ie = &ies;
102 *ie = iqs; /* struct copy */
103
104 if (hitdes) {
105 bcopy ((char *) ids.ie_addr.pa_addr.sa_addr.ta_addrs,
106 (char *) ie -> ie_addr.pa_addr.sa_addr.ta_addrs,
107 sizeof ie -> ie_addr.pa_addr.sa_addr.ta_addrs);
108 ie -> ie_addr.pa_addr.sa_addr.ta_naddr =
109 ids.ie_addr.pa_addr.sa_addr.ta_naddr;
110 }
111 }
112
113 if (ie) {
114 *iep = *ie; /* struct copy */
115 return OK;
116 }
117
118 return NOTOK;
119}