2014-06-22 19:27:57 +02:00
|
|
|
/****************************************************************************
|
2022-01-29 19:13:22 +01:00
|
|
|
* net/tcp/tcp_dump.c
|
2014-06-22 19:27:57 +02:00
|
|
|
*
|
2024-09-11 14:39:39 +02:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*
|
2021-02-19 12:45:37 +01:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership. The
|
|
|
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance with the
|
|
|
|
* License. You may obtain a copy of the License at
|
2014-06-22 19:27:57 +02:00
|
|
|
*
|
2021-02-19 12:45:37 +01:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2014-06-22 19:27:57 +02:00
|
|
|
*
|
2021-02-19 12:45:37 +01:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
2014-06-22 19:27:57 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
|
2020-11-20 08:51:02 +01:00
|
|
|
#include <inttypes.h>
|
2014-06-22 19:27:57 +02:00
|
|
|
#include <stdint.h>
|
|
|
|
#include <debug.h>
|
|
|
|
|
2017-05-09 15:34:59 +02:00
|
|
|
#include <nuttx/mm/iob.h>
|
2014-06-22 19:27:57 +02:00
|
|
|
|
2014-07-07 01:58:36 +02:00
|
|
|
#include "tcp/tcp.h"
|
|
|
|
|
2016-06-11 22:14:08 +02:00
|
|
|
#ifdef CONFIG_DEBUG_FEATURES
|
2014-06-22 19:27:57 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Functions
|
|
|
|
****************************************************************************/
|
|
|
|
|
2022-01-29 19:13:22 +01:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: tcp_event_handler_dump
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Dump the TCP event handler related variables
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
void tcp_event_handler_dump(FAR struct net_driver_s *dev,
|
|
|
|
FAR void *pvpriv,
|
|
|
|
uint16_t flags,
|
|
|
|
FAR struct tcp_conn_s *conn)
|
|
|
|
{
|
2022-05-17 18:42:39 +02:00
|
|
|
#ifdef CONFIG_NET_TCP_WRITE_BUFFERS
|
2022-08-25 15:17:57 +02:00
|
|
|
nerr("ERROR: conn->dev == NULL:"
|
|
|
|
" dev=%p pvpriv=%p flags=0x%04x"
|
2022-01-29 19:13:22 +01:00
|
|
|
" conn->dev=%p conn->flags=0x%04x tcpstateflags=0x%02x crefs=%d"
|
|
|
|
" isn=%" PRIu32 " sndseq=%" PRIu32
|
|
|
|
" tx_unacked=%" PRId32 " sent=%" PRId32
|
|
|
|
" conn=%p s_flags=0x%02x\n",
|
2022-08-25 15:17:57 +02:00
|
|
|
dev, pvpriv, flags,
|
2022-01-29 19:13:22 +01:00
|
|
|
conn->dev, conn->flags, conn->tcpstateflags, conn->crefs,
|
|
|
|
conn->isn, tcp_getsequence(conn->sndseq),
|
|
|
|
(uint32_t)conn->tx_unacked, conn->sent,
|
|
|
|
conn, conn->sconn.s_flags);
|
2022-05-17 18:42:39 +02:00
|
|
|
#else
|
2022-08-25 15:17:57 +02:00
|
|
|
nerr("ERROR: conn->dev == NULL:"
|
|
|
|
" dev=%p pvpriv=%p flags=0x%04x"
|
2022-05-17 18:42:39 +02:00
|
|
|
" conn->dev=%p conn->flags=0x%04x tcpstateflags=0x%02x crefs=%d"
|
|
|
|
" sndseq=%" PRIu32
|
|
|
|
" tx_unacked=%" PRId32
|
|
|
|
" conn=%p s_flags=0x%02x\n",
|
2022-08-25 15:17:57 +02:00
|
|
|
dev, pvpriv, flags,
|
2022-05-17 18:42:39 +02:00
|
|
|
conn->dev, conn->flags, conn->tcpstateflags, conn->crefs,
|
|
|
|
tcp_getsequence(conn->sndseq),
|
|
|
|
(uint32_t)conn->tx_unacked,
|
|
|
|
conn, conn->sconn.s_flags);
|
|
|
|
#endif
|
2022-01-29 19:13:22 +01:00
|
|
|
}
|
|
|
|
|
2014-06-22 19:27:57 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: tcp_wrbuffer_dump
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Dump the contents of a write buffer
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2022-01-29 19:13:22 +01:00
|
|
|
#ifdef CONFIG_NET_TCP_WRITE_BUFFERS
|
|
|
|
|
2014-06-23 15:31:55 +02:00
|
|
|
void tcp_wrbuffer_dump(FAR const char *msg, FAR struct tcp_wrbuffer_s *wrb,
|
2014-06-23 17:40:17 +02:00
|
|
|
unsigned int len, unsigned int offset)
|
2014-06-22 19:27:57 +02:00
|
|
|
{
|
2020-11-20 08:51:02 +01:00
|
|
|
syslog(LOG_DEBUG, "%s: wrb=%p segno=%" PRIu32 " sent=%d nrtx=%d\n",
|
2018-01-23 02:33:14 +01:00
|
|
|
msg, wrb, TCP_WBSEQNO(wrb), TCP_WBSENT(wrb), TCP_WBNRTX(wrb));
|
|
|
|
iob_dump("I/O Buffer Chain", TCP_WBIOB(wrb), len, offset);
|
2014-06-22 19:27:57 +02:00
|
|
|
}
|
|
|
|
|
2022-01-29 19:13:22 +01:00
|
|
|
#endif
|
|
|
|
|
2016-06-11 22:14:08 +02:00
|
|
|
#endif /* CONFIG_DEBUG_FEATURES */
|