selfcare init

This commit is contained in:
zhangsz
2025-03-03 11:40:37 +08:00
parent 19f09dd7ea
commit aca2bace68
692 changed files with 273972 additions and 0 deletions

View File

@@ -0,0 +1,82 @@
#ifndef __SELFCARE_HTTPSRV_H__
#define __SELFCARE_HTTPSRV_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <signal.h>
#include <fcntl.h>
#include <unistd.h>
#include <dirent.h>
#include <errno.h>
#include <event2/event.h>
#include <event2/http.h>
#include <event2/buffer.h>
#include <event2/util.h>
#include <event2/keyvalq_struct.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <json.h>
#include "restapi.h"
typedef enum _SELFCARE_URL_E
{
SELFCARE_TYPE_MIN = 0,
SELFCARE_AUTHCODE, // <20>û<EFBFBD>ע<EFBFBD><D7A2><EFBFBD><EFBFBD><EFBFBD>Žӿ<C5BD>
SELFCARE_QUERY_USERDATA, // <20>û<EFBFBD><C3BB><EFBFBD>Ϣ<EFBFBD><CFA2>ѯ<EFBFBD>ӿ<EFBFBD>
SELFCARE_BUNDLE_SUBS, // <20>ײͶ<D7B2><CDB6><EFBFBD><EFBFBD>ӿ<EFBFBD>
SELFCARE_BUNDLE_USAGE, // <20>Ѷ<EFBFBD><D1B6><EFBFBD><EFBFBD>ײͲ<D7B2>ѯ
SELFCARE_RECHARGE, // <20><>ֵ<EFBFBD>ӿ<EFBFBD>
SELFCARE_TRANSFER, // ת<>˽ӿ<CBBD>
SELFCARE_RECHARGE_CARD, // <20><>ֵ<EFBFBD><D6B5><EFBFBD><EFBFBD>ֵ<EFBFBD>ӿ<EFBFBD>
SELFCARE_CHECK_BALANCE, // <20>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><D0A3><EFBFBD>ӿ<EFBFBD>
SELFCARE_QUERY_BALANCE, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD>ӿ<EFBFBD>
SELFCARE_CRM_PAYMENT, // CRM charge interface
SELFCARE_SMS_DELIVER,
SELFCARE_CREATE_ACCT,
SELFCARE_UPDATE_SUBS,
SELFCARE_DELETE_SUBS,
SELFCARE_TYPE_MAX,
}SELFCARE_URL_E;
#define SELFCARE_URL_LEN (128)
typedef struct _selfcare_elem_s
{
SELFCARE_URL_E url_type;
char url_addr[SELFCARE_URL_LEN];
void (*handle)(struct evhttp_request *req, void *arg);
}selfcare_elem_s;
int selfcare_httpsrv_init(int argc, char **argv);
void selfcare_httpsrv_uninit(void);
int selfcare_httpsrv_reg(const selfcare_elem_s *elem);
int selfcare_httpsrv_check(struct evhttp_request *req, void *arg);
int selfcare_httpsrv_send(struct evhttp_request *req, const int ret_code, char *buf);
#ifdef __cplusplus
}
#endif
#endif /* __SELFCARE_HTTPSRV_H__ */