DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T d

⟦cb32ff9d9⟧ TextFile

    Length: 3195 (0xc7b)
    Types: TextFile
    Names: »domsinfo2rfc.c«

Derivation

└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0
    └─⟦dc59850a2⟧ »EurOpenD22/pp5.0/pp-5.tar.Z« 
        └─⟦e5a54fb17⟧ 
            └─⟦this⟧ »pp-5.0/Lib/format/domsinfo2rfc.c« 

TextFile

/* domsinfo2rfc.c - Converts a DomSupInfo struct into a RFC string */

# ifndef lint
static char Rcsid[] = "@(#)$Header: /cs/research/pp/hubris/pp-beta/Lib/format/RCS/domsinfo2rfc.c,v 5.0 90/09/20 16:04:48 pp Exp Locker: pp $";
# endif

/*
 * $Header: /cs/research/pp/hubris/pp-beta/Lib/format/RCS/domsinfo2rfc.c,v 5.0 90/09/20 16:04:48 pp Exp Locker: pp $
 *
 * $Log:	domsinfo2rfc.c,v $
 * Revision 5.0  90/09/20  16:04:48  pp
 * rcsforce : 5.0 public release
 * 
 */



#include        "util.h"
#include        <isode/cmd_srch.h>
#include        "mta.h"
#include        "tb_p1.h"


extern CMD_TABLE        p1tbl_domsinfo[];

extern void 	encinfo2rfc ();
extern void	globalid2rfc ();
extern UTC	utclocalise ();

static void action2rfc ();
/* -------------------- Begin  Routines  ---------------------------------- */




void domsinfo2rfc (dominfo, buffer)  /* DomainSuppliedInfo -> RFC */
DomSupInfo      *dominfo;
char            *buffer;
{
	char    tbuf [LINESIZE],
		obuf [LOTS*3];
	UTC	lut;
	bzero (&obuf[0], sizeof obuf);


	/* -- arrival -- */
	if (dominfo -> dsi_time != 0 && 
	    (lut = utclocalise(dominfo -> dsi_time)) != NULLUTC &&
	    UTC2rfc (lut, tbuf) == OK) {
		(void) strcat (obuf, rcmd_srch (DSI_TIME, p1tbl_domsinfo));
		(void) strcat (obuf, " ");
		(void) strcat (obuf, tbuf);
		free ((char *) lut);
	}
	else
		return;


	/* -- deferred -- */
	if (dominfo -> dsi_deferred != 0 && 
	    (lut = utclocalise(dominfo -> dsi_deferred)) != NULLUTC &&
	    UTC2rfc (lut, tbuf) == OK) {
		(void) strcat (obuf, " ");
		(void) strcat (obuf,
				rcmd_srch (DSI_DEFERRED, p1tbl_domsinfo));
		(void) strcat (obuf, " ");
		(void) strcat (obuf, tbuf);
		free ((char *) lut);
	}


	/* -- action -- */
	action2rfc (dominfo -> dsi_action, tbuf);
	(void) strcat (obuf, " ");
	(void) strcat (obuf, rcmd_srch (DSI_ACTION, p1tbl_domsinfo));
	(void) strcat (obuf, " ");
	(void) strcat (obuf, tbuf);


	/* -- converted -- */
	if (dominfo -> dsi_converted.eit_types) {
		encinfo2rfc (&dominfo -> dsi_converted, tbuf);
		(void) strcat (obuf, " ");
		(void) strcat (obuf,
				rcmd_srch (DSI_CONVERTED, p1tbl_domsinfo));
		(void) strcat (obuf, " (");
		(void) strcat (obuf, tbuf);
		(void) strcat (obuf, ")");
	}


	/* -- attempted/previous -- */
	if (dominfo -> dsi_attempted_md.global_Country != NULLCP ||
	    dominfo -> dsi_attempted_md.global_Admin   != NULLCP ||
	    dominfo -> dsi_attempted_md.global_Private != NULLCP) {
		globalid2rfc (&dominfo -> dsi_attempted_md, tbuf);
		(void) strcat (obuf, " ");
		(void) strcat (obuf,
			rcmd_srch (DSI_ATTEMPTED, p1tbl_domsinfo));
		(void) strcat (obuf, " ");
		(void) strcat (obuf, tbuf);
	}

	(void) strcpy (buffer, obuf);

	PP_DBG (("Lib/domsinfo2rfc returns (%s)", buffer));

	return;

}




/* ---------------------  Static  Routines  ------------------------------- */




static void action2rfc (action, buffer)  /* DomainSuppliedInfo(action) -> RFC */
int     action;
char    *buffer;
{
	PP_DBG (("Lib/action2rfc(%d)", action));

	switch (action) {
	case ACTION_RELAYED:
		(void) strcpy (buffer, "Relayed");
		break;
	case ACTION_ROUTED:
		(void) strcpy (buffer, "Routed");
		break;
	default:
		(void) strcpy (buffer, "\0");
	}
	return;
}