tcp_mib_impl.c
Go to the documentation of this file.
1 /**
2  * @file tcp_mib_impl.c
3  * @brief TCP MIB module implementation
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2024 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  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 2.4.4
29  **/
30 
31 //Switch to the appropriate trace level
32 #define TRACE_LEVEL SNMP_TRACE_LEVEL
33 
34 //Dependencies
35 #include "core/net.h"
36 #include "mibs/mib_common.h"
37 #include "mibs/tcp_mib_module.h"
38 #include "mibs/tcp_mib_impl.h"
39 #include "core/crypto.h"
40 #include "encoding/asn1.h"
41 #include "encoding/oid.h"
42 #include "debug.h"
43 
44 //Check TCP/IP stack configuration
45 #if (TCP_MIB_SUPPORT == ENABLED && TCP_SUPPORT == ENABLED)
46 
47 
48 /**
49  * @brief TCP MIB module initialization
50  * @return Error code
51  **/
52 
54 {
55  //Debug message
56  TRACE_INFO("Initializing TCP-MIB base...\r\n");
57 
58  //Clear TCP MIB base
59  osMemset(&tcpMibBase, 0, sizeof(tcpMibBase));
60 
61  //tcpRtoAlgorithm object
63  //tcpRtoMin object
65  //tcpRtoMax object
67  //tcpMaxConn object
69 
70  //Successful processing
71  return NO_ERROR;
72 }
73 
74 
75 /**
76  * @brief Get tcpCurrEstab object value
77  * @param[in] object Pointer to the MIB object descriptor
78  * @param[in] oid Object identifier (object name and instance identifier)
79  * @param[in] oidLen Length of the OID, in bytes
80  * @param[out] value Object value
81  * @param[in,out] valueLen Length of the object value, in bytes
82  * @return Error code
83  **/
84 
85 error_t tcpMibGetTcpCurrEstab(const MibObject *object, const uint8_t *oid,
86  size_t oidLen, MibVariant *value, size_t *valueLen)
87 {
88  uint_t i;
89  Socket *socket;
90 
91  //Initialize object value
92  value->gauge32 = 0;
93 
94  //Loop through socket descriptors
95  for(i = 0; i < SOCKET_MAX_COUNT; i++)
96  {
97  //Point to current socket
98  socket = &socketTable[i];
99 
100  //TCP socket?
101  if(socket->type == SOCKET_TYPE_STREAM)
102  {
103  //Check current state
104  if(socket->state == TCP_STATE_ESTABLISHED ||
105  socket->state == TCP_STATE_CLOSE_WAIT)
106  {
107  //Number of TCP connections for which the current state
108  //is either ESTABLISHED or CLOSE-WAIT
109  value->gauge32++;
110  }
111  }
112  }
113 
114  //Successful processing
115  return NO_ERROR;
116 }
117 
118 
119 /**
120  * @brief Set tcpConnectionEntry object value
121  * @param[in] object Pointer to the MIB object descriptor
122  * @param[in] oid Object identifier (object name and instance identifier)
123  * @param[in] oidLen Length of the OID, in bytes
124  * @param[in] value Object value
125  * @param[in] valueLen Length of the object value, in bytes
126  * @param[in] commit This flag tells whether the changes shall be committed
127  * to the MIB base
128  * @return Error code
129  **/
130 
131 error_t tcpMibSetTcpConnectionEntry(const MibObject *object, const uint8_t *oid,
132  size_t oidLen, const MibVariant *value, size_t valueLen, bool_t commit)
133 {
134  //Not implemented
135  return ERROR_WRITE_FAILED;
136 }
137 
138 
139 /**
140  * @brief Get tcpConnectionEntry object value
141  * @param[in] object Pointer to the MIB object descriptor
142  * @param[in] oid Object identifier (object name and instance identifier)
143  * @param[in] oidLen Length of the OID, in bytes
144  * @param[out] value Object value
145  * @param[in,out] valueLen Length of the object value, in bytes
146  * @return Error code
147  **/
148 
149 error_t tcpMibGetTcpConnectionEntry(const MibObject *object, const uint8_t *oid,
150  size_t oidLen, MibVariant *value, size_t *valueLen)
151 {
152  error_t error;
153  uint_t i;
154  size_t n;
155  IpAddr localIpAddr;
156  uint16_t localPort;
157  IpAddr remoteIpAddr;
158  uint16_t remotePort;
159  Socket *socket;
160 
161  //Point to the instance identifier
162  n = object->oidLen;
163 
164  //tcpConnectionLocalAddressType and tcpConnectionLocalAddress are used
165  //as 1st and 2nd instance identifiers
166  error = mibDecodeIpAddr(oid, oidLen, &n, &localIpAddr);
167  //Invalid instance identifier?
168  if(error)
169  return error;
170 
171  //tcpConnectionLocalPort is used as 3rd instance identifier
172  error = mibDecodePort(oid, oidLen, &n, &localPort);
173  //Invalid instance identifier?
174  if(error)
175  return error;
176 
177  //tcpConnectionRemAddressType and tcpConnectionRemAddress are used
178  //as 4th and 5th instance identifiers
179  error = mibDecodeIpAddr(oid, oidLen, &n, &remoteIpAddr);
180  //Invalid instance identifier?
181  if(error)
182  return error;
183 
184  //tcpConnectionRemPort is used as 6th instance identifier
185  error = mibDecodePort(oid, oidLen, &n, &remotePort);
186  //Invalid instance identifier?
187  if(error)
188  return error;
189 
190  //Sanity check
191  if(n != oidLen)
193 
194  //Loop through socket descriptors
195  for(i = 0; i < SOCKET_MAX_COUNT; i++)
196  {
197  //Point to current socket
198  socket = &socketTable[i];
199 
200  //TCP socket?
201  if(socket->type == SOCKET_TYPE_STREAM)
202  {
203  //Check local IP address
204  if(!ipCompAddr(&socket->localIpAddr, &localIpAddr))
205  continue;
206  //Check local port number
207  if(socket->localPort != localPort)
208  continue;
209  //Check remote IP address
210  if(!ipCompAddr(&socket->remoteIpAddr, &remoteIpAddr))
211  continue;
212  //Check local port number
213  if(socket->remotePort != remotePort)
214  continue;
215  //Check current state
216  if(socket->state == TCP_STATE_LISTEN)
217  continue;
218 
219  //A matching socket has been found
220  break;
221  }
222  }
223 
224  //No matching connection found in socket table?
225  if(i >= SOCKET_MAX_COUNT)
227 
228  //tcpConnectionState object?
229  if(osStrcmp(object->name, "tcpConnectionState") == 0)
230  {
231  //Get object value
232  switch(socket->state)
233  {
234  case TCP_STATE_CLOSED:
235  value->integer = TCP_MIB_CONN_STATE_CLOSED;
236  break;
237  case TCP_STATE_LISTEN:
238  value->integer = TCP_MIB_CONN_STATE_LISTEN;
239  break;
240  case TCP_STATE_SYN_SENT:
242  break;
245  break;
248  break;
251  break;
254  break;
257  break;
258  case TCP_STATE_LAST_ACK:
260  break;
261  case TCP_STATE_CLOSING:
263  break;
264  case TCP_STATE_TIME_WAIT:
266  break;
267  default:
268  value->integer = 0;
269  break;
270  }
271  }
272  //tcpConnectionProcess object?
273  else if(osStrcmp(object->name, "tcpConnectionProcess") == 0)
274  {
275  //ID of the process associated with this connection
276  value->unsigned32 = 0;
277  }
278  //Unknown object?
279  else
280  {
281  //The specified object does not exist
282  error = ERROR_OBJECT_NOT_FOUND;
283  }
284 
285  //Return status code
286  return error;
287 }
288 
289 
290 /**
291  * @brief Get next tcpConnectionEntry object
292  * @param[in] object Pointer to the MIB object descriptor
293  * @param[in] oid Object identifier
294  * @param[in] oidLen Length of the OID, in bytes
295  * @param[out] nextOid OID of the next object in the MIB
296  * @param[out] nextOidLen Length of the next object identifier, in bytes
297  * @return Error code
298  **/
299 
300 error_t tcpMibGetNextTcpConnectionEntry(const MibObject *object, const uint8_t *oid,
301  size_t oidLen, uint8_t *nextOid, size_t *nextOidLen)
302 {
303  error_t error;
304  uint_t i;
305  size_t n;
306  bool_t acceptable;
307  IpAddr localIpAddr;
308  uint16_t localPort;
309  IpAddr remoteIpAddr;
310  uint16_t remotePort;
311  Socket *socket;
312 
313  //Initialize variables
314  localIpAddr = IP_ADDR_ANY;
315  localPort = 0;
316  remoteIpAddr = IP_ADDR_ANY;
317  remotePort = 0;
318 
319  //Make sure the buffer is large enough to hold the OID prefix
320  if(*nextOidLen < object->oidLen)
321  return ERROR_BUFFER_OVERFLOW;
322 
323  //Copy OID prefix
324  osMemcpy(nextOid, object->oid, object->oidLen);
325 
326  //Loop through socket descriptors
327  for(i = 0; i < SOCKET_MAX_COUNT; i++)
328  {
329  //Point to current socket
330  socket = &socketTable[i];
331 
332  //TCP socket?
333  if(socket->type == SOCKET_TYPE_STREAM)
334  {
335  //Check current state
336  if(socket->state != TCP_STATE_LISTEN)
337  {
338  //Append the instance identifier to the OID prefix
339  n = object->oidLen;
340 
341  //tcpConnectionLocalAddressType and tcpConnectionLocalAddress are used
342  //as 1st and 2nd instance identifiers
343  error = mibEncodeIpAddr(nextOid, *nextOidLen, &n, &socket->localIpAddr);
344  //Any error to report?
345  if(error)
346  return error;
347 
348  //tcpConnectionLocalPort is used as 3rd instance identifier
349  error = mibEncodePort(nextOid, *nextOidLen, &n, socket->localPort);
350  //Any error to report?
351  if(error)
352  return error;
353 
354  //tcpConnectionRemAddressType and tcpConnectionRemAddress are used
355  //as 4th and 5th instance identifiers
356  error = mibEncodeIpAddr(nextOid, *nextOidLen, &n, &socket->remoteIpAddr);
357  //Any error to report?
358  if(error)
359  return error;
360 
361  //tcpConnectionRemPort is used as 6th instance identifier
362  error = mibEncodePort(nextOid, *nextOidLen, &n, socket->remotePort);
363  //Any error to report?
364  if(error)
365  return error;
366 
367  //Check whether the resulting object identifier lexicographically
368  //follows the specified OID
369  if(oidComp(nextOid, n, oid, oidLen) > 0)
370  {
371  //Perform lexicographic comparison
372  if(localPort == 0 && remotePort == 0)
373  {
374  acceptable = TRUE;
375  }
376  else if(mibCompIpAddr(&socket->localIpAddr, &localIpAddr) < 0)
377  {
378  acceptable = TRUE;
379  }
380  else if(mibCompIpAddr(&socket->localIpAddr, &localIpAddr) > 0)
381  {
382  acceptable = FALSE;
383  }
384  else if(socket->localPort < localPort)
385  {
386  acceptable = TRUE;
387  }
388  else if(socket->localPort > localPort)
389  {
390  acceptable = FALSE;
391  }
392  else if(mibCompIpAddr(&socket->remoteIpAddr, &remoteIpAddr) < 0)
393  {
394  acceptable = TRUE;
395  }
396  else if(mibCompIpAddr(&socket->remoteIpAddr, &remoteIpAddr) > 0)
397  {
398  acceptable = FALSE;
399  }
400  else if(socket->remotePort < remotePort)
401  {
402  acceptable = TRUE;
403  }
404  else
405  {
406  acceptable = FALSE;
407  }
408 
409  //Save the closest object identifier that follows the specified
410  //OID in lexicographic order
411  if(acceptable)
412  {
413  localIpAddr = socket->localIpAddr;
414  localPort = socket->localPort;
415  remoteIpAddr = socket->remoteIpAddr;
416  remotePort = socket->remotePort;
417  }
418  }
419  }
420  }
421  }
422 
423  //The specified OID does not lexicographically precede the name
424  //of some object?
425  if(localPort == 0 && remotePort == 0)
426  return ERROR_OBJECT_NOT_FOUND;
427 
428  //Append the instance identifier to the OID prefix
429  n = object->oidLen;
430 
431  //tcpConnectionLocalAddressType and tcpConnectionLocalAddress are used
432  //as 1st and 2nd instance identifiers
433  error = mibEncodeIpAddr(nextOid, *nextOidLen, &n, &localIpAddr);
434  //Any error to report?
435  if(error)
436  return error;
437 
438  //tcpConnectionLocalPort is used as 3rd instance identifier
439  error = mibEncodePort(nextOid, *nextOidLen, &n, localPort);
440  //Any error to report?
441  if(error)
442  return error;
443 
444  //tcpConnectionRemAddressType and tcpConnectionRemAddress are used
445  //as 4th and 5th instance identifiers
446  error = mibEncodeIpAddr(nextOid, *nextOidLen, &n, &remoteIpAddr);
447  //Any error to report?
448  if(error)
449  return error;
450 
451  //tcpConnectionRemPort is used as 6th instance identifier
452  error = mibEncodePort(nextOid, *nextOidLen, &n, remotePort);
453  //Any error to report?
454  if(error)
455  return error;
456 
457  //Save the length of the resulting object identifier
458  *nextOidLen = n;
459  //Next object found
460  return NO_ERROR;
461 }
462 
463 
464 /**
465  * @brief Get tcpListenerEntry object value
466  * @param[in] object Pointer to the MIB object descriptor
467  * @param[in] oid Object identifier (object name and instance identifier)
468  * @param[in] oidLen Length of the OID, in bytes
469  * @param[out] value Object value
470  * @param[in,out] valueLen Length of the object value, in bytes
471  * @return Error code
472  **/
473 
474 error_t tcpMibGetTcpListenerEntry(const MibObject *object, const uint8_t *oid,
475  size_t oidLen, MibVariant *value, size_t *valueLen)
476 {
477  error_t error;
478  uint_t i;
479  size_t n;
480  IpAddr localIpAddr;
481  uint16_t localPort;
482  Socket *socket;
483 
484  //Point to the instance identifier
485  n = object->oidLen;
486 
487  //tcpListenerLocalAddressType and tcpListenerLocalAddress are used
488  //as 1st and 2nd instance identifiers
489  error = mibDecodeIpAddr(oid, oidLen, &n, &localIpAddr);
490  //Invalid instance identifier?
491  if(error)
492  return error;
493 
494  //tcpListenerLocalPort is used as 3rd instance identifier
495  error = mibDecodePort(oid, oidLen, &n, &localPort);
496  //Invalid instance identifier?
497  if(error)
498  return error;
499 
500  //Sanity check
501  if(n != oidLen)
503 
504  //Loop through socket descriptors
505  for(i = 0; i < SOCKET_MAX_COUNT; i++)
506  {
507  //Point to current socket
508  socket = &socketTable[i];
509 
510  //TCP socket?
511  if(socket->type == SOCKET_TYPE_STREAM)
512  {
513  //Check local IP address
514  if(!ipCompAddr(&socket->localIpAddr, &localIpAddr))
515  continue;
516  //Check local port number
517  if(socket->localPort != localPort)
518  continue;
519  //Check current state
520  if(socket->state != TCP_STATE_LISTEN)
521  continue;
522 
523  //A matching socket has been found
524  break;
525  }
526  }
527 
528  //No matching connection found in socket table?
529  if(i >= SOCKET_MAX_COUNT)
531 
532  //tcpListenerProcess object?
533  if(osStrcmp(object->name, "tcpListenerProcess") == 0)
534  {
535  //ID of the process associated with this listener
536  value->unsigned32 = 0;
537  }
538  //Unknown object?
539  else
540  {
541  //The specified object does not exist
542  error = ERROR_OBJECT_NOT_FOUND;
543  }
544 
545  //Return status code
546  return error;
547 }
548 
549 
550 /**
551  * @brief Get next tcpListenerEntry object
552  * @param[in] object Pointer to the MIB object descriptor
553  * @param[in] oid Object identifier
554  * @param[in] oidLen Length of the OID, in bytes
555  * @param[out] nextOid OID of the next object in the MIB
556  * @param[out] nextOidLen Length of the next object identifier, in bytes
557  * @return Error code
558  **/
559 
560 error_t tcpMibGetNextTcpListenerEntry(const MibObject *object, const uint8_t *oid,
561  size_t oidLen, uint8_t *nextOid, size_t *nextOidLen)
562 {
563  error_t error;
564  uint_t i;
565  size_t n;
566  bool_t acceptable;
567  IpAddr localIpAddr;
568  uint16_t localPort;
569  Socket *socket;
570 
571  //Initialize variables
572  localIpAddr = IP_ADDR_ANY;
573  localPort = 0;
574 
575  //Make sure the buffer is large enough to hold the OID prefix
576  if(*nextOidLen < object->oidLen)
577  return ERROR_BUFFER_OVERFLOW;
578 
579  //Copy OID prefix
580  osMemcpy(nextOid, object->oid, object->oidLen);
581 
582  //Loop through socket descriptors
583  for(i = 0; i < SOCKET_MAX_COUNT; i++)
584  {
585  //Point to current socket
586  socket = &socketTable[i];
587 
588  //TCP socket?
589  if(socket->type == SOCKET_TYPE_STREAM)
590  {
591  //Check current state
592  if(socket->state == TCP_STATE_LISTEN)
593  {
594  //Append the instance identifier to the OID prefix
595  n = object->oidLen;
596 
597  //tcpListenerLocalAddressType and tcpListenerLocalAddress are used
598  //as 1st and 2nd instance identifiers
599  error = mibEncodeIpAddr(nextOid, *nextOidLen, &n, &socket->localIpAddr);
600  //Any error to report?
601  if(error)
602  return error;
603 
604  //tcpListenerLocalPort is used as 3rd instance identifier
605  error = mibEncodePort(nextOid, *nextOidLen, &n, socket->localPort);
606  //Any error to report?
607  if(error)
608  return error;
609 
610  //Check whether the resulting object identifier lexicographically
611  //follows the specified OID
612  if(oidComp(nextOid, n, oid, oidLen) > 0)
613  {
614  //Perform lexicographic comparison
615  if(localPort == 0)
616  {
617  acceptable = TRUE;
618  }
619  else if(mibCompIpAddr(&socket->localIpAddr, &localIpAddr) < 0)
620  {
621  acceptable = TRUE;
622  }
623  else if(mibCompIpAddr(&socket->localIpAddr, &localIpAddr) > 0)
624  {
625  acceptable = FALSE;
626  }
627  else if(socket->localPort < localPort)
628  {
629  acceptable = TRUE;
630  }
631  else
632  {
633  acceptable = FALSE;
634  }
635 
636  //Save the closest object identifier that follows the specified
637  //OID in lexicographic order
638  if(acceptable)
639  {
640  localIpAddr = socket->localIpAddr;
641  localPort = socket->localPort;
642  }
643  }
644  }
645  }
646  }
647 
648  //The specified OID does not lexicographically precede the name
649  //of some object?
650  if(localPort == 0)
651  return ERROR_OBJECT_NOT_FOUND;
652 
653  //Append the instance identifier to the OID prefix
654  n = object->oidLen;
655 
656  //tcpListenerLocalAddressType and tcpListenerLocalAddress are used
657  //as 1st and 2nd instance identifiers
658  error = mibEncodeIpAddr(nextOid, *nextOidLen, &n, &localIpAddr);
659  //Any error to report?
660  if(error)
661  return error;
662 
663  //tcpListenerLocalPort is used as 3rd instance identifier
664  error = mibEncodePort(nextOid, *nextOidLen, &n, localPort);
665  //Any error to report?
666  if(error)
667  return error;
668 
669  //Save the length of the resulting object identifier
670  *nextOidLen = n;
671  //Next object found
672  return NO_ERROR;
673 }
674 
675 #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
@ TCP_STATE_TIME_WAIT
Definition: tcp.h:278
error_t mibEncodeIpAddr(uint8_t *oid, size_t maxOidLen, size_t *pos, const IpAddr *ipAddr)
Encode instance identifier (IP address)
Definition: mib_common.c:808
int bool_t
Definition: compiler_port.h:53
error_t tcpMibInit(void)
TCP MIB module initialization.
Definition: tcp_mib_impl.c:53
#define TCP_MAX_RTO
Definition: tcp.h:131
@ TCP_MIB_CONN_STATE_SYN_SENT
@ TCP_MIB_CONN_STATE_LISTEN
IP network address.
Definition: ip.h:90
@ ERROR_BUFFER_OVERFLOW
Definition: error.h:142
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
@ TCP_STATE_FIN_WAIT_1
Definition: tcp.h:275
#define TRUE
Definition: os_port.h:50
error_t mibEncodePort(uint8_t *oid, size_t maxOidLen, size_t *pos, uint16_t port)
Encode instance identifier (port number)
Definition: mib_common.c:478
@ TCP_MIB_CONN_STATE_CLOSING
@ TCP_STATE_CLOSE_WAIT
Definition: tcp.h:273
@ TCP_MIB_CONN_STATE_CLOSED
@ TCP_MIB_CONN_STATE_ESTABLISHED
#define osStrcmp(s1, s2)
Definition: os_port.h:171
error_t mibDecodePort(const uint8_t *oid, size_t oidLen, size_t *pos, uint16_t *port)
Decode instance identifier (port number)
Definition: mib_common.c:495
@ SOCKET_TYPE_STREAM
Definition: socket.h:92
int_t oidComp(const uint8_t *oid1, size_t oidLen1, const uint8_t *oid2, size_t oidLen2)
Compare object identifiers.
Definition: oid.c:103
uint8_t oid[]
Definition: lldp_tlv.h:300
@ TCP_MIB_CONN_STATE_LAST_ACK
const IpAddr IP_ADDR_ANY
Definition: ip.c:53
int_t mibCompIpAddr(const IpAddr *ipAddr1, const IpAddr *ipAddr2)
Compare IP addresses.
Definition: mib_common.c:968
#define FALSE
Definition: os_port.h:46
@ TCP_MIB_CONN_STATE_TIME_WAIT
#define osMemcpy(dest, src, length)
Definition: os_port.h:141
error_t
Error codes.
Definition: error.h:43
bool_t ipCompAddr(const IpAddr *ipAddr1, const IpAddr *ipAddr2)
Compare IP addresses.
Definition: ip.c:317
@ ERROR_INSTANCE_NOT_FOUND
Definition: error.h:257
int_t socket(int_t family, int_t type, int_t protocol)
Create a socket that is bound to a specific transport service provider.
Definition: bsd_socket.c:65
@ TCP_MIB_CONN_STATE_CLOSE_WAIT
General definitions for cryptographic algorithms.
@ TCP_STATE_SYN_SENT
Definition: tcp.h:270
#define TRACE_INFO(...)
Definition: debug.h:95
@ TCP_STATE_LAST_ACK
Definition: tcp.h:274
int32_t tcpRtoMin
@ TCP_STATE_CLOSING
Definition: tcp.h:277
Socket socketTable[SOCKET_MAX_COUNT]
Definition: socket.c:49
@ TCP_MIB_CONN_STATE_FIN_WAIT_1
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
@ TCP_STATE_CLOSED
Definition: tcp.h:268
@ TCP_STATE_LISTEN
Definition: tcp.h:269
@ TCP_MIB_CONN_STATE_FIN_WAIT_2
Common definitions for MIB modules.
uint8_t n
TCP MIB module.
@ ERROR_WRITE_FAILED
Definition: error.h:222
@ ERROR_OBJECT_NOT_FOUND
Definition: error.h:256
#define Socket
Definition: socket.h:36
@ TCP_STATE_FIN_WAIT_2
Definition: tcp.h:276
#define MibObject
Definition: mib_common.h:46
uint8_t value[]
Definition: tcp.h:369
uint8_t oidLen
Definition: lldp_tlv.h:299
error_t mibDecodeIpAddr(const uint8_t *oid, size_t oidLen, size_t *pos, IpAddr *ipAddr)
Decode instance identifier (IP address)
Definition: mib_common.c:886
int32_t tcpRtoAlgorithm
@ TCP_STATE_SYN_RECEIVED
Definition: tcp.h:271
#define TCP_MIN_RTO
Definition: tcp.h:124
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
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.
MibVariant
Definition: mib_common.h:196
unsigned int uint_t
Definition: compiler_port.h:50
#define osMemset(p, value, length)
Definition: os_port.h:135
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
@ TCP_MIB_CONN_STATE_SYN_RECEIVED
#define SOCKET_MAX_COUNT
Definition: socket.h:46
int32_t tcpRtoMax
@ TCP_MIB_RTO_ALGORITHM_VANJ
@ TCP_STATE_ESTABLISHED
Definition: tcp.h:272
@ NO_ERROR
Success.
Definition: error.h:44
Debugging facilities.
ASN.1 (Abstract Syntax Notation One)
int32_t tcpMaxConn