91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 12KB
    文件類型: .c
    金幣: 1
    下載: 0 次
    發布日期: 2021-06-04
  • 語言: 其他
  • 標簽: 智能網關??

資源簡介

智能網關部分代碼,可作為參考,這是我為公司寫的代碼,已經運行在各個城市公交地鐵wifi上

資源截圖

代碼片段和文件信息

#include?
#include?
#include?
#include?


#include?“string.h“
#include?“file.h“
#include?“debug.h“
#include?“iptables.h“

#define?IPTABLES “/usr/sbin/iptables“

#define?INPUT_DEV “br-lan“

unsigned?char?byNetSegment[32]?=?{‘1‘‘9‘‘2‘‘.‘‘1‘‘6‘‘8‘‘.‘‘1‘0};

static?unsigned?int?i_nat_prerouting_rules_count?=?0;
static?unsigned?int?i_filter_input_rules_count=?0;

static?void?UpdateIptablesPreRulesCount(void);
static?inline?void?UpdateIptablesInputCount(void);

/*
*******************************
* fun:?
* arg:
* return:
* time:
* author:
*******************************
*/
void?IptablesDeleteRules(unsigned?char?*table?
? unsigned?char?*chain?unsigned?int?number)
{
unsigned?char?byIptablesCmd[256]?=?{0};
memset(byIptablesCmd0256);
sprintf(byIptablesCmd“%s?-t?%s?-D?%s?%d“IPTABLEStablechainnumber);
#if?DEBUG_IPTABLES
Trace(“%s\n“byIptablesCmd);
#endif
system(byIptablesCmd);
}

/*
*******************************
* fun:?
* arg:
* return:
* time:
* author:
*******************************
*/
inline?void?IptablesDeleteForwardRules(unsigned?int?number)
{
IptablesDeleteRules(“filter“?“FORWARD“?number);
}

/*
*******************************
* fun:?
* arg:
* return:
* time:
* author:
*******************************
*/
inline?void?IptablesDeletePreroutingRules(unsigned?int?number)
{
IptablesDeleteRules(“nat“?“PREROUTING“?number);
}

/*
*******************************
* fun:?
* arg:
* return:
* time:
* author:
*******************************
*/
void?IptablesDisPartNetAddr(unsigned?char?*http_addr)
{
unsigned?char?byIptablesCmd[256]?=?{0};
memset(byIptablesCmd0256);
sprintf(byIptablesCmd
“%s?-t?nat?-I?PREROUTING?-p?tcp?-i?%s?!?-d?%s?-j?DNAT?--to?%s“
IPTABLESINPUT_DEVhttp_addrhttp_addr);

#if?DEBUG_IPTABLES
Trace(“%s\n“byIptablesCmd);
#endif

system(byIptablesCmd);
UpdateIptablesPreRulesCount();
#if?DEBUG_IPTABLES
Trace(“there?are?[%d]?prerouting?rules?in?nat?tables?by?user?setup\n“
IptablesGetPreroutRulesCount());
#endif

}

/*
*******************************
* fun:?
* arg:
* return:
* time:
* author:
*******************************
*/
void?IptablesDisHttpAndJumpSprecifyNetAddr(unsigned?char?*http_addr)
{
unsigned?char?byIptablesCmd[256]?=?{0};
memset(byIptablesCmd0256);
sprintf(byIptablesCmd
“%s?-t?nat?-I?PREROUTING?-p?tcp?-i?%s?--dport?80?-j?DNAT?--to?%s“IPTABLESINPUT_DEVhttp_addr);

#if?DEBUG_IPTABLES
Trace(“%s\n“byIptablesCmd);
#endif

system(byIptablesCmd);
UpdateIptablesPreRulesCount();
#if?DEBUG_IPTABLES
Trace(“there?are?[%d]?prerouting?rules?in?nat?tables?by?user?setup\n“
IptablesGetPreroutRulesCount());
#endif

}

/*
*******************************
* fun:?
* arg:
* return:
* time:
* author:
*******************************
*/
void?IptablesAllowSprecifyNetAddr(unsigned?char?*http_addr)
{
unsigned?char

評論

共有 條評論