~ubuntu-branches/ubuntu/edgy/net-snmp/edgy-updates

« back to all changes in this revision

Viewing changes to agent/mibgroup/mibII/tcpTable.c

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-03-31 04:21:37 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050331042137-z0vw1grslj6cek9k
Tags: 5.1.2-6ubuntu2
Apply safe-but-hackish patch by Henrique de Moraes Holschuh to
fix the libdir in libsnmp5-dev's .la files (Ubuntu bug #8393)

Show diffs side-by-side

added added

removed removed

Lines of Context:
325
325
     * Set up the indexing for the specified row...
326
326
     */
327
327
    idx = index;
 
328
#ifdef WIN32
 
329
    port = ntohl((u_long)tcp_head[i].TCPTABLE_LOCALADDRESS);
 
330
    snmp_set_var_value(idx, (u_char *)&port,
 
331
                                sizeof(tcp_head[i].TCPTABLE_LOCALADDRESS));
 
332
#else
328
333
    snmp_set_var_value(idx, (u_char *)&tcp_head[i].TCPTABLE_LOCALADDRESS,
329
334
                                sizeof(tcp_head[i].TCPTABLE_LOCALADDRESS));
 
335
#endif
330
336
 
331
337
    port = ntohs((u_short)tcp_head[i].TCPTABLE_LOCALPORT);
332
338
    idx = idx->next_variable;
333
339
    snmp_set_var_value(idx, (u_char*)&port, sizeof(port));
334
340
 
335
341
    idx = idx->next_variable;
 
342
#ifdef WIN32
 
343
    port = ntohl((u_long)tcp_head[i].TCPTABLE_REMOTEADDRESS);
 
344
    snmp_set_var_value(idx, (u_char *)&port,
 
345
                                sizeof(tcp_head[i].TCPTABLE_REMOTEADDRESS));
 
346
#else
336
347
    snmp_set_var_value(idx, (u_char *)&tcp_head[i].TCPTABLE_REMOTEADDRESS,
337
348
                                sizeof(tcp_head[i].TCPTABLE_REMOTEADDRESS));
 
349
#endif
338
350
 
339
351
    port = ntohs((u_short)tcp_head[i].TCPTABLE_REMOTEPORT);
340
352
    idx = idx->next_variable;
682
694
#else                           /* WIN32 */
683
695
 
684
696
#if (defined(CAN_USE_SYSCTL) && defined(TCPCTL_PCBLIST))
 
697
 
 
698
#if defined(freebsd4) || defined(darwin)
 
699
    #define NS_ELEM struct xtcpcb
 
700
#else
 
701
    #define NS_ELEM struct xinpcb
 
702
#endif
 
703
 
685
704
int
686
705
tcpTable_load(netsnmp_cache *cache, void *vmagic)
687
706
{
717
736
        nnew = SNMP_MALLOC_TYPEDEF(netsnmp_inpcb);
718
737
        if (!nnew)
719
738
            break;
720
 
        nnew->state = StateMap[((struct xinpcb *) xig)->xt_tp.t_state];
 
739
        nnew->state = StateMap[((NS_ELEM *) xig)->xt_tp.t_state];
721
740
        if (nnew->state == 5 /* established */ ||
722
741
            nnew->state == 8 /*  closeWait  */ )
723
742
            tcp_estab++;
724
 
        memcpy(&(nnew->pcb), &(((struct xinpcb *) xig)->xt_inp),
 
743
        memcpy(&(nnew->pcb), &(((NS_ELEM *) xig)->xt_inp),
725
744
                           sizeof(struct inpcb));
726
745
 
727
746
        nnew->inp_next = tcp_head;
737
756
    DEBUGMSGTL(("mibII/tcpTable", "Failed to load TCP Table (sysctl)\n"));
738
757
    return -1;
739
758
}
 
759
#undef NS_ELEM
 
760
 
740
761
#else           /* (defined(CAN_USE_SYSCTL) && defined(TCPCTL_PCBLIST)) */
741
762
#ifdef PCB_TABLE
742
763
int