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 t

⟦ceaee23b9⟧ TextFile

    Length: 8166 (0x1fe6)
    Types: TextFile
    Names: »tai_chan.c«

Derivation

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

TextFile

/* tai_chan.c: channel specific tailoring code */

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

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



#include        "head.h"
#include        <isode/cmd_srch.h>
#include        "chan.h"
#include        "adr.h"



extern  int                     ch_maxchans;
extern  CMD_TABLE               qtbl_con_type[],
				atbl_types[],
				atbl_subtypes[];
extern void     		err_abrt();

static char chn_str[] =         "chan";
static  int                     ch_numchans = NULL;

char                            *tai_alloc();



/* keywords */
#define CH_NAME                 1
#define CH_PROGNAME             2
#define CH_SHOW                 3
#define CH_CHAN_TYPE            4
#define CH_CHAN_OUT             5
#define CH_COST                 6
#define CH_SORT                 7
#define CH_INFO                 8
#define CH_CONTENT_IN           9
#define CH_CONTENT_OUT          10
#define CH_AD_TYPE              11
#define CH_AD_SUBTYPE           12
#define CH_AD_ORDER             13
#define CH_BPT_IN               14
#define CH_BPT_OUT              15
#define CH_TABLE                16
#define CH_XMTA                 17
#define CH_ACCESS               18
#define CH_PROBE                19
#define CH_AUTHTBL              20
#define CH_DOMPARSE		21
#define CH_MAXPROC		22
#define CH_CONV			23

/* flatness */
#define CH_FLAT_P2              1
#define CH_FLAT_822             2



/* tables */

static CMD_TABLE   chtbl_key[] = {
	"name",                 CH_NAME,
	"prog",                 CH_PROGNAME,
	"show",                 CH_SHOW,
	"type",                 CH_CHAN_TYPE,
	"chanout",              CH_CHAN_OUT,
	"content-in",           CH_CONTENT_IN,
	"content-out",          CH_CONTENT_OUT,
	"cost",                 CH_COST,
	"sort",                 CH_SORT,
	"info",                 CH_INFO,
	"adr",                  CH_AD_TYPE,
	"subadr",               CH_AD_SUBTYPE,
	"adr-order",            CH_AD_ORDER,
	"bptin",                CH_BPT_IN,
	"bptout",               CH_BPT_OUT,
	"table",                CH_TABLE,
	"mta",                  CH_XMTA,
	"access",               CH_ACCESS,
	"probe",		CH_PROBE,
	"auth-tbl",             CH_AUTHTBL,
	"domain-norm",		CH_DOMPARSE,
	"conv",			CH_CONV,
	"maxproc",		CH_MAXPROC,
	0,                      -1
	};



static CMD_TABLE   chtbl_types[] = {
	"in",                   CH_IN,
	"out",                  CH_OUT,
	"both",                 CH_BOTH,
	"shaper",               CH_SHAPER,
	"warn",                 CH_WARNING,
	"delete",               CH_DELETE,
	"qmgrload",             CH_QMGR_LOAD,
	"debris",               CH_DEBRIS,
	"timeout",              CH_TIMEOUT,
	0,                      -1
	};



static CMD_TABLE   chtbl_sort[] = {
	"user",                 CH_SORT_USR,
	"mta",                  CH_SORT_MTA,
	"priority",             CH_SORT_PRIORITY,
	"time",                 CH_SORT_TIME,
	"size",                 CH_SORT_SIZE,
	0,                      -1
	};


static CMD_TABLE   chtbl_ad_order[] = {
	"usa",                  CH_USA_ONLY,
	"uk",                   CH_UK_ONLY,
	"usapref",              CH_USA_PREF,
	"ukpref",               CH_UK_PREF,
	0,                      -1
	};

static CMD_TABLE chtbl_access[] = {
	"mta",          CH_MTA,
	"mts",          CH_MTS,
	0,                      -1
	};

static CMD_TABLE chtbl_domparse[] = {
	"full",		CH_DOMAIN_NORM_ALL,
	"partial",	CH_DOMAIN_NORM_PARTIAL,
	0,		-1
	};

static CMD_TABLE chtbl_conv[] = {
	"none",		CH_CONV_NONE,
	"1148",		CH_CONV_1148,
	"conv",		CH_CONV_CONVERT,
	"loss",		CH_CONV_WITHLOSS,
	0,		-1
	};

/* ---------------------  Begin  Routines  -------------------------------- */

