83 lines
1.9 KiB
C
83 lines
1.9 KiB
C
#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, // 用户注册短信接口
|
|
SELFCARE_QUERY_USERDATA, // 用户信息查询接口
|
|
SELFCARE_BUNDLE_SUBS, // 套餐订购接口
|
|
SELFCARE_BUNDLE_USAGE, // 已订购套餐查询
|
|
SELFCARE_RECHARGE, // 充值接口
|
|
SELFCARE_TRANSFER, // 转账接口
|
|
SELFCARE_RECHARGE_CARD, // 充值卡充值接口
|
|
SELFCARE_CHECK_BALANCE, // 用户余额校验接口
|
|
SELFCARE_QUERY_BALANCE, // 余额查询接口
|
|
|
|
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__ */
|