|
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 t
Length: 4312 (0x10d8) Types: TextFile Names: »tsapmgmt.c«
└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0 └─⟦e83f91978⟧ »EurOpenD22/isode/osimis-2.0.tar.Z« └─⟦d846658bd⟧ └─⟦this⟧ »osimis/misode/tsap/tsapmgmt.c« └─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0 └─⟦35176feda⟧ »EurOpenD22/isode/isode-6.tar.Z« └─⟦de7628f85⟧ └─⟦this⟧ »isode-6.0/tsap/tsapmgmt.c«
/* tsapmgmt.c - management info reporting routines */ #ifndef lint static char *rcsid = "$Header: /f/osi/tsap/RCS/tsapmgmt.c,v 7.0 89/11/23 22:30:53 mrose Rel $"; #endif /* * $Header: /f/osi/tsap/RCS/tsapmgmt.c,v 7.0 89/11/23 22:30:53 mrose Rel $ * * * $Log: tsapmgmt.c,v $ * Revision 7.0 89/11/23 22:30:53 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. * */ /* LINTLIBRARY */ #include <stdio.h> #include <varargs.h> #include "tpkt.h" #include "mpkt.h" #ifdef MGMT #include "internet.h" #define LOCALTHLD 128 /* local threshold for reporting (bytes) */ /* \f */ static long pid = OK; static int ManSoc; static struct MReport TsapInfo; static struct qbuf data; /* \f */ /* VARARGS2 */ int TManGen (va_alist) va_dcl { int a, result; struct TSAPaddr *b; unsigned int type; register struct tsapblk *tb; va_list ap; va_start (ap); type = va_arg (ap, unsigned int); tb = va_arg (ap, struct tsapblk *); a = 0, b = NULLTA; switch (type) { case USERDT: case USERDR: a = va_arg (ap, int); break; case STARTLISTEN: case ENDLISTEN: b = va_arg (ap, struct TSAPaddr *); break; default: break; } result = TManGenAux (type, tb, a, b); va_end (ap); return result; } /* \f */ #define SendMReport() write_udp_socket (ManSoc, &data) static int TManGenAux (type, tb, a, b) unsigned int type; struct tsapblk * tb; int a; struct TSAPaddr *b; { if (pid == NOTOK) return NOTOK; if (pid == OK && ManInit () == NOTOK) return (pid = NOTOK); switch (TsapInfo.type = type) { case USERDT: tb -> tb_pdus++; if ((tb -> tb_bytes += a) < LOCALTHLD) break; TsapInfo.cid = tb -> tb_fd; TsapInfo.u.gp.a = tb -> tb_bytes; TsapInfo.u.gp.b = tb -> tb_pdus; tb -> tb_bytes = 0; break; case USERDR: tb -> tb_pdur++; if ((tb -> tb_byter += a) < LOCALTHLD) return OK; TsapInfo.cid = tb -> tb_fd; TsapInfo.u.gp.a = tb -> tb_byter; TsapInfo.u.gp.b = tb -> tb_pdur; tb -> tb_byter = 0; break; case OPREQIN: case OPREQOUT: TsapInfo.cid = tb -> tb_fd; bcopy (tb -> tb_responding.ta_selector, TsapInfo.u.taddr.tsel, TsapInfo.u.taddr.tsel_len = tb -> tb_responding.ta_selectlen); /* struct copy */ TsapInfo.u.taddr.nsap = tb -> tb_responding.ta_addrs[0]; if (SendMReport () == NOTOK) return NOTOK; TsapInfo.type = SOURCEADDR; bcopy (tb -> tb_initiating.ta_selector, TsapInfo.u.taddr.tsel, TsapInfo.u.taddr.tsel_len = tb -> tb_initiating.ta_selectlen); /* struct copy */ TsapInfo.u.taddr.nsap = tb -> tb_initiating.ta_addrs[0]; break; case DISCREQ: TsapInfo.cid = tb -> tb_fd; TsapInfo.u.gp.a = tb -> tb_bytes; TsapInfo.u.gp.b = tb -> tb_byter; TsapInfo.u.gp.c = tb -> tb_pdus; TsapInfo.u.gp.d = tb -> tb_pdur; break; case PROTERR: case CONGEST: case CONFIGBAD: case OPREQINBAD: case OPREQOUTBAD: TsapInfo.cid = tb -> tb_fd; break; case STARTLISTEN: case ENDLISTEN: bcopy (b -> ta_selector, TsapInfo.u.taddr.tsel, TsapInfo.u.taddr.tsel_len = b -> ta_selectlen); TsapInfo.u.taddr.nsap = b -> ta_addrs[0]; /* struct copy */ break; default: return NOTOK; } return SendMReport (); } /* \f */ static int ManInit () { struct sockaddr_in sin; register struct sockaddr_in *sock = &sin; register struct servent *sp; register struct hostent *hp; if ((sp = getservbyname ("manager", "udp")) == NULL || (hp = gethostbyname ("localhost")) == NULL) return NOTOK; bzero((char *) sock, sizeof *sock); sock -> sin_family = hp -> h_addrtype; inaddr_copy (hp, sock); if ((ManSoc = start_udp_client (sock, 0, SO_DONTROUTE, 0)) == NOTOK) return NOTOK; sock -> sin_port = sp -> s_port; if (join_udp_server (ManSoc, sock) == NOTOK) return NOTOK; TsapInfo.id = pid = getpid(); data.qb_data = (char *) &TsapInfo; data.qb_len = sizeof TsapInfo; return OK; } #endif