/*------------------------------------------------------------------------ * stc_getn - do a getnext on a variable in the TCP connection table *------------------------------------------------------------------------ */ int stc_getn(struct snbentry *bindl, struct mib_info *mip, int numifaces) { int oidi, field, tcbn; if (stc_match(bindl,&field,&tcbn) == SYSERR) { return SERR_NO_SUCH; } /* search for next connection */ if ((tcbn = stc_findnext(tcbn)) < 0) { tcbn = stc_findnext(-1); if (++field > SNUMF_TCTAB) return((*mip->mi_next->mi_func) (bindl, mip->mi_next, SOP_GETF)); } oidi = STC_OIDLEN; /* 6.13.1 */ bindl->sb_oid.id[oidi++] = (u_short) field; sip2ocpy(&bindl->sb_oid.id[oidi], tcbtab[tcbn].tcb_lip); oidi += IP_ALEN; bindl->sb_oid.id[oidi++] = (u_short) tcbtab[tcbn].tcb_lport; sip2ocpy(&bindl->sb_oid.id[oidi], tcbtab[tcbn].tcb_rip); oidi += IP_ALEN; bindl->sb_oid.id[oidi++] = (u_short) tcbtab[tcbn].tcb_rport; bindl->sb_oid.len = oidi; return stc_get(bindl, numifaces); }
/*------------------------------------------------------------------------ * sud_getf - do a getfirst on a variable in the UDP listener table *------------------------------------------------------------------------ */ int sud_getf(struct snbentry *bindl, struct mib_info *mip, int numifaces) { int oidi, udpn; IPaddr ip_allzero = 0; /* find first connection, if any */ udpn = sud_findnext(-1); if (udpn < 0) { if (mip->mi_next) return((*mip->mi_next->mi_func) (bindl, mip->mi_next, SOP_GETF)); return SERR_NO_SUCH; } memcpy(bindl->sb_oid.id, mip->mi_objid.id, mip->mi_objid.len*2); oidi = mip->mi_objid.len; bindl->sb_oid.id[oidi++] = (u_short) 1; /* field */ sip2ocpy(&bindl->sb_oid.id[oidi], ip_allzero); oidi += IP_ALEN; bindl->sb_oid.id[oidi++] = (u_short) upqs[udpn].up_port; bindl->sb_oid.len = oidi; return sud_get(bindl, numifaces); }
/*------------------------------------------------------------------------ * sae_getf - perform a getfirst on a variable in the IPAddr Entry Table *------------------------------------------------------------------------ */ int sae_getf(struct snbentry *bindl, struct mib_info *mip, int numifaces) { int iface, oidi; iface = sae_findnext(-1, numifaces); /* write the objid into the bindings list and call get func */ memcpy(bindl->sb_oid.id, mip->mi_objid.id, mip->mi_objid.len*2); oidi = mip->mi_objid.len; bindl->sb_oid.id[oidi++] = (u_short) 1; /* field */ sip2ocpy(&bindl->sb_oid.id[oidi], nif[iface].ni_ip); bindl->sb_oid.len = oidi + IP_ALEN; return sae_get(bindl, numifaces); }
/*------------------------------------------------------------------------ * srt_getf - perform a getfirst on a variable in the Routing Table *------------------------------------------------------------------------ */ int srt_getf(struct snbentry *bindl, struct mib_info *mip, int numifaces) { int rtl, oidi; struct route *rtp = (void *)NULLPTR; rtl = -1; /* use first field, first route */ if ((rtp = srt_findnext(rtp, &rtl)) == 0) { if (mip->mi_next) return (*mip->mi_next->mi_func) (bindl, mip->mi_next, SOP_GETF); return SERR_NO_SUCH; /* no next node */ } memcpy(bindl->sb_oid.id, mip->mi_objid.id, mip->mi_objid.len*2); oidi = mip->mi_objid.len; bindl->sb_oid.id[oidi++] = (u_short) 1; /* field */ sip2ocpy(&bindl->sb_oid.id[oidi], rtp->rt_net); bindl->sb_oid.len = oidi + IP_ALEN; return srt_get(bindl, numifaces); }
/*------------------------------------------------------------------------ * srt_getn - perform a getnext on a variable in the Routing Table *------------------------------------------------------------------------ */ int srt_getn(struct snbentry *bindl, struct mib_info *mip, int numifaces) { struct route *rtp; int rtl, field, oidi; if (srt_match(bindl, &rtp, &rtl, &field) == SYSERR) return SERR_NO_SUCH; if ((rtp = srt_findnext(rtp, &rtl)) == 0) { rtp = (struct route *) NULL; rtl = 0; /* set route hash table list to 0 */ rtp = srt_findnext(rtp, &rtl); if (++field > SNUMF_RTTAB) return (*mip->mi_next->mi_func) (bindl, mip->mi_next, SOP_GETF); } oidi = SRT_OIDLEN; /* 4.21.1 */ bindl->sb_oid.id[oidi++] = field; sip2ocpy(&bindl->sb_oid.id[oidi], rtp->rt_net); bindl->sb_oid.len = oidi + IP_ALEN; return srt_get(bindl, numifaces); }