/*-1* SPDX-License-Identifier: BSD-2-Clause2*3* Copyright (c) 2018 Chelsio Communications, Inc.4* All rights reserved.5*6* Redistribution and use in source and binary forms, with or without7* modification, are permitted provided that the following conditions8* are met:9* 1. Redistributions of source code must retain the above copyright10* notice, this list of conditions and the following disclaimer.11* 2. Redistributions in binary form must reproduce the above copyright12* notice, this list of conditions and the following disclaimer in the13* documentation and/or other materials provided with the distribution.14*15* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND16* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE17* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE18* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE19* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL20* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS21* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)22* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT23* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY24* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF25* SUCH DAMAGE.26*27*/2829#ifndef __tcb_common_h30#define __tcb_common_h3132/* ANSI C standard includes */33#include <assert.h>34#include <stdlib.h>35#include <string.h>36#include <ctype.h>37#include <stdio.h>38#include <stdarg.h>394041#ifndef FALSE42#define FALSE 043#endif4445#ifndef EOS46#define EOS '\0'47#endif4849#ifndef __variable_sizes5051/* windows has _UI64_MAX. C99 has ULLONG_MAX, but I don't compile52with C99 for portability with windows, so the ui64 is a guess.53I'll add an assert to cl_main to confirm these sizes are accurate.54*/55#ifdef _UI64_MAX /* windows */56#if (_UI64_MAX == 0xFFFFFFFFFFFFFFFF)57typedef __int64 si64;58typedef unsigned __int64 ui64;59#endif60#else /*else of #ifdef _UI64_MAX */61typedef long long int si64;62typedef unsigned long long int ui64;63#endif /*endif of #ifdef _UI64_MAX */64#endif /* endif of #ifndef __variable_sizes */6566676869typedef struct tcb_var {70char *name;71int aux;72int lo;73int hi;7475char *faka;76int flo;77int fhi;7879char *aka;8081int comp;8283char *desc;84char *akadesc;8586ui64 rawval;87unsigned val;8889} _TCBVAR;909192enum comp_types {9394COMP_NONE=0,95COMP_ULP,96COMP_TX_MAX,97COMP_RCV_NXT,98COMP_PTR,99COMP_LEN,100101};102103104enum tidtypes {105TIDTYPE_TCB=0,106TIDTYPE_SCB=1,107TIDTYPE_FCB=2,108109};110111112enum prntstyls {113PRNTSTYL_VERBOSE=0,114PRNTSTYL_LIST=1,115PRNTSTYL_COMP=2,116PRNTSTYL_RAW=3,117118};119120121/* from tp/src/tp.h */122#define PM_MODE_PASS 0123#define PM_MODE_DDP 1124#define PM_MODE_ISCSI 2125#define PM_MODE_IWARP 3126#define PM_MODE_RDDP 4127#define PM_MODE_IANDP 5128#define PM_MODE_FCOE 6129#define PM_MODE_USER 7130#define PM_MODE_TLS 8131#define PM_MODE_DTLS 9132133134135#define SEQ_ADD(a,b) (((a)+(b)) & 0xFFFFFFFF)136#define SEQ_SUB(a,b) (((a)-(b)) & 0xFFFFFFFF)137138///* functions needed by the tcbshowtN.c code */139extern unsigned val(char *name);140extern ui64 val64(char *name);141extern void PR(char *fmt, ...);142extern char *spr_tcp_state(unsigned state);143extern char *spr_ip_version(unsigned ipver);144extern char *spr_cctrl_sel(unsigned cctrl_sel0,unsigned cctrl_sel1);145extern char *spr_ulp_type(unsigned ulp_type);146147148extern unsigned parse_tcb( _TCBVAR *base_tvp, unsigned char *buf);149extern void display_tcb(_TCBVAR *tvp,unsigned char *buf,int aux);150extern void parse_n_display_xcb(unsigned char *buf);151152extern void swizzle_tcb(unsigned char *buf);153extern void set_tidtype(unsigned int tidtype);154extern void set_tcb_info(unsigned int tidtype, unsigned int cardtype);155extern void set_print_style(unsigned int prntstyl);156157#endif /* __tcb_common_h */158159160