2019-08-08 19:01:45 +08:00
|
|
|
|
/*
|
2020-04-04 20:30:09 +08:00
|
|
|
|
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved.
|
2019-06-24 14:50:50 +08:00
|
|
|
|
*
|
2021-01-17 18:31:50 +08:00
|
|
|
|
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit).
|
2019-06-24 14:50:50 +08:00
|
|
|
|
*
|
2020-04-04 20:30:09 +08:00
|
|
|
|
* Use of this source code is governed by MIT license that can be found in the
|
|
|
|
|
* LICENSE file in the root of the source tree. All contributing project authors
|
|
|
|
|
* may be found in the AUTHORS file in the root of the source tree.
|
2019-06-24 14:50:50 +08:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef ZLMEDIAKIT_WEBHOOK_H
|
|
|
|
|
#define ZLMEDIAKIT_WEBHOOK_H
|
|
|
|
|
|
|
|
|
|
#include <string>
|
2020-12-27 22:14:59 +08:00
|
|
|
|
#include <functional>
|
2022-10-16 21:10:18 +08:00
|
|
|
|
#include "json/json.h"
|
2020-12-27 22:14:59 +08:00
|
|
|
|
|
|
|
|
|
//支持json或urlencoded方式传输参数
|
|
|
|
|
#define JSON_ARGS
|
|
|
|
|
|
|
|
|
|
#ifdef JSON_ARGS
|
2022-02-02 20:34:50 +08:00
|
|
|
|
typedef Json::Value ArgsType;
|
2020-12-27 22:14:59 +08:00
|
|
|
|
#else
|
2022-02-02 20:34:50 +08:00
|
|
|
|
typedef mediakit::HttpArgs ArgsType;
|
2020-12-27 22:14:59 +08:00
|
|
|
|
#endif
|
2019-06-24 14:50:50 +08:00
|
|
|
|
|
|
|
|
|
namespace Hook {
|
2020-12-27 22:14:59 +08:00
|
|
|
|
//web hook回复最大超时时间
|
2022-02-02 20:34:50 +08:00
|
|
|
|
extern const std::string kTimeoutSec;
|
2019-06-24 14:50:50 +08:00
|
|
|
|
}//namespace Hook
|
|
|
|
|
|
2019-06-24 14:58:56 +08:00
|
|
|
|
void installWebHook();
|
|
|
|
|
void unInstallWebHook();
|
2023-06-28 11:36:41 +08:00
|
|
|
|
void onProcessExited();
|
2020-12-27 22:14:59 +08:00
|
|
|
|
/**
|
|
|
|
|
* 触发http hook请求
|
|
|
|
|
* @param url 请求地址
|
|
|
|
|
* @param body 请求body
|
|
|
|
|
* @param func 回调
|
|
|
|
|
*/
|
2022-02-02 20:34:50 +08:00
|
|
|
|
void do_http_hook(const std::string &url, const ArgsType &body, const std::function<void(const Json::Value &, const std::string &)> &func = nullptr);
|
2019-06-24 14:50:50 +08:00
|
|
|
|
#endif //ZLMEDIAKIT_WEBHOOK_H
|