1*19926Ssam # include "../hdr/defines.h" 2*19926Ssam 3*19926Ssam SCCSID(@(#)setup 2.2); 4*19926Ssam 5*19926Ssam setup(pkt,serial) 6*19926Ssam register struct packet *pkt; 7*19926Ssam int serial; 8*19926Ssam { 9*19926Ssam register int n; 10*19926Ssam register struct apply *rap; 11*19926Ssam int first_app 1; 12*19926Ssam 13*19926Ssam pkt->p_apply[serial].a_inline = 1; 14*19926Ssam for (n = maxser(pkt); n; n--) { 15*19926Ssam rap = &pkt->p_apply[n]; 16*19926Ssam if (rap->a_inline) { 17*19926Ssam if (n != 1 && pkt->p_idel[n].i_pred == 0) 18*19926Ssam fmterr(pkt); 19*19926Ssam pkt->p_apply[pkt->p_idel[n].i_pred].a_inline = 1; 20*19926Ssam if (pkt->p_idel[n].i_datetime > pkt->p_cutoff) 21*19926Ssam condset(rap,NOAPPLY,CUTOFF); 22*19926Ssam else { 23*19926Ssam if (first_app) 24*19926Ssam move(&pkt->p_idel[n].i_sid, 25*19926Ssam &pkt->p_gotsid, 26*19926Ssam sizeof(pkt->p_gotsid)); 27*19926Ssam first_app = 0; 28*19926Ssam condset(rap,APPLY,EMPTY); 29*19926Ssam } 30*19926Ssam } 31*19926Ssam else 32*19926Ssam condset(rap,NOAPPLY,EMPTY); 33*19926Ssam if (rap->a_code == APPLY) 34*19926Ssam ixgsetup(pkt->p_apply,&(pkt->p_idel[n].i_ixg)); 35*19926Ssam } 36*19926Ssam } 37*19926Ssam 38*19926Ssam 39*19926Ssam ixgsetup(ap,ixgp) 40*19926Ssam struct apply *ap; 41*19926Ssam struct ixg *ixgp; 42*19926Ssam { 43*19926Ssam int n; 44*19926Ssam int code, reason; 45*19926Ssam register int *ip; 46*19926Ssam register struct ixg *cur, *prev; 47*19926Ssam 48*19926Ssam for (cur = ixgp; cur = (prev = cur)->i_next; ) { 49*19926Ssam switch (cur->i_type) { 50*19926Ssam 51*19926Ssam case INCLUDE: 52*19926Ssam code = APPLY; 53*19926Ssam reason = INCL; 54*19926Ssam break; 55*19926Ssam case EXCLUDE: 56*19926Ssam code = NOAPPLY; 57*19926Ssam reason = EXCL; 58*19926Ssam break; 59*19926Ssam case IGNORE: 60*19926Ssam code = EMPTY; 61*19926Ssam reason = IGNR; 62*19926Ssam break; 63*19926Ssam } 64*19926Ssam ip = cur->i_ser; 65*19926Ssam for (n = cur->i_cnt; n; n--) 66*19926Ssam condset(&ap[*ip++],code,reason); 67*19926Ssam } 68*19926Ssam } 69*19926Ssam 70*19926Ssam 71*19926Ssam condset(ap,code,reason) 72*19926Ssam register struct apply *ap; 73*19926Ssam int code, reason; 74*19926Ssam { 75*19926Ssam if (code == EMPTY) 76*19926Ssam ap->a_reason =| reason; 77*19926Ssam else if (ap->a_code == EMPTY) { 78*19926Ssam ap->a_code = code; 79*19926Ssam ap->a_reason =| reason; 80*19926Ssam } 81*19926Ssam } 82