OCT 1. 更新头文件定义
This commit is contained in:
parent
80b367a01b
commit
eb9c03c908
|
@ -39,7 +39,7 @@
|
|||
#endif
|
||||
|
||||
#ifndef SIOCGIFCONF
|
||||
#include <sys/sockio.h>
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
#ifndef _UIO_H_
|
||||
|
@ -70,19 +70,19 @@ typedef struct in_pktinfo IN_PKTINFO;
|
|||
#define IFF_DYNAMIC 0x8000
|
||||
#endif
|
||||
|
||||
#define MYWORD unsigned short
|
||||
#define MYBYTE unsigned char
|
||||
#define MYDWORD unsigned int
|
||||
#define SOCKET_ERROR -1
|
||||
#define INVALID_SOCKET -1
|
||||
#define SOCKADDR_IN sockaddr_in
|
||||
#define SOCKADDR sockaddr
|
||||
#define SOCKET int
|
||||
#define BOOL bool
|
||||
#define LPSOCKADDR sockaddr *
|
||||
#define closesocket close
|
||||
#define MYWORD unsigned short
|
||||
#define MYBYTE unsigned char
|
||||
#define MYDWORD unsigned int
|
||||
#define SOCKET_ERROR -1
|
||||
#define INVALID_SOCKET -1
|
||||
#define SOCKADDR_IN sockaddr_in
|
||||
#define SOCKADDR sockaddr
|
||||
#define SOCKET int
|
||||
#define BOOL bool
|
||||
#define LPSOCKADDR sockaddr *
|
||||
#define closesocket close
|
||||
|
||||
#define STR2INT(val) ((int)strtol((val), nullptr, 10))
|
||||
#define STR2INT(val) ((int)strtol((val), nullptr, 10))
|
||||
|
||||
#define DISCOVER_RSP_NOT_BOARDCAST (0)
|
||||
|
||||
|
@ -707,77 +707,77 @@ struct data15 {
|
|||
};
|
||||
|
||||
//Function Prototypes
|
||||
bool checkIP(data9 *req, data17 *rangeData, MYDWORD ip);
|
||||
bool checkMask(MYDWORD);
|
||||
bool checkRange(data17 *, char);
|
||||
bool detectChange();
|
||||
bool getSection(const char *, char *, MYBYTE, char *);
|
||||
bool isInt(char *);
|
||||
bool isIP(char *);
|
||||
FILE *openSection(const char *, MYBYTE);
|
||||
MYBYTE pIP(void *, MYDWORD);
|
||||
MYBYTE pUInt(void *raw, MYDWORD data);
|
||||
MYBYTE pUShort(void *, MYWORD);
|
||||
MYBYTE addServer(MYDWORD *, MYBYTE, MYDWORD);
|
||||
int getRangeInd(MYDWORD);
|
||||
char *myTrim(char *, char *);
|
||||
char *myGetToken(char *, MYBYTE);
|
||||
char *cloneString(char *);
|
||||
char *getHexValue(MYBYTE *, char *, MYBYTE *);
|
||||
char *genHostName(char *, const MYBYTE *, MYBYTE);
|
||||
char *hex2String(char *, const MYBYTE *, MYBYTE);
|
||||
char *IP2String(char *, MYDWORD);
|
||||
char *myUpper(char *string);
|
||||
char *myLower(char *string);
|
||||
char *readSection(char *, FILE *);
|
||||
data7 *findDHCPEntry(char *);
|
||||
data7 *createCache(data71 *pLump);
|
||||
MYDWORD alad(data9 *);
|
||||
MYDWORD resad(data9 *);
|
||||
MYDWORD sdmess(data9 *);
|
||||
MYDWORD sendRepl(data9 *req);
|
||||
MYDWORD *findServer(MYDWORD *, MYBYTE, MYDWORD);
|
||||
int getIndex(char, MYDWORD);
|
||||
int addDHCPRange(char *dp);
|
||||
void addVendClass(MYBYTE rangeSetInd, char *vendClass, MYBYTE vendClassSize);
|
||||
void addUserClass(MYBYTE rangeSetInd, char *userClass, MYBYTE userClassSize);
|
||||
void addMacRange(MYBYTE rangeSetInd, char *macRange);
|
||||
void addOptions(data9 *req);
|
||||
void calcRangeLimits(MYDWORD, MYDWORD, MYDWORD *, MYDWORD *);
|
||||
void closeConn();
|
||||
bool getInterfaces(data1 *pNetwork);
|
||||
void *init(void *);
|
||||
void lockOptions(FILE *);
|
||||
void loadOptions(FILE *, const char *, data20 *);
|
||||
void mySplit(char *, char *, const char *, char);
|
||||
void *sendHTTP(void *);
|
||||
void procHTTP(data19 *);
|
||||
void pvdata(data9 *, data3 *);
|
||||
void recvRepl(data9 *);
|
||||
void lockIP(MYDWORD);
|
||||
void sendStatus(data19 *req);
|
||||
void setTempLease(data7 *);
|
||||
void setLeaseExpiry(data7 *);
|
||||
void setLeaseExpiry(data7 *, MYDWORD);
|
||||
void *updateStateFile(void *);
|
||||
MYWORD fUShort(void *);
|
||||
MYWORD gdmess(data9 *, MYBYTE);
|
||||
MYWORD myTokenize(char *, char *, const char *, bool);
|
||||
MYDWORD fIP(void *raw);
|
||||
MYDWORD fUInt(void *raw);
|
||||
int prepareUserHtmlRespStatus(const char **pRsp);
|
||||
bool checkIP(data9 *req, data17 *rangeData, MYDWORD ip);
|
||||
bool checkMask(MYDWORD);
|
||||
bool checkRange(data17 *, char);
|
||||
bool detectChange();
|
||||
bool getSection(const char *, char *, MYBYTE, char *);
|
||||
bool isInt(char *);
|
||||
bool isIP(char *);
|
||||
FILE *openSection(const char *, MYBYTE);
|
||||
MYBYTE pIP(void *, MYDWORD);
|
||||
MYBYTE pUInt(void *raw, MYDWORD data);
|
||||
MYBYTE pUShort(void *, MYWORD);
|
||||
MYBYTE addServer(MYDWORD *, MYBYTE, MYDWORD);
|
||||
int getRangeInd(MYDWORD);
|
||||
char *myTrim(char *, char *);
|
||||
char *myGetToken(char *, MYBYTE);
|
||||
char *cloneString(char *);
|
||||
char *getHexValue(MYBYTE *, char *, MYBYTE *);
|
||||
char *genHostName(char *, const MYBYTE *, MYBYTE);
|
||||
char *hex2String(char *, const MYBYTE *, MYBYTE);
|
||||
char *IP2String(char *, MYDWORD);
|
||||
char *myUpper(char *string);
|
||||
char *myLower(char *string);
|
||||
char *readSection(char *, FILE *);
|
||||
data7 *findDHCPEntry(char *);
|
||||
data7 *createCache(data71 *pLump);
|
||||
MYDWORD alad(data9 *);
|
||||
MYDWORD resad(data9 *);
|
||||
MYDWORD sdmess(data9 *);
|
||||
MYDWORD sendRepl(data9 *req);
|
||||
MYDWORD *findServer(MYDWORD *, MYBYTE, MYDWORD);
|
||||
int getIndex(char, MYDWORD);
|
||||
int addDHCPRange(char *dp);
|
||||
void addVendClass(MYBYTE rangeSetInd, char *vendClass, MYBYTE vendClassSize);
|
||||
void addUserClass(MYBYTE rangeSetInd, char *userClass, MYBYTE userClassSize);
|
||||
void addMacRange(MYBYTE rangeSetInd, char *macRange);
|
||||
void addOptions(data9 *req);
|
||||
void calcRangeLimits(MYDWORD, MYDWORD, MYDWORD *, MYDWORD *);
|
||||
void closeConn();
|
||||
bool getInterfaces(data1 *pNetwork);
|
||||
void *init(void *);
|
||||
void lockOptions(FILE *);
|
||||
void loadOptions(FILE *, const char *, data20 *);
|
||||
void mySplit(char *, char *, const char *, char);
|
||||
void *sendHTTP(void *);
|
||||
void procHTTP(data19 *);
|
||||
void pvdata(data9 *, data3 *);
|
||||
void recvRepl(data9 *);
|
||||
void lockIP(MYDWORD);
|
||||
void sendStatus(data19 *req);
|
||||
void setTempLease(data7 *);
|
||||
void setLeaseExpiry(data7 *);
|
||||
void setLeaseExpiry(data7 *, MYDWORD);
|
||||
void *updateStateFile(void *);
|
||||
MYWORD fUShort(void *);
|
||||
MYWORD gdmess(data9 *, MYBYTE);
|
||||
MYWORD myTokenize(char *, char *, const char *, bool);
|
||||
MYDWORD fIP(void *raw);
|
||||
MYDWORD fUInt(void *raw);
|
||||
int prepareUserHtmlRespStatus(const char **pRsp);
|
||||
#ifdef HTTPSERVER_ON
|
||||
void opendhcp_init_http_server();
|
||||
void opendhcp_init_http_server();
|
||||
#endif
|
||||
void opendhcp_set_replication_svr();
|
||||
void opendhcp_add_ip_pool_set();
|
||||
void opendhcp_add_mac_filter();
|
||||
int process_iptv_multicast(const unsigned char *p, int size, const char *mac);
|
||||
int opendhcp_add_listener();
|
||||
unsigned int opendhcp_set_lease_time();
|
||||
int getHwAddr(char *buff, char *mac);
|
||||
int arpSet(const char *ifname, char *ipStr, char *mac);
|
||||
void opendhcp_set_replication_svr();
|
||||
void opendhcp_add_ip_pool_set();
|
||||
void opendhcp_add_mac_filter();
|
||||
int process_iptv_multicast(const unsigned char *p, int size, const char *mac);
|
||||
int opendhcp_add_listener();
|
||||
unsigned int opendhcp_set_lease_time();
|
||||
int getHwAddr(char *buff, char *mac);
|
||||
int arpSet(const char *ifname, char *ipStr, char *mac);
|
||||
#if DISCOVER_RSP_NOT_BOARDCAST
|
||||
sockaddr_in get_cliAddr(char *nicif, char *tempbuff, data9 *req);
|
||||
sockaddr_in get_cliAddr(char *nicif, char *tempbuff, data9 *req);
|
||||
#endif
|
||||
#pragma clang diagnostic pop
|
|
@ -5,18 +5,14 @@
|
|||
#include <map>
|
||||
using namespace std;
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <net/if.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <unistd.h>
|
||||
#include <memory.h>
|
||||
#include <cstdlib>
|
||||
#include "opendhcpd.h"
|
||||
#include "s2j/cJSON.h"
|
||||
#include "misc.h"
|
||||
#include <net/if_arp.h>
|
||||
#include <uv.h>
|
||||
#include "config.h"
|
||||
#include "proto.h"
|
||||
|
@ -27,6 +23,12 @@ using namespace std;
|
|||
#include "http_svr.h"
|
||||
#include "task_manager.h"
|
||||
|
||||
#if DISCOVER_RSP_NOT_BOARDCAST
|
||||
#include <sys/socket.h>
|
||||
#include <unistd.h>
|
||||
#include <net/if_arp.h>
|
||||
#endif
|
||||
|
||||
extern data2 cfig;
|
||||
extern bool kRunning;
|
||||
extern dhcpMap dhcpCache;
|
||||
|
@ -45,11 +47,12 @@ static PIPTV_DEV_SET g_iptvCacheDevs = nullptr;
|
|||
static uv_rwlock_t g_uvCacheLock;
|
||||
|
||||
#ifdef JSON_SCHEMA_ON
|
||||
// clang-format off
|
||||
const char *g_json_msg[] = {
|
||||
"{\"type\":\"object\",\"required\":[\"rangeSet\"],\"properties\":{\"rangeSet\":{\"type\":\"array\",\"minItems\":1,\"items\":{\"type\":\"object\",\"required\":[\"dhcpRange\"]}}}}",
|
||||
"{\"type\":\"object\",\"required\":[\"dhcpRange\"],\"properties\":{\"dhcpRange\":{\"type\":\"array\",\"minItems\":1}}}",
|
||||
"{\"type\":\"object\",\"required\":[\"userMac\"],\"properties\":{\"userMac\":{\"type\":\"array\",\"minItems\":1}}}"
|
||||
};
|
||||
R"({"type":"object","required":["rangeSet"],"properties":{"rangeSet":{"type":"array","minItems":1,"items":{"type":"object","required":["dhcpRange"]}}}})",
|
||||
R"({"type":"object","required":["dhcpRange"],"properties":{"dhcpRange":{"type":"array","minItems":1}}})",
|
||||
R"({"type":"object","required":["userMac"],"properties":{"userMac":{"type":"array","minItems":1}}})"};
|
||||
// clang-format on
|
||||
#endif
|
||||
|
||||
static int dhcp_get_user_info(const char **pRsp, const char *pRequest) {
|
||||
|
@ -977,8 +980,8 @@ static HTTP_ROUTE_INFO g_routeTable[] = {
|
|||
};
|
||||
|
||||
void opendhcp_init_http_server() {
|
||||
static int added = FALSE;
|
||||
static uv_timer_t uvTm;
|
||||
static int added = FALSE;
|
||||
static uv_timer_t uvTm;
|
||||
if (!added) {
|
||||
uv_rwlock_init(&g_uvCacheLock);
|
||||
uv_timer_init(get_task_manager(), &uvTm);
|
||||
|
|
Loading…
Reference in New Issue