tcp.h

来自「在ARM7和UC/OSII的平台上实现了GPS自动报站的功能,涉及GPS模块LE」· C头文件 代码 · 共 84 行

H
84
字号
/*
 * FILENAME: tcp.h
 *
 * Copyright 1997- 2000 By InterNiche Technologies Inc. All rights reserved
 *
 *
 * MODULE: INET
 *
 *
 * PORTABLE: yes
 */

/* Additional Copyrights: */
/*
 * Copyright (c) 1982, 1986 Regents of the University of California.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms are permitted
 * provided that the above copyright notice and this paragraph are
 * duplicated in all such forms and that any documentation,
 * advertising materials, and other materials related to such
 * distribution and use acknowledge that the software was developed
 * by the University of California, Berkeley.  The name of the
 * University may not be used to endorse or promote products derived
 * from this software without specific prior written permission.
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 */

#ifndef _TCP_H
#define  _TCP_H   1

#ifndef BYTE_ORDER
Error - BYTE_ORDER must be defined, usually in ..\inet\ipport.h
#endif


typedef   u_long   tcp_seq;

/*
 * TCP header.
 * Per RFC 793, September, 1981.
 */

struct tcphdr
{
   u_short  th_sport;      /* source port */
   u_short  th_dport;      /* destination port */
   tcp_seq  th_seq;        /* sequence number */
   tcp_seq  th_ack;        /* acknowledgement number */

   u_char   th_doff;       /* data offset: high 4 bits only */

   /* these macros get/set the raw value, usually 5 */
#define  GET_TH_OFF(th) (th.th_doff >> 4)
#define  SET_TH_OFF(th, off)  (th.th_doff =  (u_char)(off   << 4))

   u_char   th_flags;
#define     TH_FIN   0x01
#define     TH_SYN   0x02
#define     TH_RST   0x04
#define     TH_PUSH     0x08
#define     TH_ACK   0x10
#define     TH_URG   0x20
   u_short     th_win;     /* window */
   u_short     th_sum;     /* checksum */
   u_short     th_urp;     /* urgent pointer */
};

#define  TCPOPT_EOL        0
#define  TCPOPT_NOP        1
#define  TCPOPT_MAXSEG     2
#define  TCPOPT_WINSCALE   3
#define  TCPOPT_SACKOK     4
#define  TCPOPT_SACKDATA   5
#define  TCPOPT_RTT        8

#endif   /* _TCP_H */

/* end of file tcp.h */


⌨️ 快捷键说明

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