📄 vtypes.c
字号:
/** @file vtypes.c implements the header types for mpi messages */#include "vtypes.h"int cmp_tag(void *pkt, void *_tag){ int r; int tag = (int)_tag; r = (((tag == 0) && (ntohl (((pkt_header *) pkt)->iTag) < 1024)) || (ntohl (((pkt_header *) pkt)->iTag) == tag)); printi ("cmp", "pkt->itag = %d, tag = %d => %d", ntohl (((pkt_header *) pkt)->iTag), tag, r); return r;}char *format_packet_long(pkt_header *p, int m){ static char format[192]; int t; int i; static char *types[] = {"Unknown", "ANY_MSG_AVAIL", "RECV_ANY_CONTROL", "SEND_CONTROL", "RECV_FROM_CHANNEL", "SEND_CHANNEL", "CP_START", "REPLAY_START", "CLIENT_EXIT", "CP_SUCCESSFUL" }; if( p == NULL ) { sprintf(format, "(null)"); return format; } t = ntohl((p)->iType); sprintf(format, "%d->%d tag=%d, size=%d, type=%x(%s)", ntohl((p)->iSrc), ntohl((p)->iDst), ntohl((p)->iTag), ntohl((p)->iSize), t, (t >= 0xff00) ? "PROTOCOL_DEPENDENT" : (((t<0) || (t>8) )?"Unknown":types[t])); ftp_format_packet(format+strlen(format), &p->ftp); if(m != 0) { sprintf(format+strlen(format), "payload:"); if( ntohl(p->iSize) != 0 ) { if( ntohl(p->iSize) < m) m = ntohl(p->iSize); for(i = 0; (i < m) && (strlen(format) < 189); i++) sprintf(format+strlen(format), "%02x ", ((unsigned char*)(p+1))[i]); } else sprintf(format+strlen(format), "message is empty"); } return format;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -