|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T a
Length: 4147 (0x1033)
Types: TextFile
Names: »acsaptest.c«
└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0
└─⟦35176feda⟧ »EurOpenD22/isode/isode-6.tar.Z«
└─⟦de7628f85⟧
└─⟦this⟧ »isode-6.0/acsap/acsaptest.c«
/* acsaptest.c - test out -lacsap */
#ifndef lint
static char *rcsid = "$Header: /f/osi/acsap/RCS/acsaptest.c,v 7.0 89/11/23 21:22:01 mrose Rel $";
#endif
/*
* $Header: /f/osi/acsap/RCS/acsaptest.c,v 7.0 89/11/23 21:22:01 mrose Rel $
*
*
* $Log: acsaptest.c,v $
* Revision 7.0 89/11/23 21:22:01 mrose
* Release 6.0
*
*/
/*
* NOTICE
*
* Acquisition, use, and distribution of this module and related
* materials are subject to the restrictions of a license agreement.
* Consult the Preface in the User's Manual for the full terms of
* this agreement.
*
*/
#include <stdio.h>
#define ACSE
#include "acpkt.h"
#include "isoservent.h"
#include "tailor.h"
#define NULLIE ((struct isoentity *) 0)
char *macro2str ();
struct TSAPaddr *ta2norm ();
/* \f
*/
/* ARGSUSED */
main (argc, argv, envp)
int argc;
char **argv,
**envp;
{
register struct isoentity *ie;
register struct isobject *io;
register struct isoservent *is;
isodetailor (argv[0], 1);
argc--, argv++;
if (argc == 1) {
if (strcmp (*argv, "-version") == 0)
printf ("%s\n", acsapversion);
else {
register struct PSAPaddr *pa;
if (!(pa = str2paddr (*argv)))
goto you_lose;
printent (NULLIE, NULLAEI, pa);
}
exit (0);
}
if (argc == 2) {
AEI aei;
struct PSAPaddr *pa;
if (strcmp (argv[0], "-macro") == 0) {
char *cp;
if ((cp = macro2str (argv[1])) == NULL)
goto you_lose;
printf ("%s\n", cp);
exit (0);
}
if (!(aei = str2aei (argv[0], argv[1])))
goto you_lose;
printent (NULLIE, aei, NULLPA);
if (!(pa = aei2addr (aei))) {
fprintf (stderr, "address translation failed\n");
exit (1);
}
printent (NULLIE, NULLAEI, pa);
}
else {
printf ("ISO Entities Database\n");
while (ie = getisoentity ())
printent (ie, oid2aei (&ie -> ie_identifier), &ie -> ie_addr);
printf ("\nISO Objects Database\n");
while (io = getisobject ())
printobj (io);
printf ("\nISO Services Database\n");
while (is = getisoservent ())
printsrv (is);
}
exit (0); /* NOTREACHED */
you_lose: ;
fprintf (stderr, "no such luck\n");
exit (1); /* NOTREACHED */
}
/* \f
*/
static printent (ie, aei, pa)
register struct isoentity *ie;
AEI aei;
register struct PSAPaddr *pa;
{
if (ie)
printf ("Entity: %s (%s)\n", ie -> ie_descriptor,
oid2ode (&ie -> ie_identifier));
if (aei)
printf ("AE info: %s\n", sprintaei (aei));
if (pa) {
struct PSAPaddr pas;
register struct TSAPaddr *ta = &pa -> pa_addr.sa_addr;
PE pe;
printf ("Address: %s\n", paddr2str (pa, NULLNA));
pe = NULLPE;
if (build_DSE_PSAPaddr (&pe, 1, NULL, NULLCP, (char *) pa) == NOTOK) {
printf ("build of PSAPaddr failed: %s\n", PY_pepy);
goto dont_touch;
}
bzero ((char *) &pas, sizeof pas);
if (parse_DSE_PSAPaddr (pe, 1, NULLIP, NULLVP, (char *) &pas) ==NOTOK){
printf ("parse of PSAPaddr failed: %s\n", PY_pepy);
goto dont_touch;
}
(void) print_DSE_PSAPaddr (pe, 1, NULLIP, NULLVP, NULLCP);
if (bcmp ((char *) pa, (char *) &pas, sizeof pas)) {
printf ("*** NOT EQUAL ***\n");
printf ("\told %s\n", paddr2str (pa, NULLNA));
printf ("\tnew %s\n", paddr2str (&pas, NULLNA));
}
dont_touch: ;
if (pe)
pe_free (pe);
{
struct TSAPaddr *tz = ta2norm (ta);
if (tz) {
if (bcmp ((char *) ta, (char *) tz, sizeof *tz))
printf ("NORM: %s\n", taddr2str (tz));
}
else
printf ("*** ta2norm FAILED ***\n");
}
}
if (ie || aei || pa)
printf ("\n");
}
/* \f
*/
static printobj (io)
register struct isobject *io;
{
printf ("ODE: \"%s\"\nOID: %s\n\n", io -> io_descriptor,
sprintoid (&io -> io_identity));
}
/* \f
*/
static printsrv (is)
register struct isoservent *is;
{
register int n = is -> is_tail - is -> is_vec - 1;
register char **ap = is -> is_vec;
printf ("ENT: \"%s\" PRV: \"%s\" SEL: %s\n",
is -> is_entity, is -> is_provider,
sel2str (is -> is_selector, is -> is_selectlen, 1));
for (; n >= 0; ap++, n--)
printf ("\t%d: \"%s\"\n", ap - is -> is_vec, *ap);
printf ("\n");
}