blob: 43ac97a9a9256d9430230e132d99f8d71c3747e6 [file] [log] [blame]
/************************************************************************
*¹¦ÄܽéÉÜ£º×ÔÑÐʵÏÖµÄioctl½Ó¿Ú²ÎÊý¶¨Òå
*¸ºÔðÈË£º
*±¸·ÝÈË£º
*ÐÞ¸ÄÈÕ£º
*ÐÞ¸ÄÄÚÈÝ£º
*°æ±¾ºÅ£º
************************************************************************/
#ifndef __NIOCTL_H_
#define __NIOCTL_H_
#define NIOCTL_MAGIC 'x'
#define NIOCTL_MAX_NR 32 //IOCTL¿ÉÓÃÃüÁîµÄ×î´ó¸öÊý
#define NIOCTL_MAX_MSGLEN 128 //×Ö·û´®ÀàÐͲÎÊýÖµµÄ×î´ó³¤¶È
#define NIOCTL_MAX_NAMELEN 20 //²ÎÊýÃû³ÆµÄ×î´ó³¤¶È
#define NETIOCTL_MAJOR 222 //ioctlÉ豸½Úµã
/*
ͨÓÃioctlµÄ²ÎÊýÀàÐÍ£¬µ±´ÓÄں˷µ»ØÓ¦ÓÃʱ£¬ÔÚbufÖзµ»Ø²Ù×÷½á¹û¡£
*/
typedef struct
{
unsigned int size; //×Ö·û´®ÀàÐͲÎÊýµÄ³¤¶È£¬¶ÔÓÚÕûÐͲÎÊý£¬¸ÃÖµ½¨Ò鸳ֵΪ0
char name[NIOCTL_MAX_NAMELEN]; //²ÎÊýÃû³Æ£¬ÀýÈçfastnat¡¢fastbr¡¢leak
unsigned char buf[NIOCTL_MAX_MSGLEN]; //×Ö·û´®ÀàÐͲÎÊýÖµ£¬ÀýÈçon/off
void *data; //×Ô¶¨Òå½á¹¹Ìå
int value; //ÕûÐͲÎÊýÖµ£¬ÀýÈç0/1/2/3
}__attribute__((packed)) ioctl_data;
#define NIOCTL_READ _IO(NIOCTL_MAGIC,0)
/*»ñÈ¡¶þ²ãÁÚ¾ÓÁбíÖÐmacµØÖ·ºÍ³ö¿Údevname*/
#define NIOCGPCINFO _IOWR(NIOCTL_MAGIC,1,ioctl_data)
/*»ñÈ¡ÍøÂçÉ豸tx¡¢rx¡¢dropµÈͳ¼Æ£¬ÍøÂçÉ豸״̬ÐÅÏ¢*/
#define NIOCGSTATS _IOWR(NIOCTL_MAGIC,2,ioctl_data)
/*ÉèÖÃÄں˲ÎÊýͨÓÃÃüÁÀýÈçfastnat/fastbr/leak/brmoniterµÈ¿ª¹Ø»ò¼¶±ð*/
#define NIOCSKPARAM _IOWR(NIOCTL_MAGIC,3,ioctl_data)
/*»ñÈ¡fastnat ×î´óÁ´½ÓÊý*/
#define NIOCGFASTMAXLINKS _IOR(NIOCTL_MAGIC,7,ioctl_data)//È·¶¨ºóÐøÊÇ·ñ»¹ÒªÊ¹ÓÃ
/*»ñÈ¡×Ô´ò¿ªÍ³¼Æ¿ª¹ØÖ®ºó£¬skb µÄµ±Ç°¸öÊý¡¢Ë²¼ä·åÖµµÈͳ¼ÆÐÅÏ¢¡¢skb¿½±´´ÎÊý¡¢skbÍ·À©Õ¹´ÎÊý
skbÔÚÈíÖжÏÊÍ·Å´ÎÊý*/
#define NIOCGSKBNUM _IOWR(NIOCTL_MAGIC,13,ioctl_data)
/*ÉèÖÃÄÚºËskb dumpÆ¥ÅäÐÅÏ¢£¬ÀýÈçÆ¥ÅäÌØ¶¨macµØÖ·¡¢IPµØÖ·*/
#define NIOCGSKBDUMP _IOR(NIOCTL_MAGIC,14,ioctl_data)
/*ÉèÖÃÄÚºËtcpdump ¿ª¹Ø*/
#define NIOCSTCPDUMP _IOR(NIOCTL_MAGIC,15,ioctl_data)
/**/
#define NIOCPDP _IOR(NIOCTL_MAGIC,17,ioctl_data)
/**/
#define NIOCGKPARAM _IOR(NIOCTL_MAGIC,19,ioctl_data)
/*slab ÐÅÏ¢»ñÈ¡*/
#define NIOCGSLAB _IOR(NIOCTL_MAGIC,21,ioctl_data)
/*add by jiangjing,»ñÈ¡init_netÖÐËùÓÐÍøÂçÉ豸µÄÃû³ÆºÍ״̬ÐÅÏ¢*/
#define NIOCGDEVLIST _IOR(NIOCTL_MAGIC, 22, ioctl_data)
/*add by zhangpeimin£¬»ñÈ¡SKB FASTµ±Ç°Í³¼ÆÐÅÏ¢*/
#define NIOCGSKBFAST _IOR(NIOCTL_MAGIC, 24, ioctl_data)
#define NIOCGMAXMSG _IOR(NIOCTL_MAGIC, 25, ioctl_data)
#define NIOCGPTYPE _IOR(NIOCTL_MAGIC, 26, ioctl_data)
#define NIOCGPSINFO _IOR(NIOCTL_MAGIC, 27, ioctl_data)
#define NIOCGHASH _IOR(NIOCTL_MAGIC, 28, ioctl_data)
/*»ñÈ¡µ±Ç°TCP¶ª°üͳ¼ÆÐÅÏ¢*/
#define NIOCGPKTLOST _IOR(NIOCTL_MAGIC, 29, ioctl_data)
/*»ñÈ¡±¾µØTCPÌ×½Ó×Öͳ¼ÆÐÅÏ¢*/
#define NIOCGTCPSOCKSTATS _IOR(NIOCTL_MAGIC, 30, ioctl_data)
#endif //end _ZXIC_IOCTL_H_