chan_tai (argc, argv)
int     argc;
char    **argv;
{
	register CHAN   *cp;
	char            *tbname = NULLCP,
			*arg,
			*p,
			*ch_sort_arg[CH_MAX_SORT];
	int             ind,
			val,
			i,
			n_ch_sort,
			retval;


	PP_DBG (("chan_tai()"));

	if (argc < 2 || lexequ (argv[0], chn_str) != 0)  return (NOTOK);

	if (ch_numchans + 1 >= ch_maxchans) {
		PP_OPER (NULLCP, ("tailor: has too many channels\n"));
		return (NOTOK);
	}

	arg = tai_alloc (*++argv);
	ch_all[ch_numchans++] = cp = (CHAN *) smalloc ((sizeof (CHAN)));
	ch_all[ch_numchans] = NULLCHAN;


	/* -- Initialize the malloc'd channel -- */
	bzero ((char *)cp, sizeof(*cp));
	bzero (&cp->ch_sort[0], CH_MAX_SORT);
	cp -> ch_sort[1]	= CH_SORT_TIME;
	cp -> ch_name           = arg;
	cp -> ch_access         = CH_MTA;
	cp -> ch_ad_order       = CH_USA_ONLY;
	cp -> ch_ad_type	= AD_822_TYPE;
	cp -> ch_domain_norm	= CH_DOMAIN_NORM_PARTIAL;
	cp -> ch_conversion	= CH_CONV_NONE;

	argc -= 2;
	argv++;

	for (ind = 0; ind < argc; ind++) {

		if ((p = index (argv[ind], '=')) == NULLCP)
			continue;

		*p++ = '\0';
		PP_DBG (("tai/tai_chan %s = %s", argv[ind], p));

		switch (retval = cmd_srch (argv[ind], chtbl_key)) {

		    case CH_NAME:
			cp->ch_name = tai_alloc (p);
			break;

		    case CH_PROGNAME:
			cp->ch_progname = tai_alloc (p);
			break;

		    case CH_SHOW:
			cp->ch_show = tai_alloc (p);
			break;

		    case CH_CHAN_TYPE:
			val = cmd_srch (p, chtbl_types);
			if (val == NOTOK)
				cp -> ch_chan_type = CH_SHAPER;
			else
				cp -> ch_chan_type = val;
			break;

		    case CH_CHAN_OUT:
			cp->ch_chan_out = tai_alloc (p);
			break;

		    case CH_COST:
			cp->ch_cost = atoi(p);
			break;

		    case CH_SORT:
			n_ch_sort = sstr2arg
				(p, CH_MAX_SORT, ch_sort_arg, " ");

			if (n_ch_sort < 0 || n_ch_sort > CH_MAX_SORT)
				err_abrt (RP_MECH, "tai_chan.c/sort narg!");

			for (i=0; i < n_ch_sort; i++) {
				val = cmd_srch (ch_sort_arg[i], chtbl_sort);
				if (val == NOTOK)
					err_abrt (RP_MECH,
						  "tai_chan.c/sort arg!");
				cp->ch_sort[i] = val;
			}
			break;

		    case CH_INFO:
			cp->ch_info = tai_alloc (p);
			break;

		    case CH_CONTENT_IN:
			cp->ch_content_in = tai_alloc (p);
			break;

		    case CH_CONTENT_OUT:
			cp->ch_content_out = tai_alloc (p);
			break;

		    case CH_AD_TYPE:
			val = cmd_srch (p, atbl_types);
			if (val == NOTOK)
				cp -> ch_ad_type = AD_ANY_TYPE;
			else
				cp -> ch_ad_type = val;
			break;

		    case CH_AD_SUBTYPE:
			val = cmd_srch (p, atbl_subtypes);
			if (val == NOTOK)
				cp -> ch_ad_subtype = AD_NOSUBTYPE;
			else
				cp -> ch_ad_subtype = val;
			break;

		    case CH_AD_ORDER:
			val = cmd_srch (p, chtbl_ad_order);
			if (val == NOTOK)
				cp -> ch_ad_order = CH_UK_PREF;
			else
				cp -> ch_ad_order = val;
			break;


		    case CH_BPT_IN:
			if (txt2listbpt (&cp -> ch_bpt_in, p) == NOTOK)
				err_abrt (RP_MECH,
					  "tai_chan.c/bptin types unknown");
			break;

		    case CH_BPT_OUT:
			if (txt2listbpt (&cp -> ch_bpt_out, p) == NOTOK)
				err_abrt (RP_MECH,
					  "tai_chan.c/bptout types unknown");
			break;

		    case CH_TABLE:
			if (lexequ (p, "none") == 0)
				tbname = NULLCP;
			else
				tbname = p;
			break;

		    case CH_AUTHTBL:
			if ((cp -> ch_auth_tbl = tb_nm2struct (p)) == NULLTBL)
				err_abrt (RP_MECH,
					  "tai_chan.c/Unknown table '%s'", p);
			break;

		    case CH_XMTA:
			cp -> ch_mta = tai_alloc (p);
			break;

		    case CH_ACCESS:
			val = cmd_srch (p, chtbl_access);
			if (val != NOTOK)
				cp -> ch_access = val;
			break;

		    case CH_PROBE:
			if (lexequ (p, "y") == 0 || lexequ (p, "yes") == 0)
				cp -> ch_probe = TRUE;
			break;

		    case CH_DOMPARSE:
			val = cmd_srch (p, chtbl_domparse);
			if (val != NOTOK)
				cp -> ch_domain_norm = val;
			break;

		    case CH_MAXPROC:
			cp -> ch_maxproc = atoi (p);
			break;
		    case CH_CONV:
			val = cmd_srch (p, chtbl_conv);
			if (val != NOTOK)
				cp -> ch_conversion = val;
			break;
		    default:
			PP_DBG (("tai_chan.c/default %d %s",
				 retval, argv[ind]));
		}

	}


	if (tbname != NULLCP) {
		cp->ch_table = tb_nm2struct (tbname);
		if (cp->ch_table == NULLTBL)
			err_abrt (RP_MECH, "tai_chan.c/Unknown table %s",
					tbname);
	}
	return (OK);
}