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  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2020 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneTCP Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @section Description
28  *
29  * The TCP-MIB describes managed objects used for implementations of
30  * the Transmission Control Protocol (TCP) in an IP version independent
31  * manner. Refer to the following RFCs for complete details:
32  * - RFC 4022: MIB for the Transmission Control Protocol (TCP)
33  * - RFC 4001: Textual Conventions for Internet Network Addresses
34  *
35  * @author Oryx Embedded SARL (www.oryx-embedded.com)
36  * @version 1.9.8
37  **/
38 
39 //Switch to the appropriate trace level
40 #define TRACE_LEVEL SNMP_TRACE_LEVEL
41 
42 //Dependencies
43 #include "core/net.h"
44 #include "mibs/mib_common.h"
45 #include "mibs/tcp_mib_module.h"
46 #include "mibs/tcp_mib_impl.h"
47 #include "core/crypto.h"
48 #include "encoding/asn1.h"
49 #include "encoding/oid.h"
50 #include "debug.h"
51 
52 //Check TCP/IP stack configuration
53 #if (TCP_MIB_SUPPORT == ENABLED && TCP_SUPPORT == ENABLED)
54 
55 
56 /**
57  * @brief TCP MIB base
58  **/
59 
61 
62 
63 /**
64  * @brief TCP MIB objects
65  **/
66 
68 {
69  //tcpRtoAlgorithm object (1.3.6.1.2.1.6.1)
70  {
71  "tcpRtoAlgorithm",
72  {43, 6, 1, 2, 1, 6, 1},
73  7,
78  NULL,
79  sizeof(int32_t),
80  NULL,
81  NULL,
82  NULL
83  },
84  //tcpRtoMin object (1.3.6.1.2.1.6.2)
85  {
86  "tcpRtoMin",
87  {43, 6, 1, 2, 1, 6, 2},
88  7,
93  NULL,
94  sizeof(int32_t),
95  NULL,
96  NULL,
97  NULL
98  },
99  //tcpRtoMax object (1.3.6.1.2.1.6.3)
100  {
101  "tcpRtoMax",
102  {43, 6, 1, 2, 1, 6, 3},
103  7,
108  NULL,
109  sizeof(int32_t),
110  NULL,
111  NULL,
112  NULL
113  },
114  //tcpMaxConn object (1.3.6.1.2.1.6.4)
115  {
116  "tcpMaxConn",
117  {43, 6, 1, 2, 1, 6, 4},
118  7,
123  NULL,
124  sizeof(int32_t),
125  NULL,
126  NULL,
127  NULL
128  },
129  //tcpActiveOpens object (1.3.6.1.2.1.6.5)
130  {
131  "tcpActiveOpens",
132  {43, 6, 1, 2, 1, 6, 5},
133  7,
138  NULL,
139  sizeof(uint32_t),
140  NULL,
141  NULL,
142  NULL
143  },
144  //tcpPassiveOpens object (1.3.6.1.2.1.6.6)
145  {
146  "tcpPassiveOpens",
147  {43, 6, 1, 2, 1, 6, 6},
148  7,
153  NULL,
154  sizeof(uint32_t),
155  NULL,
156  NULL,
157  NULL
158  },
159  //tcpAttemptFails object (1.3.6.1.2.1.6.7)
160  {
161  "tcpAttemptFails",
162  {43, 6, 1, 2, 1, 6, 7},
163  7,
168  NULL,
169  sizeof(uint32_t),
170  NULL,
171  NULL,
172  NULL
173  },
174  //tcpEstabResets object (1.3.6.1.2.1.6.8)
175  {
176  "tcpEstabResets",
177  {43, 6, 1, 2, 1, 6, 8},
178  7,
183  NULL,
184  sizeof(uint32_t),
185  NULL,
186  NULL,
187  NULL
188  },
189  //tcpCurrEstab object (1.3.6.1.2.1.6.9)
190  {
191  "tcpCurrEstab",
192  {43, 6, 1, 2, 1, 6, 9},
193  7,
197  NULL,
198  NULL,
199  sizeof(uint32_t),
200  NULL,
202  NULL
203  },
204  //tcpInSegs object (1.3.6.1.2.1.6.10)
205  {
206  "tcpInSegs",
207  {43, 6, 1, 2, 1, 6, 10},
208  7,
213  NULL,
214  sizeof(uint32_t),
215  NULL,
216  NULL,
217  NULL
218  },
219  //tcpOutSegs object (1.3.6.1.2.1.6.11)
220  {
221  "tcpOutSegs",
222  {43, 6, 1, 2, 1, 6, 11},
223  7,
228  NULL,
229  sizeof(uint32_t),
230  NULL,
231  NULL,
232  NULL
233  },
234  //tcpRetransSegs object (1.3.6.1.2.1.6.12)
235  {
236  "tcpRetransSegs",
237  {43, 6, 1, 2, 1, 6, 12},
238  7,
243  NULL,
244  sizeof(uint32_t),
245  NULL,
246  NULL,
247  NULL
248  },
249  //tcpInErrs object (1.3.6.1.2.1.6.14)
250  {
251  "tcpInErrs",
252  {43, 6, 1, 2, 1, 6, 14},
253  7,
258  NULL,
259  sizeof(uint32_t),
260  NULL,
261  NULL,
262  NULL
263  },
264  //tcpOutRsts object (1.3.6.1.2.1.6.15)
265  {
266  "tcpOutRsts",
267  {43, 6, 1, 2, 1, 6, 15},
268  7,
273  NULL,
274  sizeof(uint32_t),
275  NULL,
276  NULL,
277  NULL
278  },
279  //tcpHCInSegs object (1.3.6.1.2.1.6.17)
280  {
281  "tcpHCInSegs",
282  {43, 6, 1, 2, 1, 6, 17},
283  7,
288  NULL,
289  sizeof(uint64_t),
290  NULL,
291  NULL,
292  NULL
293  },
294  //tcpHCOutSegs object (1.3.6.1.2.1.6.18)
295  {
296  "tcpHCOutSegs",
297  {43, 6, 1, 2, 1, 6, 18},
298  7,
303  NULL,
304  sizeof(uint64_t),
305  NULL,
306  NULL,
307  NULL
308  },
309  //tcpConnectionState object (1.3.6.1.2.1.6.19.1.7)
310  {
311  "tcpConnectionState",
312  {43, 6, 1, 2, 1, 6, 19, 1, 7},
313  9,
317  NULL,
318  NULL,
319  sizeof(int32_t),
323  },
324  //tcpConnectionProcess object (1.3.6.1.2.1.6.19.1.8)
325  {
326  "tcpConnectionProcess",
327  {43, 6, 1, 2, 1, 6, 19, 1, 8},
328  9,
332  NULL,
333  NULL,
334  sizeof(uint32_t),
335  NULL,
338  },
339  //tcpListenerProcess object (1.3.6.1.2.1.6.20.1.4)
340  {
341  "tcpListenerProcess",
342  {43, 6, 1, 2, 1, 6, 20, 1, 4},
343  9,
347  NULL,
348  NULL,
349  sizeof(uint32_t),
350  NULL,
353  }
354 };
355 
356 
357 /**
358  * @brief TCP MIB module
359  **/
360 
362 {
363  "TCP-MIB",
364  {43, 6, 1, 2, 1, 49},
365  6,
368  tcpMibInit,
369  NULL,
370  NULL,
371  NULL,
372  NULL
373 };
374 
375 #endif
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:560
error_t tcpMibInit(void)
TCP MIB module initialization.
Definition: tcp_mib_impl.c:53
TCP MIB module implementation.
OID (Object Identifier)
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:300
uint32_t tcpInSegs
uint32_t tcpRetransSegs
uint32_t tcpActiveOpens
uint32_t tcpAttemptFails
uint32_t tcpEstabResets
const MibModule tcpMibModule
TCP MIB module.
TCP MIB base.
uint32_t tcpInErrs
#define ASN1_CLASS_UNIVERSAL
Definition: asn1.h:48
uint64_t tcpHCOutSegs
uint64_t tcpHCInSegs
General definitions for cryptographic algorithms.
MIB module.
Definition: mib_common.h:287
int32_t tcpRtoMin
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:85
uint32_t tcpOutSegs
uint32_t tcpPassiveOpens
uint32_t tcpOutRsts
Common definitions for MIB modules.
TCP MIB module.
#define MibObject
Definition: mib_common.h:46
int32_t tcpRtoAlgorithm
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:149
const MibObject tcpMibObjects[]
TCP MIB objects.
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:474
TcpMibBase tcpMibBase
TCP MIB base.
TCP/IP stack core.
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:131
#define ASN1_CLASS_APPLICATION
Definition: asn1.h:49
int32_t tcpRtoMax
Debugging facilities.
ASN.1 (Abstract Syntax Notation One)
int32_t tcpMaxConn
#define arraysize(a)
Definition: os_port.h:70