|
|
1.1 root 1: /* tailor.c - ISODE tailoring */
2:
3: #ifndef lint
4: static char *rcsid = "$Header: /f/osi/compat/RCS/tailor.c,v 7.6 90/07/09 14:32:25 mrose Exp $";
5: #endif
6:
7: /*
8: * $Header: /f/osi/compat/RCS/tailor.c,v 7.6 90/07/09 14:32:25 mrose Exp $
9: *
10: *
11: * $Log: tailor.c,v $
12: * Revision 7.6 90/07/09 14:32:25 mrose
13: * sync
14: *
15: * Revision 7.5 90/03/08 08:01:12 mrose
16: * ending
17: *
18: * Revision 7.4 90/02/19 13:07:20 mrose
19: * update
20: *
21: * Revision 7.3 90/01/11 18:35:16 mrose
22: * real-sync
23: *
24: * Revision 7.2 89/12/12 16:14:57 mrose
25: * localHost
26: *
27: * Revision 7.1 89/11/30 23:53:32 mrose
28: * touch-up
29: *
30: * Revision 7.0 89/11/23 21:23:45 mrose
31: * Release 6.0
32: *
33: */
34:
35: /*
36: * NOTICE
37: *
38: * Acquisition, use, and distribution of this module and related
39: * materials are subject to the restrictions of a license agreement.
40: * Consult the Preface in the User's Manual for the full terms of
41: * this agreement.
42: *
43: */
44:
45:
46: /* LINTLIBRARY */
47:
48: #include <ctype.h>
49: #include <stdio.h>
50: #include "general.h"
51: #include "manifest.h"
52: #include "isoaddrs.h"
53: #include "tailor.h"
54:
55:
56: #define SUBNET_MAX (4 + 10) /* maximum number of subnet entries */
57:
58: /* DATA */
59:
60: struct pair {
61: char *p_name;
62: int p_value;
63: };
64:
65:
66: static char *isotailor = "isotailor";
67:
68:
69: char *isodename = "";
70:
71: char *isodebinpath = BINPATH;
72: char *isodesbinpath = SBINPATH;
73: char *isodetcpath = ETCPATH;
74: char *isodelogpath = LOGPATH;
75:
76:
77: static struct pair ll_pairs[] = {
78: "none", LLOG_NONE,
79: "fatal", LLOG_FATAL,
80: "exceptions", LLOG_EXCEPTIONS,
81: "notice", LLOG_NOTICE,
82: "pdus", LLOG_PDUS,
83: "trace", LLOG_TRACE,
84: "debug", LLOG_DEBUG,
85: "all", LLOG_ALL,
86:
87: NULL
88: };
89:
90: static char *compatdebug = "none";
91: LLog _compat_log = {
92: "%d.log", NULLCP, "compat", LLOG_NONE, LLOG_NONE, -1,
93: LLOGCLS | LLOGCRT | LLOGZER, NOTOK
94: };
95: LLog *compat_log = &_compat_log;
96:
97: static char *addrdebug = "none";
98: LLog _addr_log = {
99: "%d.log", "addr", NULLCP, LLOG_NONE, LLOG_NONE, -1,
100: LLOGCLS | LLOGCRT | LLOGZER, NOTOK
101: };
102: LLog *addr_log = &_addr_log;
103:
104: static char *tsapdebug = "none";
105: LLog _tsap_log = {
106: "%d.tpkt", "tsap", NULLCP, LLOG_NONE, LLOG_NONE, -1,
107: LLOGCLS | LLOGCRT | LLOGZER, NOTOK
108: };
109: LLog *tsap_log = &_tsap_log;
110:
111: static char *ssapdebug = "none";
112: LLog _ssap_log = {
113: "%d.spkt", "ssap", NULLCP, LLOG_NONE, LLOG_NONE, -1,
114: LLOGCLS | LLOGCRT | LLOGZER, NOTOK
115: };
116: LLog *ssap_log = &_ssap_log;
117:
118: static char *psapdebug = "none";
119: LLog _psap_log = {
120: "%d.pe", NULLCP, "psap", LLOG_NONE, LLOG_NONE, -1,
121: LLOGCLS | LLOGCRT | LLOGZER, NOTOK
122: };
123: LLog *psap_log = &_psap_log;
124:
125: static char *psap2debug = "none";
126: LLog _psap2_log = {
127: "%d.ppkt", "psap2", NULLCP, LLOG_NONE, LLOG_NONE, -1,
128: LLOGCLS | LLOGCRT | LLOGZER, NOTOK
129: };
130: LLog *psap2_log = &_psap2_log;
131:
132: static char *acsapdebug = "none";
133: LLog _acsap_log = {
134: "%d.acpkt", "acsap", NULLCP, LLOG_NONE, LLOG_NONE, -1,
135: LLOGCLS | LLOGCRT | LLOGZER, NOTOK
136: };
137: LLog *acsap_log = &_acsap_log;
138:
139: static char *rtsapdebug = "none";
140: LLog _rtsap_log = {
141: "%d.rtpkt", "rtsap", NULLCP, LLOG_NONE, LLOG_NONE, -1,
142: LLOGCLS | LLOGCRT | LLOGZER, NOTOK
143: };
144: LLog *rtsap_log = &_rtsap_log;
145:
146: static char *rosapdebug = "none";
147: LLog _rosap_log = {
148: "%d.ropkt", "rosap", NULLCP, LLOG_NONE, LLOG_NONE, -1,
149: LLOGCLS | LLOGCRT | LLOGZER, NOTOK
150: };
151: LLog *rosap_log = &_rosap_log;
152:
153:
154: #define TS_MASK "\020\01TCP\02X25\03BRG\04TP4"
155:
156: static struct pair ts_pairs[] = {
157: "tcp", TS_TCP,
158: "x25", TS_X25,
159: "bridge", TS_BRG,
160: "tp4", TS_TP4,
161: "all", TS_ALL,
162:
163: NULL
164: };
165:
166: static char *_ts_stacks = "all";
167: int ts_stacks = TS_ALL;
168:
169: static char *_ts_interim = "";
170: struct ts_interim ts_interim[SUBNET_MAX + 1] = {
171: "realNS", NULL, SUBNET_REALNS, NA_NSAP, "", 0,
172: "Int-X25", NULL, SUBNET_INT_X25, NA_X25, "", 0,
173: "Janet", NULL, SUBNET_JANET, NA_X25, "", 0,
174: "Internet", NULL, SUBNET_INTERNET, NA_TCP, "", 0,
175: "localTCP", NULL, SUBNET_DYNAMIC - 1, NA_TCP, "", 0,
176:
177: NULL
178: };
179:
180: static char *_ts_communities = "all";
181: int ts_communities[SUBNET_MAX + 1];
182:
183: static char *_ts_comm_nsap_default = "realNS";
184: int ts_comm_nsap_default = SUBNET_REALNS;
185:
186: static char *_ts_comm_x25_default = "Int-X25";
187: int ts_comm_x25_default = SUBNET_INT_X25;
188:
189: static char *_ts_comm_tcp_default = "Internet";
190: int ts_comm_tcp_default = SUBNET_INTERNET;
191:
192: int tsb_communities[SUBNET_MAX + 1];
193: char *tsb_addresses[SUBNET_MAX + 1];
194: static char *_tsb_config = "";
195: char *tsb_default_address = "undefined";
196:
197:
198: #ifdef X25
199: char *x25_local_dte = "";
200: char *x25_local_pid = "";
201:
202: static char *x25_intl_zero_str = "off";
203: char x25_intl_zero = 0;
204:
205: static char *x25_strip_dnic_str = "off";
206: char x25_strip_dnic = 0;
207:
208: char *x25_dnic_prefix = "";
209:
210: /* 0 = don't request/allow reverse charging
211: * 1 = reverse charge request/allowed
212: */
213: static char *reverse_charge_default = "0";
214: u_char reverse_charge = 0;
215:
216: /* 0= default recv packet size.
217: * 16, 32, 64, 128,
218: * 256, 512, 1024
219: * ( octets in decimal )
220: */
221: static char *recvpktsize_default = "0";
222: u_short recvpktsize = 0;
223:
224: /* same as above, but for send packet size */
225: static char *sendpktsize_default = "0";
226: u_short sendpktsize = 0;
227:
228: /* 0= default recv window size.
229: * 7, 127 ( in decimal )
230: */
231: static char *recvwndsize_default = "0";
232: u_char recvwndsize = 0;
233:
234: /* same as above, but for send window size */
235: static char *sendwndsize_default = "0";
236: u_char sendwndsize = 0;
237:
238: /* 0= default recv throughtput.
239: * 3= 75 8= 2400
240: * 4= 150 9= 4800
241: * 5= 300 10= 9600
242: * 6= 600 11= 19200
243: * 7= 1200 12= 48000
244: * ( bps in decimal )
245: */
246: static char *recvthruput_default = "0";
247: u_char recvthruput = 0;
248:
249: /* same as above, but for send throughput */
250: /* 1 = use closed user group in cug_index */
251: static char *sendthruput_default = "0";
252: u_char sendthruput = 0;
253:
254: /* 0 = no closed user group. */
255: /* 1 = use closed user group in cug_index */
256: static char *cug_req_default = "0";
257: u_char cug_req = 0;
258:
259: /* valid when cug_req= 1.
260: * 0x00 ~ 0x99 ( closed user group in BCD)
261: */
262: static char *cug_index_default = "0";
263: u_char cug_index = 0;
264:
265: /* 0= don't use fast select
266: * 1= clear is fast select response
267: * 2= clear or call accepted
268: * is fast select response
269: */
270: static char *fast_select_type_default = "0";
271: u_char fast_select_type = 0;
272:
273: /* 0= no RPOA transit request
274: * 1= use RPOA transit request in rpoa
275: */
276: static char *rpoa_req_default = "0";
277: u_char rpoa_req = 0;
278:
279: /* valid when rpoa_req= 1 */
280: /* 0x0000 ~ 0x9999 (RPOA transit group in BCD) */
281: static char *rpoa_default = "0";
282: u_short rpoa = 0;
283:
284: static char *x25debug = "none";
285: static LLog _x25_log = {
286: "x25log", "x25", NULLCP, LLOG_NONE, LLOG_NONE, -1,
287: LLOGCLS | LLOGCRT | LLOGZER, NOTOK
288: };
289: LLog *x25_log = &_x25_log;
290:
291: #ifdef CAMTEC_CCL
292: static char *x25_outgoing_port_str = "A";
293: char x25_outgoing_port = 'A';
294: #endif
295: #endif
296:
297:
298: #ifdef BRIDGE_X25
299: char *x25_bridge_host = "x25bridge";
300: char *x25_bridge_addr = "000021000018";
301: char *x25_bridge_listen = "";
302: char *x25_bridge_pid = "";
303: char *x25_bridge_discrim = "0000";
304: #endif
305:
306:
307: #if defined (BRIDGE_X25) || defined (X25)
308: static char *x25_bridge_port_default = "146";
309: u_short x25_bridge_port = 0;
310: #endif
311:
312:
313: char ns_enabled = 0;
314: static char *usens = "off";
315:
316: char *ns_address = "undefined";
317:
318: /* */
319:
320: static struct bind {
321: char *b_key;
322:
323: char **b_value;
324: int b_dynamic;
325: } binds[] = {
326: "localname", &isodename, 0,
327: "binpath", &isodebinpath, 0,
328: "sbinpath", &isodesbinpath, 0,
329: "etcpath", &isodetcpath, 0,
330: "logpath", &isodelogpath, 0,
331:
332: "compatlevel", &compatdebug, 0,
333: "compatfile", &_compat_log.ll_file, 0,
334:
335: "addrlevel", &addrdebug, 0,
336: "addrfile", &_addr_log.ll_file, 0,
337:
338: "tsaplevel", &tsapdebug, 0,
339: "tsapfile", &_tsap_log.ll_file, 0,
340:
341: "ssaplevel", &ssapdebug, 0,
342: "ssapfile", &_ssap_log.ll_file, 0,
343:
344: "psaplevel", &psapdebug, 0,
345: "psapfile", &_psap_log.ll_file, 0,
346:
347: "psap2level", &psap2debug, 0,
348: "psap2file", &_psap2_log.ll_file, 0,
349:
350: "acsaplevel", &acsapdebug, 0,
351: "acsapfile", &_acsap_log.ll_file, 0,
352:
353: "rtsaplevel", &rtsapdebug, 0,
354: "rtsapfile", &_rtsap_log.ll_file, 0,
355:
356: "rosaplevel", &rosapdebug, 0,
357: "rosapfile", &_rosap_log.ll_file, 0,
358:
359: "ts_stacks", &_ts_stacks, 0,
360: "ts_interim", &_ts_interim, 0,
361: "ts_communities", &_ts_communities, 0,
362:
363: "default_nsap_community", &_ts_comm_nsap_default, 0,
364: "default_x25_community", &_ts_comm_x25_default, 0,
365: "default_tcp_community", &_ts_comm_tcp_default, 0,
366:
367: "tsb_communities", &_tsb_config, 0,
368: "tsb_default_address", &tsb_default_address, 0,
369:
370: #ifdef X25
371: "x25_local_dte", &x25_local_dte, 0,
372: "x25_local_pid", &x25_local_pid, 0,
373: "x25_dnic_prefix", &x25_dnic_prefix, 0,
374: "x25_intl_zero", &x25_intl_zero_str, 0,
375: "x25_strip_dnic", &x25_strip_dnic_str, 0,
376:
377: "reverse_charge", &reverse_charge_default, 0,
378: "recvpktsize", &recvpktsize_default, 0,
379: "sendpktsize", &sendpktsize_default, 0,
380: "recvwndsize", &recvwndsize_default, 0,
381: "sendwndsize", &sendwndsize_default, 0,
382: "recvthruput", &recvthruput_default, 0,
383: "sendthruput", &sendthruput_default, 0,
384: "cug_req", &cug_req_default, 0,
385: "cug_index", &cug_index_default, 0,
386: "fast_select_type", &fast_select_type_default, 0,
387: "rpoa_req", &rpoa_req_default, 0,
388: "rpoa", &rpoa_default, 0,
389:
390: "x25level", &x25debug, 0,
391: "x25file", &_x25_log.ll_file, 0,
392:
393: #ifdef CAMTEC_CCL
394: "x25_outgoing_port", &x25_outgoing_port_str, 0,
395: #endif
396: #endif
397:
398: #ifdef BRIDGE_X25
399: "x25_bridge_host", &x25_bridge_host, 0,
400: "x25_bridge_addr", &x25_bridge_addr, 0,
401: "x25_bridge_listen", &x25_bridge_listen, 0,
402: "x25_bridge_pid", &x25_bridge_pid, 0,
403: "x25_bridge_discrim", &x25_bridge_discrim, 0,
404: #endif
405:
406: #if defined (BRIDGE_X25) || defined (X25)
407: "x25_bridge_port", &x25_bridge_port_default,0,
408: #endif
409:
410:
411: "ns_enable", &usens, 0,
412: "ns_address", &ns_address, 0,
413:
414: NULL
415: };
416:
417:
418: int tailor_read ();
419: char *tailor_value ();
420:
421: /* */
422:
423: char *isodesetailor (file)
424: char *file;
425: {
426: char *ofile = isotailor;
427:
428: if ((isotailor = file) == NULLCP)
429: isotailor = "isotailor";
430:
431: return ofile;
432: }
433:
434: /* */
435:
436: void isodetailor (myname, wantuser)
437: char *myname;
438: int wantuser;
439: {
440: register char *hp,
441: *mp;
442: char buffer[BUFSIZ];
443: static int inited = 0;
444:
445: if (inited)
446: return;
447: inited = 1;
448:
449: tsb_addresses[0] = NULL;
450:
451: tailor_read (isodefile (isotailor, 0));
452:
453: if (wantuser) {
454: if ((hp = getenv ("HOME")) == NULL)
455: hp = ".";
456: if (myname) {
457: if (mp = rindex (myname, '/'))
458: mp++;
459: if (mp == NULL || *mp == NULL)
460: mp = myname;
461: }
462: else
463: mp = "isode";
464: (void) sprintf (buffer, "%s/.%s_tailor", hp, mp);
465: tailor_read (buffer);
466: }
467:
468: isodexport (myname);
469: }
470:
471: /* */
472:
473: static int tailor_read (file)
474: char *file;
475: {
476: register char *bp,
477: *cp;
478: char buffer[BUFSIZ];
479: register FILE *fp;
480:
481: if (fp = fopen (file, "r")) {
482: while (fgets (buffer, sizeof buffer, fp)) {
483: if ((cp = index (buffer, '\n')) == NULL) {
484: fprintf (stderr, "%s: line too long\n", file);
485: break;
486: }
487: *cp = NULL;
488: if (*buffer == '#' || *buffer == NULL)
489: continue;
490: if ((bp = index (buffer, ':')) == NULL) {
491: fprintf (stderr, "%s: invalid syntax in \"%s\"\n",
492: file, buffer);
493: break;
494: }
495: for (cp = bp - 1; cp >= buffer; cp--)
496: if (isspace (*cp))
497: *cp = NULL;
498: else
499: break;
500:
501: *bp++ = NULL;
502: while (isspace (*bp))
503: *bp++ = NULL;
504:
505: for (cp = bp + strlen (bp) - 1; cp >= bp; cp--)
506: if (isspace (*cp))
507: *cp = NULL;
508: else
509: break;
510:
511: if ((cp = tailor_value (bp))
512: && isodesetvar (buffer, cp, 1) == NOTOK)
513: free (cp);
514: }
515:
516: (void) fclose (fp);
517: }
518: }
519:
520: /* */
521:
522: int isodesetvar (name, value, dynamic)
523: char *name,
524: *value;
525: int dynamic;
526: {
527: register struct bind *b;
528:
529: for (b = binds; b -> b_key; b++)
530: if (strcmp (b -> b_key, name) == 0) {
531: if (b -> b_dynamic && *b -> b_value)
532: free (*b -> b_value);
533: *b -> b_value = value, b -> b_dynamic = dynamic;
534: return OK;
535: }
536:
537: return NOTOK;
538: }
539:
540: /* */
541:
542: void isodexport (myname)
543: char *myname;
544: {
545: compat_log -> ll_events = events_value (ll_pairs, compatdebug, "compatlevel");
546: addr_log -> ll_events = events_value (ll_pairs, addrdebug, "addrlevel");
547: tsap_log -> ll_events = events_value (ll_pairs, tsapdebug, "tsaplevel");
548: ssap_log -> ll_events = events_value (ll_pairs, ssapdebug, "ssaplevel");
549: psap_log -> ll_events = events_value (ll_pairs, psapdebug, "psaplevel");
550: psap2_log -> ll_events = events_value (ll_pairs, psap2debug, "psap2level");
551: acsap_log -> ll_events = events_value (ll_pairs, acsapdebug, "acsaplevel");
552: rtsap_log -> ll_events = events_value (ll_pairs, rtsapdebug, "rtsaplevel");
553: rosap_log -> ll_events = events_value (ll_pairs, rosapdebug, "rosaplevel");
554: #ifdef X25
555: x25_log -> ll_events = events_value (ll_pairs, x25debug, "x25level");
556: #endif
557:
558: ll_hdinit (compat_log, myname);
559: ll_hdinit (addr_log, myname);
560: ll_hdinit (tsap_log, myname);
561: ll_hdinit (ssap_log, myname);
562: ll_hdinit (psap_log, myname);
563: ll_hdinit (psap2_log, myname);
564: ll_hdinit (acsap_log, myname);
565: ll_hdinit (rtsap_log, myname);
566: ll_hdinit (rosap_log, myname);
567: #ifdef X25
568: ll_hdinit (x25_log, myname);
569: #endif
570:
571: ts_stacks = events_value (ts_pairs, _ts_stacks, "ts_stacks");
572: #ifndef TCP
573: ts_stacks &= ~TS_TCP;
574: #endif
575: #ifndef X25
576: ts_stacks &= ~TS_X25;
577: #endif
578: #ifndef BRIDGE_X25
579: ts_stacks &= ~TS_BRG;
580: #endif
581: #ifndef TP4
582: ts_stacks &= ~TS_TP4;
583: #endif
584:
585: {
586: register int *ip,
587: *jp,
588: *kp;
589: int j;
590: register char *cp,
591: *adrp,
592: **ap,
593: **cpp;
594: register struct ts_interim *ts;
595: static struct ts_interim *te = NULL;
596: char buffer[BUFSIZ],
597: *vec[NVEC + NSLACK + 1];
598:
599: if (te)
600: te -> ts_name = NULL;
601: for (ts = ts_interim; ts -> ts_name; ts++)
602: if (macro2comm (ts -> ts_name, ts) == NOTOK)
603: fprintf (stderr, "internal error for community \"%s\"\n",
604: ts -> ts_name);
605: if (te == NULL)
606: te = ts;
607:
608: (void) strcpy (buffer, _ts_interim);
609: (void) str2vec (buffer, ap = vec);
610: j = SUBNET_DYNAMIC;
611: while (cp = *ap++) {
612: register struct ts_interim *tp;
613:
614: ts -> ts_subnet = 0;
615: if (macro2comm (cp, ts) == NOTOK) {
616: fprintf (stderr, "invalid community name \"%s\"\n", cp);
617: break;
618: }
619: for (tp = ts_interim; tp < ts; tp++)
620: if (tp -> ts_length == ts -> ts_length
621: && bcmp (tp -> ts_prefix, ts -> ts_prefix,
622: tp -> ts_length) == 0) {
623: fprintf (stderr,
624: "duplicate prefixes for communities \"%s\" and \"%s\"\n",
625: tp -> ts_name, cp);
626: break;
627: }
628: if (tp < ts)
629: continue;
630:
631: ts -> ts_name = strdup (cp);
632: if (ts -> ts_subnet == 0)
633: ts -> ts_subnet = j++;
634: ts++;
635: }
636: ts -> ts_name = NULL;
637:
638: (void) strcpy (buffer, _ts_communities);
639: (void) str2vec (buffer, ap = vec);
640: ip = ts_communities;
641: while (cp = *ap++) {
642: if (strcmp (cp, "all") == 0) {
643: for (ts = ts_interim; ts -> ts_name; ts++) {
644: for (jp = ts_communities; jp < ip; jp++)
645: if (*jp == ts -> ts_subnet)
646: break;
647: if (jp >= ip)
648: *ip++ = ts -> ts_subnet;
649: }
650: break;
651: }
652:
653: for (ts = ts_interim; ts -> ts_name; ts++)
654: if (lexequ (ts -> ts_name, cp) == 0)
655: break;
656: if (!ts -> ts_name) {
657: fprintf (stderr,
658: "unknown community name \"%s\" for variable ts_communities\n",
659: cp);
660: continue;
661: }
662:
663: for (jp = ts_communities; jp < ip; jp++)
664: if (*jp == ts -> ts_subnet)
665: break;
666: if (jp >= ip)
667: *ip++ = ts -> ts_subnet;
668: }
669: *ip = NULL;
670:
671: for (ap = tsb_addresses; *ap; ap++)
672: free (*ap);
673: (void) strcpy (buffer, _tsb_config);
674: (void) str2vec (buffer, ap = vec);
675: ip = tsb_communities, cpp = tsb_addresses;
676: while (cp = *ap++) {
677: if ((adrp = *ap++) == NULLCP) {
678: fprintf (stderr,
679: "missing address for tsb_community \"%s\"\n", cp);
680: break;
681: }
682:
683: for (ts = ts_interim; ts -> ts_name; ts++)
684: if (lexequ (ts -> ts_name, cp) == 0)
685: break;
686: if (!ts -> ts_name) {
687: fprintf (stderr,
688: "unknown community name \"%s\" for variable tsb_communities\n",
689: cp);
690: continue;
691: }
692:
693: for (jp = tsb_communities; jp < ip; jp++)
694: if (*jp == ts -> ts_subnet)
695: break;
696: if (jp >= ip) {
697: *ip++ = ts -> ts_subnet, *cpp++ = strdup (adrp);
698:
699: for (kp = ts_communities; *kp; kp++)
700: if (*kp == ts -> ts_subnet)
701: break;
702: if (!*kp)
703: *kp++ = ts -> ts_subnet, *kp = NULL;
704: }
705: }
706: *ip = NULL, *cpp = NULLCP;
707:
708: cp = _ts_comm_nsap_default;
709: for (ts = ts_interim; ts -> ts_name; ts++)
710: if (lexequ (ts -> ts_name, cp) == 0)
711: break;
712: if (ts -> ts_name && ts -> ts_syntax == NA_NSAP)
713: ts_comm_nsap_default = ts -> ts_subnet;
714: else
715: fprintf (stderr,
716: "bad community name \"%s\" for variable default_nsap_community\n",
717: cp);
718:
719: cp = _ts_comm_x25_default;
720: for (ts = ts_interim; ts -> ts_name; ts++)
721: if (lexequ (ts -> ts_name, cp) == 0)
722: break;
723: if (ts -> ts_name && ts -> ts_syntax == NA_X25)
724: ts_comm_x25_default = ts -> ts_subnet;
725: else
726: fprintf (stderr,
727: "bad community name \"%s\" for variable default_x25_community\n",
728: cp);
729:
730: cp = _ts_comm_tcp_default;
731: for (ts = ts_interim; ts -> ts_name; ts++)
732: if (lexequ (ts -> ts_name, cp) == 0)
733: break;
734: if (ts -> ts_name && ts -> ts_syntax == NA_TCP)
735: ts_comm_tcp_default = ts -> ts_subnet;
736: else
737: fprintf (stderr,
738: "bad community name \"%s\" for variable default_tcp_community\n",
739: cp);
740:
741: if (addr_log -> ll_events & LLOG_DEBUG) {
742: LLOG (addr_log, LLOG_DEBUG,
743: ("ts_stacks: %s", sprintb (ts_stacks, TS_MASK)));
744:
745: for (ts = ts_interim; ts -> ts_name; ts++) {
746: LLOG (addr_log, LLOG_DEBUG,
747: ("community %s value \"%s\" subnet %d syntax %d",
748: ts -> ts_name, ts -> ts_value ? ts -> ts_value : "",
749: ts -> ts_subnet, ts -> ts_syntax));
750: buffer[explode(buffer, (u_char *) ts -> ts_prefix,
751: ts -> ts_length)] = NULL;
752: LLOG (addr_log, LLOG_DEBUG,
753: (" prefix \"%s\" (%d octets)", buffer,
754: ts -> ts_length));
755: }
756:
757: for (ip = ts_communities; *ip; ip++)
758: LLOG (addr_log, LLOG_DEBUG, ("community %d enabled", *ip));
759:
760: LLOG (addr_log, LLOG_DEBUG,
761: ("default communities: nsap=%d x25=%d tcp=%d",
762: ts_comm_nsap_default, ts_comm_x25_default,
763: ts_comm_tcp_default));
764:
765: for (ip = tsb_communities, cpp = tsb_addresses; *ip; ip++, cpp++) {
766: LLOG (addr_log, LLOG_DEBUG,
767: ("TSB for community %d residing at %s", *ip, *cpp));
768: if (str2taddr (*cpp) == NULLTA)
769: LLOG (addr_log, LLOG_EXCEPTIONS,
770: ("invalid address for TSB to community %d: %s",
771: *ip, *cpp));
772: }
773: }
774: }
775:
776: #ifdef X25
777: reverse_charge = (u_char) atoi (reverse_charge_default);
778: recvpktsize = (u_short) atoi (recvpktsize_default);
779: sendpktsize = (u_short) atoi (sendpktsize_default);
780: recvwndsize = (u_char) atoi (recvwndsize_default);
781: sendwndsize = (u_char) atoi (sendwndsize_default);
782: recvthruput = (u_char) atoi (recvthruput_default);
783: sendthruput = (u_char) atoi (sendthruput_default);
784: cug_req = (u_char) atoi (cug_req_default);
785: cug_index = (u_char) atoi (cug_index_default);
786: fast_select_type = (u_char) atoi (fast_select_type_default);
787: rpoa_req = atoi (rpoa_req_default);
788: rpoa = (u_short) atoi (rpoa_default);
789:
790: #ifdef CAMTEC_CCL
791: x25_outgoing_port = *x25_outgoing_port_str;
792: #endif
793:
794: x25_intl_zero = !strcmp (x25_intl_zero_str, "on");
795: x25_strip_dnic = !strcmp (x25_strip_dnic_str, "on");
796: #endif
797:
798: #if defined (BRIDGE_X25) || defined (X25)
799: x25_bridge_port = htons ((u_short) atoi (x25_bridge_port_default));
800: #endif
801:
802: ns_enabled = !strcmp (usens, "on");
803: }
804:
805: /* */
806:
807: #define QUOTE '\\'
808:
809:
810: static char *tailor_value (s)
811: register char *s;
812: {
813: register int i,
814: r;
815: register char *bp;
816: char buffer[BUFSIZ];
817:
818: for (bp = buffer; *s; bp++, s++)
819: if (*s != QUOTE)
820: *bp = *s;
821: else
822: switch (*++s) {
823: case '0':
824: *bp = '\0';
825: break;
826: case 'b':
827: *bp = '\b';
828: break;
829: case 'f':
830: *bp = '\f';
831: break;
832: case 'n':
833: *bp = '\n';
834: break;
835: case 'r':
836: *bp = '\r';
837: break;
838: case 't':
839: *bp = '\t';
840: break;
841:
842: case NULL: s--;
843: case QUOTE:
844: *bp = QUOTE;
845: break;
846:
847: default:
848: if (!isdigit (*s)) {
849: *bp++ = QUOTE;
850: *bp = *s;
851: break;
852: }
853: r = *s != '0' ? 10 : 8;
854: for (i = 0; isdigit (*s); s++)
855: i = i * r + *s - '0';
856: s--;
857: *bp = toascii (i);
858: break;
859: }
860: *bp = NULL;
861:
862: if ((bp = malloc ((unsigned) (strlen (buffer) + 1))) != NULL)
863: (void) strcpy (bp, buffer);
864:
865: return bp;
866: }
867:
868: /* */
869:
870: static int events_value (pairs, s, var)
871: struct pair *pairs;
872: char *s,
873: *var;
874: {
875: int value;
876: register char *cp,
877: **ap;
878: register struct pair *pp;
879: char buffer[BUFSIZ],
880: *vec[NVEC + NSLACK + 1];
881:
882: value = 0;
883: (void) strcpy (buffer, s);
884: (void) str2vec (buffer, ap = vec);
885: while (cp = *ap++) {
886: for (pp = pairs; pp -> p_name; pp++)
887: if (strcmp (pp -> p_name, cp) == 0) {
888: value |= pp -> p_value;
889: break;
890: }
891: if (!pp -> p_name)
892: fprintf (stderr, "unknown value \"%s\" for variable %s\n",
893: cp, var);
894: }
895:
896: return value;
897: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.