ipv4_five_tuple_class_internal.h

来自「ixp2400的一个小程序」· C头文件 代码 · 共 66 行

H
66
字号
//  Copyright (C) 2002-2003 Intel Corporation, All Rights Reserved.
//  Permission is hereby granted to merge this program code with 
//  other program material to create a derivative work.  This 
//  derivative work may be distributed in compiled object form only.
//  Any other publication of this program, in any form, without the 
//  explicit permission of the copyright holder is prohibited.
//
//  Send questions and comments to erik.j.johnson@intel.com, 
//  aaron.kunze@intel.com

//-------------------------------------------------------------------
// ipv4_five_tuple_class_internal.h - Chapter 6
// This file defines the control block structure for the IPv4 
// Five-tuple Classifier microblock

#ifndef IPV4_FIVE_TUPLE_CLASS_INTERNAL_H
#define IPV4_FIVE_TUPLE_CLASS_INTERNAL_H

#define HASH_TABLE_ARRAY_SIZE  256

// This is the hash key.  It is based on an IP 5-tuple
typedef union
{
	struct
	{
		unsigned int source_addr;
		unsigned int destination_addr;
		unsigned int source_port	  :16;
		unsigned int destination_port :16;
		unsigned int protocol		  :8;
		unsigned int pad			  :24;
	} tuple;
	struct
	{
		unsigned int value0;
		unsigned int value1;
		unsigned int value2;
		unsigned int value3;
	} hash_io;
} ip_five_tuple;

// This is the information in the hash table entries
typedef struct _hash_table_entry
{
	ip_five_tuple 	           key;
	unsigned int               flow_id;
	unsigned int               next_hop_id;
	unsigned int               drop;
	struct _hash_table_entry*  next;
} hash_table_entry;

// If we are using hardware, the IP_FIVE_TUPLE_DATA 
// symbol is an imported variable.  In the simulator, it 
// is a #define in the compile options
#ifdef HARDWARE
#define IP_FIVE_TUPLE_SYMBOL_NAME	"IP_FIVE_TUPLE_DATA"

#ifdef MICRO_C
int ETHERNET_DATA = 
			LoadTimeConstant(IP_FIVE_TUPLE_SYMBOL_NAME);
#endif
#endif // HARDWARE


#endif // IPV4_FIVE_TUPLE_CLASS_INTERNAL_H

⌨️ 快捷键说明

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