⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 spx.c

📁 该程序类似于tcpdump软件
💻 C
字号:
/**************************************************************************** 
** File: spx.c
**
** Author: Mike Borella
**
** Comments: Dump SPX header information
**
** $Log: spx.c,v $
** Revision 1.2  1998/06/12 21:01:14  mborella
** Added log tag
**
*****************************************************************************/

#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <netinet/in.h>
#include "config.h"
#include "spx.h"

extern struct arg_t *my_args;

/*----------------------------------------------------------------------------
**
** dump_spx()
**
** Parse SPX header and dump fields
**
**----------------------------------------------------------------------------
*/

void dump_spx(u_char *bp, int length)
{
  SPXhdr *spx;
 
  /*
   * Check length
   */

  if (length < sizeof(SPXhdr))
    {
      printf("Truncated header, length = %d bytes\n", length);
      return;
    }

  /*
   * Dump header announcement
   */

  printf("-----------------------------------------------------------------\n");
  printf("                        SPX Header\n");
  printf("-----------------------------------------------------------------\n");

  /*
   * View the packet as an SPX header
   */

  spx = (SPXhdr *) bp;

  /*
   * Dump header fields
   */
  
  if (!my_args->t)
    {
      printf("Connection control: %d\n", spx->cc);
      printf("Data stream type:   %d\n", spx->ds_type);
      printf("Source conn ID:     %d\n", ntohs(spx->s_id));
      printf("Dest conn ID:       %d\n", ntohs(spx->d_id));
      printf("Sequence number:    %d\n", ntohs(spx->seqno));
      printf("Ack number:         %d\n", ntohs(spx->ackno));
      printf("Allocation number:  %d\n", ntohs(spx->allocno));
    }


}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -