Merge branch 'master' of http://git.komect.net/ISG/secogateway
This commit is contained in:
commit
4d828bef69
|
@ -0,0 +1,20 @@
|
|||
#ifndef _COMMON_TYPES_H
|
||||
#define _COMMON_TYPES_H
|
||||
|
||||
#ifndef u8
|
||||
typedef unsigned char u8;
|
||||
#endif
|
||||
|
||||
#ifndef u16
|
||||
typedef unsigned short u16;
|
||||
#endif
|
||||
|
||||
#ifndef u32
|
||||
typedef unsigned int u32;
|
||||
#endif
|
||||
|
||||
#ifndef u32
|
||||
typedef unsigned long long u64;
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -4,19 +4,7 @@
|
|||
#include <linux/in.h>
|
||||
#include <linux/in6.h>
|
||||
|
||||
|
||||
#ifndef u8
|
||||
typedef unsigned char u8;
|
||||
#endif
|
||||
|
||||
#ifndef u16
|
||||
typedef unsigned short u16;
|
||||
#endif
|
||||
|
||||
#ifndef u32
|
||||
typedef unsigned int u32;
|
||||
#endif
|
||||
|
||||
#include "common_types.h"
|
||||
|
||||
typedef enum {
|
||||
TRACE_SUCCESS = 0,
|
||||
|
|
13
Makefile
13
Makefile
|
@ -28,9 +28,9 @@ MAKE_FLAGS += -j$(shell cat /proc/cpuinfo | grep processor | wc -l)
|
|||
endif
|
||||
endif
|
||||
|
||||
.PHONY : demo conntrack netlink trace openrpc usermanager configm redismq database
|
||||
.PHONY : demo conntrack netlink trace openrpc usermanager configm redismq ulog database
|
||||
|
||||
all: demo conntrack netlink trace openrpc usermanager configm redismq database
|
||||
all: demo conntrack netlink trace openrpc usermanager configm redismq ulog database
|
||||
|
||||
ifeq ($(OPT), install)
|
||||
#$(shell `find ../release -name "*.zip" -delete`)
|
||||
|
@ -160,6 +160,15 @@ else
|
|||
$(MLOG)make all $(MAKE_FLAGS) -C Platform/build -f user.redismq.Makefile MLOG=$(MLOG) DISABLE_WARRING=$(DIS_BUILD_WARRING) MAKE_TARGET=redismq
|
||||
endif
|
||||
|
||||
ulog:
|
||||
ifeq ($(OPT), clean)
|
||||
$(MLOG)make $(MAKE_FLAGS) -C Platform/build -f user.ulog.syslog_sched.Makefile cleanall MLOG=$(MLOG) MAKE_TARGET=syslog-sched
|
||||
else ifeq ($(OPT), install)
|
||||
$(MLOG)make $(MAKE_FLAGS) -C Platform/build -f user.ulog.syslog_sched.Makefile install DIR=$(DIR) MLOG=$(MLOG) MAKE_TARGET=syslog-sched
|
||||
else
|
||||
$(MLOG)make all $(MAKE_FLAGS) -C Platform/build -f user.ulog.syslog_sched.Makefile MLOG=$(MLOG) DISABLE_WARRING=$(DIS_BUILD_WARRING) MAKE_TARGET=syslog-sched
|
||||
endif
|
||||
|
||||
database:
|
||||
ifeq ($(OPT), clean)
|
||||
$(MLOG)make $(MAKE_FLAGS) -C Platform/build -f user.database.Makefile cleanall MLOG=$(MLOG) MAKE_TARGET=database
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
# target name, the target name must have the same name of c source file
|
||||
TARGET_NAME=syslog-sched
|
||||
|
||||
# target
|
||||
# for linux module driver: KO
|
||||
# for application: EXE
|
||||
# for dynamic library: DLL
|
||||
TARGET_TYPE = EXE
|
||||
|
||||
# target object
|
||||
# for application: APP
|
||||
# for device driver: DRV
|
||||
TARGET_OBJ = APP
|
||||
|
||||
# custom install dir
|
||||
TARGET_BOX =
|
||||
|
||||
#debug mode or release mode
|
||||
DEBUG = TRUE
|
||||
|
||||
PLAT_LINUX ?= TRUE
|
||||
PLAT_ARM64 ?= TRUE
|
||||
|
||||
VPATH = ../user/ulog/syslog-schedule
|
||||
|
||||
# source code
|
||||
|
||||
# set the source file, don't used .o because of ...
|
||||
|
||||
COMMON_SRCS = log_file.c log_sched.c
|
||||
|
||||
# MRS Board Source Files
|
||||
PLAT_LINUX_SRCS = $(COMMON_SRCS)
|
||||
PLAT_ARM64_SRCS = $(COMMON_SRCS)
|
||||
|
||||
# gcc CFLAGS
|
||||
PLAT_ARM64_CFLAGS := -fPIC -I../../Common -I../common/rpc
|
||||
PLAT_LINUX_CFLAGS := $(PLAT_ARM64_CFLAGS)
|
||||
|
||||
|
||||
PLAT_ARM64_LDFLAGS := -lpthread
|
||||
PLAT_LINUX_LDFLAGS := $(PLAT_ARM64_LDFLAGS)
|
||||
|
||||
#gcc libs
|
||||
ARM64_LIBS := ./libopenrpc-arm64.so ../thirdparty/arm64/libev-arm64.so
|
||||
LINUX_LIBS := ./libopenrpc-linux.so ../thirdparty/x86_64/libev-linux.so
|
||||
|
||||
ifeq ($(PLAT_ARM64), TRUE)
|
||||
DEPEND_LIB += ./debug/libopenrpc-arm64.so
|
||||
USER_CLEAN_ITEMS += ./libopenrpc-arm64.so
|
||||
endif
|
||||
|
||||
ifeq ($(PLAT_LINUX), TRUE)
|
||||
DEPEND_LIB += ./debug/libopenrpc-linux.so
|
||||
USER_CLEAN_ITEMS += ./libopenrpc-linux.so
|
||||
endif
|
||||
|
||||
# this line must be at below of thus, because of...
|
||||
include ../../Common/common.Makefile
|
||||
|
||||
ifneq ($(MAKECMDGOALS), clean)
|
||||
ifneq ($(MAKECMDGOALS), cleanall)
|
||||
ifneq ($(notdir $(DEPEND_LIB)), $(wildcard $(DEPEND_LIB)))
|
||||
$(shell $(CP) $(DEPEND_LIB) ./)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(MAKECMDGOALS), )
|
||||
$(shell find ./ -name "$(TARGET)-*.ko" -delete)
|
||||
else
|
||||
ifeq ($(MAKECMDGOALS), all)
|
||||
$(shell find ./ -name "$(TARGET)-*.ko" -delete)
|
||||
endif
|
||||
endif
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
#include "log_file.h"
|
||||
|
||||
int conf_log_file(rpc_conn *conn, pointer input, int input_len, pointer data)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
#ifndef __LOG_H
|
||||
#define __LOG_H
|
||||
|
||||
#include <linux/limits.h>
|
||||
#include "common_types.h"
|
||||
#include "rpc_common.h"
|
||||
|
||||
|
||||
typedef struct _log_file {
|
||||
u8 level;
|
||||
char path[PATH_MAX];
|
||||
u32 compress_over_days;
|
||||
u32 del_over_days;
|
||||
u64 compress_over_size;
|
||||
u64 del_over_size;
|
||||
} log_file_t;
|
||||
|
||||
int conf_log_file(rpc_conn *conn, pointer input, int input_len, pointer data);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,41 @@
|
|||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "log_file.h"
|
||||
|
||||
#define SYSLOG_SCHED_RPC_NAME "syslog_schedule_rpc"
|
||||
|
||||
#define SERVICE_LOG_FILE_NAME "log_file"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int run_daemon = 0;
|
||||
char *options = "d";
|
||||
int opt;
|
||||
|
||||
while ((opt = getopt(argc, argv, options)) != -1) {
|
||||
switch (opt) {
|
||||
case 'd':
|
||||
run_daemon = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (run_daemon) {
|
||||
if (daemon(0, 0) == -1) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
rpc_server *server = rpc_server_create_ex(SYSLOG_SCHED_RPC_NAME);
|
||||
if (server = NULL)
|
||||
{
|
||||
printf("start server error\n");
|
||||
return 1;
|
||||
|
||||
}
|
||||
printf("Server of log schedule is started\n");
|
||||
|
||||
/* 注册配置处理函数 */
|
||||
rpc_server_regservice(server, SERVICE_LOG_FILE_NAME, "conf_log_file", conf_log_file);
|
||||
}
|
Loading…
Reference in New Issue