tcp_mib_module.c
Go to the documentation of this file.
1 /**
2  * @file tcp_mib_module.c
3  * @brief TCP MIB module
4  *
5  * @section License
6  *
7  * Copyright (C) 2010-2018 Oryx Embedded SARL. All rights reserved.
8  *
9  * This file is part of CycloneTCP Open.
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software Foundation,
23  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24  *
25  * @section Description
26  *
27  * The TCP-MIB describes managed objects used for implementations of
28  * the Transmission Control Protocol (TCP) in an IP version independent
29  * manner. Refer to the following RFCs for complete details:
30  * - RFC 4022: MIB for the Transmission Control Protocol (TCP)
31  * - RFC 4001: Textual Conventions for Internet Network Addresses
32  *
33  * @author Oryx Embedded SARL (www.oryx-embedded.com)
34  * @version 1.9.0
35  **/
36 
37 //Switch to the appropriate trace level
38 #define TRACE_LEVEL SNMP_TRACE_LEVEL
39 
40 //Dependencies
41 #include "core/net.h"
42 #include "mibs/mib_common.h"
43 #include "mibs/tcp_mib_module.h"
44 #include "mibs/tcp_mib_impl.h"
45 #include "core/crypto.h"
46 #include "encoding/asn1.h"
47 #include "encoding/oid.h"
48 #include "debug.h"
49 
50 //Check TCP/IP stack configuration
51 #if (TCP_MIB_SUPPORT == ENABLED && TCP_SUPPORT == ENABLED)
52 
53 
54 /**
55  * @brief TCP MIB base
56  **/
57 
59 
60 
61 /**
62  * @brief TCP MIB objects
63  **/
64 
66 {
67  //tcpRtoAlgorithm object (1.3.6.1.2.1.6.1)
68  {
69  "tcpRtoAlgorithm",
70  {43, 6, 1, 2, 1, 6, 1},
71  7,
76  NULL,
77  sizeof(int32_t),
78  NULL,
79  NULL,
80  NULL
81  },
82  //tcpRtoMin object (1.3.6.1.2.1.6.2)
83  {
84  "tcpRtoMin",
85  {43, 6, 1, 2, 1, 6, 2},
86  7,
91  NULL,
92  sizeof(int32_t),
93  NULL,
94  NULL,
95  NULL
96  },
97  //tcpRtoMax object (1.3.6.1.2.1.6.3)
98  {
99  "tcpRtoMax",
100  {43, 6, 1, 2, 1, 6, 3},
101  7,
106  NULL,
107  sizeof(int32_t),
108  NULL,
109  NULL,
110  NULL
111  },
112  //tcpMaxConn object (1.3.6.1.2.1.6.4)
113  {
114  "tcpMaxConn",
115  {43, 6, 1, 2, 1, 6, 4},
116  7,
121  NULL,
122  sizeof(int32_t),
123  NULL,
124  NULL,
125  NULL
126  },
127  //tcpActiveOpens object (1.3.6.1.2.1.6.5)
128  {
129  "tcpActiveOpens",
130  {43, 6, 1, 2, 1, 6, 5},
131  7,
136  NULL,
137  sizeof(uint32_t),
138  NULL,
139  NULL,
140  NULL
141  },
142  //tcpPassiveOpens object (1.3.6.1.2.1.6.6)
143  {
144  "tcpPassiveOpens",
145  {43, 6, 1, 2, 1, 6, 6},
146  7,
151  NULL,
152  sizeof(uint32_t),
153  NULL,
154  NULL,
155  NULL
156  },
157  //tcpAttemptFails object (1.3.6.1.2.1.6.7)
158  {
159  "tcpAttemptFails",
160  {43, 6, 1, 2, 1, 6, 7},
161  7,
166  NULL,
167  sizeof(uint32_t),
168  NULL,
169  NULL,
170  NULL
171  },
172  //tcpEstabResets object (1.3.6.1.2.1.6.8)
173  {
174  "tcpEstabResets",
175  {43, 6, 1, 2, 1, 6, 8},
176  7,
181  NULL,
182  sizeof(uint32_t),
183  NULL,
184  NULL,
185  NULL
186  },
187  //tcpCurrEstab object (1.3.6.1.2.1.6.9)
188  {
189  "tcpCurrEstab",
190  {43, 6, 1, 2, 1, 6, 9},
191  7,
195  NULL,
196  NULL,
197  sizeof(uint32_t),
198  NULL,
200  NULL
201  },
202  //tcpInSegs object (1.3.6.1.2.1.6.10)
203  {
204  "tcpInSegs",
205  {43, 6, 1, 2, 1, 6, 10},
206  7,
211  NULL,
212  sizeof(uint32_t),
213  NULL,
214  NULL,
215  NULL
216  },
217  //tcpOutSegs object (1.3.6.1.2.1.6.11)
218  {
219  "tcpOutSegs",
220  {43, 6, 1, 2, 1, 6, 11},
221  7,
226  NULL,
227  sizeof(uint32_t),
228  NULL,
229  NULL,
230  NULL
231  },
232  //tcpRetransSegs object (1.3.6.1.2.1.6.12)
233  {
234  "tcpRetransSegs",
235  {43, 6, 1, 2, 1, 6, 12},
236  7,
241  NULL,
242  sizeof(uint32_t),
243  NULL,
244  NULL,
245  NULL
246  },
247  //tcpInErrs object (1.3.6.1.2.1.6.14)
248  {
249  "tcpInErrs",
250  {43, 6, 1, 2, 1, 6, 14},
251  7,
256  NULL,
257  sizeof(uint32_t),
258  NULL,
259  NULL,
260  NULL
261  },
262  //tcpOutRsts object (1.3.6.1.2.1.6.15)
263  {
264  "tcpOutRsts",
265  {43, 6, 1, 2, 1, 6, 15},
266  7,
271  NULL,
272  sizeof(uint32_t),
273  NULL,
274  NULL,
275  NULL
276  },
277  //tcpHCInSegs object (1.3.6.1.2.1.6.17)
278  {
279  "tcpHCInSegs",
280  {43, 6, 1, 2, 1, 6, 17},
281  7,
286  NULL,
287  sizeof(uint64_t),
288  NULL,
289  NULL,
290  NULL
291  },
292  //tcpHCOutSegs object (1.3.6.1.2.1.6.18)
293  {
294  "tcpHCOutSegs",
295  {43, 6, 1, 2, 1, 6, 18},
296  7,
301  NULL,
302  sizeof(uint64_t),
303  NULL,
304  NULL,
305  NULL
306  },
307  //tcpConnectionState object (1.3.6.1.2.1.6.19.1.7)
308  {
309  "tcpConnectionState",
310  {43, 6, 1, 2, 1, 6, 19, 1, 7},
311  9,
315  NULL,
316  NULL,
317  sizeof(int32_t),
321  },
322  //tcpConnectionProcess object (1.3.6.1.2.1.6.19.1.8)
323  {
324  "tcpConnectionProcess",
325  {43, 6, 1, 2, 1, 6, 19, 1, 8},
326  9,
330  NULL,
331  NULL,
332  sizeof(uint32_t),
333  NULL,
336  },
337  //tcpListenerProcess object (1.3.6.1.2.1.6.20.1.4)
338  {
339  "tcpListenerProcess",
340  {43, 6, 1, 2, 1, 6, 20, 1, 4},
341  9,
345  NULL,
346  NULL,
347  sizeof(uint32_t),
348  NULL,
351  }
352 };
353 
354 
355 /**
356  * @brief TCP MIB module
357  **/
358 
360 {
361  "TCP-MIB",
362  {43, 6, 1, 2, 1, 49},
363  6,
366  tcpMibInit,
367  NULL,
368  NULL,
369  NULL,
370  NULL
371 };
372 
373 #endif
uint32_t tcpRetransSegs
TCP MIB module implementation.
TCP/IP stack core.
Debugging facilities.
error_t tcpMibGetNextTcpConnectionEntry(const MibObject *object, const uint8_t *oid, size_t oidLen, uint8_t *nextOid, size_t *nextOidLen)
Get next tcpConnectionEntry object.
Definition: tcp_mib_impl.c:298
const MibModule tcpMibModule
TCP MIB module.
int32_t tcpRtoMin
#define MibObject
Definition: mib_common.h:44
General definitions for cryptographic algorithms.
uint64_t tcpHCInSegs
uint32_t tcpActiveOpens
uint32_t tcpInSegs
uint32_t tcpEstabResets
OID (Object Identifier)
error_t tcpMibInit(void)
TCP MIB module initialization.
Definition: tcp_mib_impl.c:51
error_t tcpMibGetNextTcpListenerEntry(const MibObject *object, const uint8_t *oid, size_t oidLen, uint8_t *nextOid, size_t *nextOidLen)
Get next tcpListenerEntry object.
Definition: tcp_mib_impl.c:540
#define arraysize(a)
Definition: os_port.h:68
const MibObject tcpMibObjects[]
TCP MIB objects.
error_t tcpMibGetTcpCurrEstab(const MibObject *object, const uint8_t *oid, size_t oidLen, MibVariant *value, size_t *valueLen)
Get tcpCurrEstab object value.
Definition: tcp_mib_impl.c:83
ASN.1 (Abstract Syntax Notation One)
#define ASN1_CLASS_APPLICATION
Definition: asn1.h:46
uint64_t tcpHCOutSegs
uint32_t tcpOutSegs
TCP MIB base.
int32_t tcpRtoMax
TcpMibBase tcpMibBase
TCP MIB base.
int32_t tcpRtoAlgorithm
error_t tcpMibSetTcpConnectionEntry(const MibObject *object, const uint8_t *oid, size_t oidLen, const MibVariant *value, size_t valueLen, bool_t commit)
Set tcpConnectionEntry object value.
Definition: tcp_mib_impl.c:129
error_t tcpMibGetTcpConnectionEntry(const MibObject *object, const uint8_t *oid, size_t oidLen, MibVariant *value, size_t *valueLen)
Get tcpConnectionEntry object value.
Definition: tcp_mib_impl.c:147
uint32_t tcpOutRsts
int32_t tcpMaxConn
Common definitions for MIB modules.
uint32_t tcpInErrs
error_t tcpMibGetTcpListenerEntry(const MibObject *object, const uint8_t *oid, size_t oidLen, MibVariant *value, size_t *valueLen)
Get tcpListenerEntry object value.
Definition: tcp_mib_impl.c:454
#define ASN1_CLASS_UNIVERSAL
Definition: asn1.h:45
uint32_t tcpAttemptFails
MIB module.
Definition: mib_common.h:285
uint32_t tcpPassiveOpens
TCP MIB module.