summaryrefslogtreecommitdiff
path: root/include/net-snmp/data_access/tcpConn.h
blob: 1ab8e43a00008bea5b7e49625639751b9f422f02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/*
 * tcpConn data access header
 *
 * $Id: tcpConn.h 15136 2006-09-01 17:50:29Z rstory $
 */
#ifndef NETSNMP_ACCESS_TCPCONN_H
#define NETSNMP_ACCESS_TCPCONN_H

/** need def of NETSNMP_ACCESS_IPADDRESS_BUF_SIZE */
#include <net-snmp/data_access/ipaddress.h>

# ifdef __cplusplus
extern          "C" {
#endif

/**---------------------------------------------------------------------*/
/*
 * structure definitions
 */

/*
 * netsnmp_tcpconn_entry
 *   - primary tcpconn structure for both ipv4 & ipv6
 */
    typedef struct netsnmp_tcpconn_s {

        netsnmp_index oid_index;   /* MUST BE FIRST!! for container use */
        oid           arbitrary_index; /* arbitrary index */

        int       flags; /* for net-snmp use */

        u_char    loc_addr[NETSNMP_ACCESS_IPADDRESS_BUF_SIZE];
        u_char    rmt_addr[NETSNMP_ACCESS_IPADDRESS_BUF_SIZE];

        u_char    loc_addr_len;/* address len, 4 | 16 */
        u_char    rmt_addr_len;/* address len, 4 | 16 */

        u_short   loc_port;
        u_short   rmt_port;
        
        /*
         * mib related data (considered for
         *  netsnmp_access_tcpconn_entry_update)
         */
   
        /*
         * tcpconnState(1)/INTEGER/ASN_INTEGER/long(u_long)//l/A/W/E/r/d/h
         */
        u_int           tcpConnState; /* 1-12 */

        u_int           pid;
   
        netsnmp_data_list *arch_data;      /* arch specific data */
   
    } netsnmp_tcpconn_entry;


/**---------------------------------------------------------------------*/
/*
 * ACCESS function prototypes
 */
/*
 * ifcontainer init
 */
    netsnmp_container * netsnmp_access_tcpconn_container_init(u_int init_flags);
#define NETSNMP_ACCESS_TCPCONN_INIT_NOFLAGS               0x0000

/*
 * ifcontainer load and free
 */
    netsnmp_container*
    netsnmp_access_tcpconn_container_load(netsnmp_container* container,
                                          u_int load_flags);
#define NETSNMP_ACCESS_TCPCONN_LOAD_NOFLAGS               0x0000
#define NETSNMP_ACCESS_TCPCONN_LOAD_NOLISTEN              0x0001
#define NETSNMP_ACCESS_TCPCONN_LOAD_ONLYLISTEN            0x0002
#define NETSNMP_ACCESS_TCPCONN_LOAD_IPV4_ONLY             0x0004

    void netsnmp_access_tcpconn_container_free(netsnmp_container *container,
                                               u_int free_flags);
#define NETSNMP_ACCESS_TCPCONN_FREE_NOFLAGS               0x0000
#define NETSNMP_ACCESS_TCPCONN_FREE_DONT_CLEAR            0x0001
#define NETSNMP_ACCESS_TCPCONN_FREE_KEEP_CONTAINER        0x0002


/*
 * create/free a tcpconn entry
 */
    netsnmp_tcpconn_entry *
    netsnmp_access_tcpconn_entry_create(void);

    void netsnmp_access_tcpconn_entry_free(netsnmp_tcpconn_entry * entry);

/*
 * update/compare
 */
    int
    netsnmp_access_tcpconn_entry_update(netsnmp_tcpconn_entry *old, 
                                        netsnmp_tcpconn_entry *new_val);

/*
 * find entry in container
 */
/** not yet */

/*
 * create/change/delete
 */
    int
    netsnmp_access_tcpconn_entry_set(netsnmp_tcpconn_entry * entry);


/*
 * tcpconn flags
 *   upper bits for internal use
 *   lower bits indicate changed fields. see FLAG_TCPCONN* definitions in
 *         tcpConnTable_constants.h
 */
#define NETSNMP_ACCESS_TCPCONN_CREATE     0x80000000
#define NETSNMP_ACCESS_TCPCONN_DELETE     0x40000000
#define NETSNMP_ACCESS_TCPCONN_CHANGE     0x20000000


/**---------------------------------------------------------------------*/

# ifdef __cplusplus
}
#endif

#endif /* NETSNMP_ACCESS_TCPCONN_H */