2014-06-23 01:27:57 +08:00
|
|
|
/****************************************************************************
|
2022-01-30 02:13:22 +08:00
|
|
|
* net/tcp/tcp_dump.c
|
2014-06-23 01:27:57 +08:00
|
|
|
*
|
2024-09-11 20:39:39 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*
|
2021-02-19 19:45:37 +08: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-23 01:27:57 +08:00
|
|
|
*
|
2021-02-19 19:45:37 +08:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2014-06-23 01:27:57 +08:00
|
|
|
*
|
2021-02-19 19:45:37 +08: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-23 01:27:57 +08:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
|
2020-11-20 15:51:02 +08:00
|
|
|
#include <inttypes.h>
|
2014-06-23 01:27:57 +08:00
|
|
|
#include <stdint.h>
|
|
|
|
#include <debug.h>
|
|
|
|
|
2017-05-09 21:34:59 +08:00
|
|
|
#include <nuttx/mm/iob.h>
|
2014-06-23 01:27:57 +08:00
|
|
|
|
2014-07-07 07:58:36 +08:00
|
|
|
#include "tcp/tcp.h"
|
|
|
|
|
2016-06-12 04:14:08 +08:00
|
|
|
#ifdef CONFIG_DEBUG_FEATURES
|
2014-06-23 01:27:57 +08:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Functions
|
|
|
|
****************************************************************************/
|
|
|
|
|
2022-01-30 02:13:22 +08: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-18 00:42:39 +08:00
|
|
|
#ifdef CONFIG_NET_TCP_WRITE_BUFFERS
|
2022-08-25 21:17:57 +08:00
|
|
|
nerr("ERROR: conn->dev == NULL:"
|
|
|
|
" dev=%p pvpriv=%p flags=0x%04x"
|
2022-01-30 02:13:22 +08: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 21:17:57 +08:00
|
|
|
dev, pvpriv, flags,
|
2022-01-30 02:13:22 +08: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-18 00:42:39 +08:00
|
|
|
#else
|
2022-08-25 21:17:57 +08:00
|
|
|
nerr("ERROR: conn->dev == NULL:"
|
|
|
|
" dev=%p pvpriv=%p flags=0x%04x"
|
2022-05-18 00:42:39 +08: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 21:17:57 +08:00
|
|
|
dev, pvpriv, flags,
|
2022-05-18 00:42:39 +08: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-30 02:13:22 +08:00
|
|
|
}
|
|
|
|
|
2014-06-23 01:27:57 +08:00
|
|
|
/****************************************************************************
|
|
|
|
* Name: tcp_wrbuffer_dump
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Dump the contents of a write buffer
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2022-01-30 02:13:22 +08:00
|
|
|
#ifdef CONFIG_NET_TCP_WRITE_BUFFERS
|
|
|
|
|
2014-06-23 21:31:55 +08:00
|
|
|
void tcp_wrbuffer_dump(FAR const char *msg, FAR struct tcp_wrbuffer_s *wrb,
|
2014-06-23 23:40:17 +08:00
|
|
|
unsigned int len, unsigned int offset)
|
2014-06-23 01:27:57 +08:00
|
|
|
{
|
2020-11-20 15:51:02 +08:00
|
|
|
syslog(LOG_DEBUG, "%s: wrb=%p segno=%" PRIu32 " sent=%d nrtx=%d\n",
|
2018-01-23 09:33:14 +08: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-23 01:27:57 +08:00
|
|
|
}
|
|
|
|
|
2022-01-30 02:13:22 +08:00
|
|
|
#endif
|
|
|
|
|
2016-06-12 04:14:08 +08:00
|
|
|
#endif /* CONFIG_DEBUG_FEATURES */
|