04 2011 档案

摘要:先介绍opendpi如何设置各个协议的处理,然后介绍如何处理每一个包,最后是软件的流程图。第一:首先看下要用到的重要的宏View Code #define IPOQUE_SAVE_AS_BITMASK(bitmask,value) (bitmask)=(((IPOQUE_PROTOCOL_BITMASK)1)<<(value)) #define IPOQUE_BITMASK_COMPARE(a,b) ((a) & (b)) #define IPOQUE_BITMASK_MATCH(x,y) ((x) == (y)) #define IPOQUE_BITMASK_COMPAR 阅读全文
posted @ 2011-04-21 20:55 lxgeek 阅读(2757) 评论(1) 推荐(0) 编辑
摘要:先贴会有用的相关内容:struct iphdr {#if BYTE_ORDER == LITTLE_ENDIAN uint8_t ihl:4, version:4;#elif BYTE_ORDER == BIG_ENDIAN uint8_t version:4, ihl:4;#else# error "BYTE_ORDER must be defined"#endif uint8_t tos; uint16_t tot_len; uint16_t id; uint16_t frag_off; uint8_t ttl; uint8_t protocol; uint16_t c 阅读全文
posted @ 2011-04-18 19:58 lxgeek 阅读(5193) 评论(1) 推荐(2) 编辑
摘要:/** author: lx date 4.11 2011 biref BN*/#pragma once#include <string>#include <map>#include <vector>#include <iostream>using namespace std;typedef pair< char, float > inter;/* struct of node */struct nbnode{ char name[20]; /* name */ vector< inter > nodeprob; /* p 阅读全文
posted @ 2011-04-11 19:38 lxgeek 阅读(412) 评论(0) 推荐(0) 编辑
摘要:#pragma once#include<list>using namespace std;class roundrobin//class representing round robin scheduling{ int *rq;//request times int n;//number of processes int q;//time quantum int *w;//wait times int *t;//turn-around times int *a;//arrival times list<int> order;public: roundrobin(voi 阅读全文
posted @ 2011-04-10 14:24 lxgeek 阅读(2638) 评论(0) 推荐(1) 编辑
摘要:#define _NSIG 64#define _NSIG_BPW 64#define _NSIG_WORDS (_NSIG / _NSIG_BPW)typedef unsigned long old_sigset_t; /* at least 32 bits */typedef struct { unsigned long sig[_NSIG_WORDS];} sigset_t; 阅读全文
posted @ 2011-04-09 18:44 lxgeek 阅读(208) 评论(0) 推荐(0) 编辑
摘要:/** auhtor:lx date 4.9 2011 brief hash table*/#include <stdio.h>#include <stdlib.h>#include <stdbool.h>#define hash_num 5typedef char Bool;struct hash_node{ int date; /*结点值*/ struct hash_node *next; /*下一个节点*/ Bool found;};struct hash_node* hash_table[hash_num]; /*存储hash table 所有信息* 阅读全文
posted @ 2011-04-09 16:12 lxgeek 阅读(349) 评论(0) 推荐(0) 编辑
摘要:#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include "ourhdr.h"#include "error.c"#include "f10.17.c"static void lockabyte(const char *, int, off_t );int lock_reg( int fd, int cmd, int type, off_t offset, int whence, off_t len ){ struct 阅读全文
posted @ 2011-04-04 20:14 lxgeek 阅读(204) 评论(0) 推荐(0) 编辑