|
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 i
Length: 4765 (0x129d) Types: TextFile Names: »internal.c«
└─⟦2d1937cfd⟧ Bits:30007241 EUUGD22: P.P 5.0 └─⟦e83f91978⟧ »EurOpenD22/isode/osimis-2.0.tar.Z« └─⟦d846658bd⟧ └─⟦this⟧ »osimis/sma/internal.c«
/* * Copyright (c) 1988 University College London * All rights reserved. * * Redistribution and use in source and binary forms are permitted * provided that the above copyright notice and this paragraph are * duplicated in all such forms and that any documentation, * advertising materials, and other materials related to such * distribution and use acknowledge that the software was developed * by the Department of Computer Science, University College London. * The name of the University may not be used to * endorse or promote products derived from this software without * specific prior written permission. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ /* internal.c - effect the flow of data within the MIB */ /* * By Simon Walton, October 1988 * Modified by George Pavlou, April 1990 */ #include <stdio.h> #include <signal.h> #include "isode/rosap.h" #include "msap.h" #include "smi.h" extern char * context; extern struct ManagedObject * MIBroot; extern struct ManagedObject * findcomp(), * forccomp(); extern time_t time(); extern OID oid_copy(); void rem_dest(); check_Counter(mo, instance, c, prev) struct ManagedObject * mo; struct MO_ID * instance; Counter * c; int prev; { int i, l, cur = c -> Value; C_Threshold * thresh = c -> Threshold; if (thresh == NULL) return (OK); if (thresh -> OnOff == 0) return (OK); for (i = 0; i < 10; i++) if (prev < (l = thresh -> comparisonlevel[i]) && cur >= l) /* triggered */ { int d; DefinedEvent * ev; #ifdef DEBUG fprintf(stderr,"C_Threshold triggered, MO:\n"); moid_print(instance); #endif for (d = 0; d < 4; d++) if (ev = thresh -> triggers[d]) cause_DefinedEvent(mo, instance, ev); if (thresh -> offset) thresh -> comparisonlevel[i] += ((cur - thresh -> comparisonlevel[i]) % thresh -> offset + 1) * thresh -> offset; return (OK); } return (OK); } cause_DefinedEvent(mo, instance, ev) struct ManagedObject * mo; struct MO_ID * instance; DefinedEvent * ev; { int i, result = OK; struct ManagedObject * repcon; for(i = 0; i < 3; i++) if (ev -> rcis[i]) { if ((repcon = findcomp(MIBroot, ev -> rcis[i] )) == NULL) { result = NOTOK; #ifdef DEBUG fprintf(stderr, "Can't find Report Control:\n"); moid_print(ev -> rcis[i]); #endif continue; } invoke_Report(mo, instance, repcon, &ev -> eventype); } return (result); } invoke_Report(mo, instance, report, eventype) struct ManagedObject * mo, * report; struct MO_ID * instance; OID eventype; { ReportControl * R = (ReportControl*) report -> attributes; destinations * where; PE info = NULLPE; static invokeid; int signalmask; #ifndef DEBUG if (R -> listofdests == NULL) return (OK); #endif if (R -> MakeEventReport) if ( (R -> MakeEventReport)(&info, mo, eventype) == NOTOK) { #ifdef DEBUG fprintf(stderr, "Can't build report for event %s\n", sprintoid(eventype)); #endif return (NOTOK); } signalmask = sigblock(sigmask(SIGALRM)); for(where = R -> listofdests; where; where = where -> Next) switch (where -> type) { struct MSAPindication mis; struct MSAPconnect mcs; case RCI_DEST_PSAP: if (M_InitialiseReq(NULLAEI, NULLPA, NULLAEI, &where -> Psap_dest, context, 0x1, 0x0, NULLEXTERN, NULLEXTERN, &mcs, &mis) == NOTOK) { #ifdef DEBUG fprintf(stderr, "Can't open connection for report control\n"); #endif break; } where -> type = RCI_DEST_FD; where -> Fd_dest = mcs.mc_sd; mcfree(&mcs); case RCI_DEST_FD: { time_t tim; UTCtime eventime; MIDent class, event; MName inst; class.mid_type = MID_GLOBAL, class.mid_global = &mo -> Class; inst.mn_type = MN_DN, inst.mn_dn = moid2dn(instance); event.mid_type = MID_GLOBAL, event.mid_global = eventype; tim = time((time_t*)0); tm2ut(localtime(&tim), &eventime); if (M_EventRep(where -> Fd_dest, invokeid++, &class, &inst, &event, utct2str(&eventime), info, &mis) == NOTOK) { #ifdef DEBUG fprintf(stderr, "Event Report failed - %s\n", mis.mi_preject.mr_data); #endif rem_dest(R, where); mifree(&mis); } pe_free(info); dn_free(inst.mn_dn); } break; case RCI_DEST_AEI: #ifdef DEBUG fprintf(stderr, "Can't handle AEI destinations (yet)\n"); #endif break; default: #ifdef DEBUG fprintf(stderr, "Unknown destination type\n"); #endif break; } /* close switch */ sigsetmask(signalmask); return (OK); } static void rem_dest(repcon, dest) ReportControl * repcon; destinations * dest; { destinations ** d = &repcon -> listofdests; for(; *d; d = &(*d) -> Next) if (*d == dest) { *d = dest -> Next; free((char*) dest); break; } }