mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
for #354, remove the double underscore of macro.
This commit is contained in:
parent
014993ad1e
commit
c6817cc422
18 changed files with 493 additions and 493 deletions
|
@ -52,14 +52,14 @@ using namespace _srs_internal;
|
|||
#define SRS_WIKI_URL_LOG "https://github.com/winlinvip/simple-rtmp-server/wiki/v1_CN_SrsLog"
|
||||
|
||||
// '\n'
|
||||
#define __LF (char)0x0a
|
||||
#define SRS_LF (char)0x0a
|
||||
|
||||
// '\r'
|
||||
#define __CR (char)0x0d
|
||||
#define SRS_CR (char)0x0d
|
||||
|
||||
bool is_common_space(char ch)
|
||||
{
|
||||
return (ch == ' ' || ch == '\t' || ch == __CR || ch == __LF);
|
||||
return (ch == ' ' || ch == '\t' || ch == SRS_CR || ch == SRS_LF);
|
||||
}
|
||||
|
||||
SrsConfDirective::SrsConfDirective()
|
||||
|
@ -242,7 +242,7 @@ int SrsConfDirective::read_token(SrsConfigBuffer* buffer, vector<string>& args,
|
|||
|
||||
char ch = *buffer->pos++;
|
||||
|
||||
if (ch == __LF) {
|
||||
if (ch == SRS_LF) {
|
||||
buffer->line++;
|
||||
sharp_comment = false;
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ using namespace std;
|
|||
#include <srs_app_json.hpp>
|
||||
|
||||
// update the flv duration and filesize every this interval in ms.
|
||||
#define __SRS_DVR_UPDATE_DURATION_INTERVAL 60000
|
||||
#define SRS_DVR_UPDATE_DURATION_INTERVAL 60000
|
||||
|
||||
// the sleep interval for http async callback.
|
||||
#define SRS_AUTO_ASYNC_CALLBACL_SLEEP_US 300000
|
||||
|
@ -920,7 +920,7 @@ int SrsDvrAppendPlan::update_duration(SrsSharedPtrMessage* msg)
|
|||
return ret;
|
||||
}
|
||||
|
||||
if (__SRS_DVR_UPDATE_DURATION_INTERVAL > msg->timestamp - last_update_time) {
|
||||
if (SRS_DVR_UPDATE_DURATION_INTERVAL > msg->timestamp - last_update_time) {
|
||||
return ret;
|
||||
}
|
||||
last_update_time = msg->timestamp;
|
||||
|
|
|
@ -66,14 +66,14 @@ void SrsHttpHeartbeat::heartbeat()
|
|||
}
|
||||
|
||||
std::stringstream ss;
|
||||
ss << __SRS_JOBJECT_START
|
||||
<< __SRS_JFIELD_STR("device_id", device_id) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("ip", ip);
|
||||
ss << SRS_JOBJECT_START
|
||||
<< SRS_JFIELD_STR("device_id", device_id) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("ip", ip);
|
||||
if (_srs_config->get_heartbeat_summaries()) {
|
||||
ss << __SRS_JFIELD_CONT << __SRS_JFIELD_ORG("summaries", "");
|
||||
ss << SRS_JFIELD_CONT << SRS_JFIELD_ORG("summaries", "");
|
||||
srs_api_dump_summaries(ss);
|
||||
}
|
||||
ss << __SRS_JOBJECT_END;
|
||||
ss << SRS_JOBJECT_END;
|
||||
|
||||
std::string req = ss.str();
|
||||
|
||||
|
|
|
@ -217,7 +217,7 @@ void SrsHttpHeader::write(stringstream& ss)
|
|||
{
|
||||
std::map<std::string, std::string>::iterator it;
|
||||
for (it = headers.begin(); it != headers.end(); ++it) {
|
||||
ss << it->first << ": " << it->second << __SRS_HTTP_CRLF;
|
||||
ss << it->first << ": " << it->second << SRS_HTTP_CRLF;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -472,7 +472,7 @@ int SrsHttpFileServer::copy(ISrsHttpResponseWriter* w, SrsFileReader* fs, SrsHtt
|
|||
|
||||
while (left > 0) {
|
||||
ssize_t nread = -1;
|
||||
int max_read = srs_min(left, __SRS_HTTP_TS_SEND_BUFFER_SIZE);
|
||||
int max_read = srs_min(left, SRS_HTTP_TS_SEND_BUFFER_SIZE);
|
||||
if ((ret = fs->read(buf, max_read, &nread)) != ERROR_SUCCESS) {
|
||||
break;
|
||||
}
|
||||
|
@ -764,7 +764,7 @@ int SrsHttpResponseWriter::final_request()
|
|||
// complete the chunked encoding.
|
||||
if (content_length == -1) {
|
||||
std::stringstream ss;
|
||||
ss << 0 << __SRS_HTTP_CRLF << __SRS_HTTP_CRLF;
|
||||
ss << 0 << SRS_HTTP_CRLF << SRS_HTTP_CRLF;
|
||||
std::string ch = ss.str();
|
||||
return skt->write((void*)ch.data(), (int)ch.length(), NULL);
|
||||
}
|
||||
|
@ -810,7 +810,7 @@ int SrsHttpResponseWriter::write(char* data, int size)
|
|||
|
||||
// send in chunked encoding.
|
||||
std::stringstream ss;
|
||||
ss << hex << size << __SRS_HTTP_CRLF;
|
||||
ss << hex << size << SRS_HTTP_CRLF;
|
||||
std::string ch = ss.str();
|
||||
if ((ret = skt->write((void*)ch.data(), (int)ch.length(), NULL)) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
|
@ -818,7 +818,7 @@ int SrsHttpResponseWriter::write(char* data, int size)
|
|||
if ((ret = skt->write((void*)data, size, NULL)) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
if ((ret = skt->write((void*)__SRS_HTTP_CRLF, 2, NULL)) != ERROR_SUCCESS) {
|
||||
if ((ret = skt->write((void*)SRS_HTTP_CRLF, 2, NULL)) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -852,7 +852,7 @@ int SrsHttpResponseWriter::send_header(char* data, int size)
|
|||
|
||||
// status_line
|
||||
ss << "HTTP/1.1 " << status << " "
|
||||
<< srs_generate_http_status_text(status) << __SRS_HTTP_CRLF;
|
||||
<< srs_generate_http_status_text(status) << SRS_HTTP_CRLF;
|
||||
|
||||
// detect content type
|
||||
if (srs_go_http_body_allowd(status)) {
|
||||
|
@ -878,7 +878,7 @@ int SrsHttpResponseWriter::send_header(char* data, int size)
|
|||
hdr->write(ss);
|
||||
|
||||
// header_eof
|
||||
ss << __SRS_HTTP_CRLF;
|
||||
ss << SRS_HTTP_CRLF;
|
||||
|
||||
std::string buf = ss.str();
|
||||
return skt->write((void*)buf.c_str(), buf.length(), NULL);
|
||||
|
@ -947,7 +947,7 @@ int SrsHttpResponseReader::read_chunked(std::string& data)
|
|||
char* start = buffer->bytes();
|
||||
char* end = start + buffer->size();
|
||||
for (char* p = start; p < end - 1; p++) {
|
||||
if (p[0] == __SRS_HTTP_CR && p[1] == __SRS_HTTP_LF) {
|
||||
if (p[0] == SRS_HTTP_CR && p[1] == SRS_HTTP_LF) {
|
||||
// invalid chunk, ignore.
|
||||
if (p == start) {
|
||||
ret = ERROR_HTTP_INVALID_CHUNK_HEADER;
|
||||
|
@ -1044,7 +1044,7 @@ SrsHttpMessage::SrsHttpMessage(SrsStSocket* io)
|
|||
chunked = false;
|
||||
_uri = new SrsHttpUri();
|
||||
_body = new SrsHttpResponseReader(this, io);
|
||||
_http_ts_send_buffer = new char[__SRS_HTTP_TS_SEND_BUFFER_SIZE];
|
||||
_http_ts_send_buffer = new char[SRS_HTTP_TS_SEND_BUFFER_SIZE];
|
||||
}
|
||||
|
||||
SrsHttpMessage::~SrsHttpMessage()
|
||||
|
|
|
@ -53,9 +53,9 @@ class SrsFastBuffer;
|
|||
|
||||
// http specification
|
||||
// CR = <US-ASCII CR, carriage return (13)>
|
||||
#define __SRS_HTTP_CR SRS_CONSTS_CR // 0x0D
|
||||
#define SRS_HTTP_CR SRS_CONSTS_CR // 0x0D
|
||||
// LF = <US-ASCII LF, linefeed (10)>
|
||||
#define __SRS_HTTP_LF SRS_CONSTS_LF // 0x0A
|
||||
#define SRS_HTTP_LF SRS_CONSTS_LF // 0x0A
|
||||
// SP = <US-ASCII SP, space (32)>
|
||||
#define __SRS_HTTP_SP ' ' // 0x20
|
||||
// HT = <US-ASCII HT, horizontal-tab (9)>
|
||||
|
@ -64,11 +64,11 @@ class SrsFastBuffer;
|
|||
// HTTP/1.1 defines the sequence CR LF as the end-of-line marker for all
|
||||
// protocol elements except the entity-body (see appendix 19.3 for
|
||||
// tolerant applications).
|
||||
#define __SRS_HTTP_CRLF "\r\n" // 0x0D0A
|
||||
#define __SRS_HTTP_CRLFCRLF "\r\n\r\n" // 0x0D0A0D0A
|
||||
#define SRS_HTTP_CRLF "\r\n" // 0x0D0A
|
||||
#define SRS_HTTP_CRLFCRLF "\r\n\r\n" // 0x0D0A0D0A
|
||||
|
||||
// @see SrsHttpMessage._http_ts_send_buffer
|
||||
#define __SRS_HTTP_TS_SEND_BUFFER_SIZE 4096
|
||||
#define SRS_HTTP_TS_SEND_BUFFER_SIZE 4096
|
||||
|
||||
// helper function: response in json format.
|
||||
extern int srs_go_http_response_json(ISrsHttpResponseWriter* w, std::string data);
|
||||
|
|
|
@ -52,12 +52,12 @@ int SrsGoApiRoot::serve_http(ISrsHttpResponseWriter* w, SrsHttpMessage* r)
|
|||
{
|
||||
std::stringstream ss;
|
||||
|
||||
ss << __SRS_JOBJECT_START
|
||||
<< __SRS_JFIELD_ERROR(ERROR_SUCCESS) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("urls", __SRS_JOBJECT_START)
|
||||
<< __SRS_JFIELD_STR("api", "the api root")
|
||||
<< __SRS_JOBJECT_END
|
||||
<< __SRS_JOBJECT_END;
|
||||
ss << SRS_JOBJECT_START
|
||||
<< SRS_JFIELD_ERROR(ERROR_SUCCESS) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("urls", SRS_JOBJECT_START)
|
||||
<< SRS_JFIELD_STR("api", "the api root")
|
||||
<< SRS_JOBJECT_END
|
||||
<< SRS_JOBJECT_END;
|
||||
|
||||
return srs_go_http_response_json(w, ss.str());
|
||||
}
|
||||
|
@ -74,12 +74,12 @@ int SrsGoApiApi::serve_http(ISrsHttpResponseWriter* w, SrsHttpMessage* r)
|
|||
{
|
||||
std::stringstream ss;
|
||||
|
||||
ss << __SRS_JOBJECT_START
|
||||
<< __SRS_JFIELD_ERROR(ERROR_SUCCESS) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("urls", __SRS_JOBJECT_START)
|
||||
<< __SRS_JFIELD_STR("v1", "the api version 1.0")
|
||||
<< __SRS_JOBJECT_END
|
||||
<< __SRS_JOBJECT_END;
|
||||
ss << SRS_JOBJECT_START
|
||||
<< SRS_JFIELD_ERROR(ERROR_SUCCESS) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("urls", SRS_JOBJECT_START)
|
||||
<< SRS_JFIELD_STR("v1", "the api version 1.0")
|
||||
<< SRS_JOBJECT_END
|
||||
<< SRS_JOBJECT_END;
|
||||
|
||||
return srs_go_http_response_json(w, ss.str());
|
||||
}
|
||||
|
@ -96,21 +96,21 @@ int SrsGoApiV1::serve_http(ISrsHttpResponseWriter* w, SrsHttpMessage* r)
|
|||
{
|
||||
std::stringstream ss;
|
||||
|
||||
ss << __SRS_JOBJECT_START
|
||||
<< __SRS_JFIELD_ERROR(ERROR_SUCCESS) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("urls", __SRS_JOBJECT_START)
|
||||
<< __SRS_JFIELD_STR("versions", "the version of SRS") << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("summaries", "the summary(pid, argv, pwd, cpu, mem) of SRS") << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("rusages", "the rusage of SRS") << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("self_proc_stats", "the self process stats") << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("system_proc_stats", "the system process stats") << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("meminfos", "the meminfo of system") << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("authors", "the primary authors and contributors") << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("requests", "the request itself, for http debug") << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("vhosts", "dumps vhost to json") << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("streams", "dumps streams to json")
|
||||
<< __SRS_JOBJECT_END
|
||||
<< __SRS_JOBJECT_END;
|
||||
ss << SRS_JOBJECT_START
|
||||
<< SRS_JFIELD_ERROR(ERROR_SUCCESS) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("urls", SRS_JOBJECT_START)
|
||||
<< SRS_JFIELD_STR("versions", "the version of SRS") << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("summaries", "the summary(pid, argv, pwd, cpu, mem) of SRS") << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("rusages", "the rusage of SRS") << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("self_proc_stats", "the self process stats") << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("system_proc_stats", "the system process stats") << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("meminfos", "the meminfo of system") << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("authors", "the primary authors and contributors") << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("requests", "the request itself, for http debug") << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("vhosts", "dumps vhost to json") << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("streams", "dumps streams to json")
|
||||
<< SRS_JOBJECT_END
|
||||
<< SRS_JOBJECT_END;
|
||||
|
||||
return srs_go_http_response_json(w, ss.str());
|
||||
}
|
||||
|
@ -127,15 +127,15 @@ int SrsGoApiVersion::serve_http(ISrsHttpResponseWriter* w, SrsHttpMessage* r)
|
|||
{
|
||||
std::stringstream ss;
|
||||
|
||||
ss << __SRS_JOBJECT_START
|
||||
<< __SRS_JFIELD_ERROR(ERROR_SUCCESS) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("data", __SRS_JOBJECT_START)
|
||||
<< __SRS_JFIELD_ORG("major", VERSION_MAJOR) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("minor", VERSION_MINOR) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("revision", VERSION_REVISION) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("version", RTMP_SIG_SRS_VERSION)
|
||||
<< __SRS_JOBJECT_END
|
||||
<< __SRS_JOBJECT_END;
|
||||
ss << SRS_JOBJECT_START
|
||||
<< SRS_JFIELD_ERROR(ERROR_SUCCESS) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("data", SRS_JOBJECT_START)
|
||||
<< SRS_JFIELD_ORG("major", VERSION_MAJOR) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("minor", VERSION_MINOR) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("revision", VERSION_REVISION) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("version", RTMP_SIG_SRS_VERSION)
|
||||
<< SRS_JOBJECT_END
|
||||
<< SRS_JOBJECT_END;
|
||||
|
||||
return srs_go_http_response_json(w, ss.str());
|
||||
}
|
||||
|
@ -169,29 +169,29 @@ int SrsGoApiRusages::serve_http(ISrsHttpResponseWriter* w, SrsHttpMessage* req)
|
|||
|
||||
SrsRusage* r = srs_get_system_rusage();
|
||||
|
||||
ss << __SRS_JOBJECT_START
|
||||
<< __SRS_JFIELD_ERROR(ERROR_SUCCESS) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("data", __SRS_JOBJECT_START)
|
||||
<< __SRS_JFIELD_ORG("ok", (r->ok? "true":"false")) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("sample_time", r->sample_time) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("ru_utime", r->r.ru_utime.tv_sec) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("ru_stime", r->r.ru_stime.tv_sec) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("ru_maxrss", r->r.ru_maxrss) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("ru_ixrss", r->r.ru_ixrss) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("ru_idrss", r->r.ru_idrss) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("ru_isrss", r->r.ru_isrss) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("ru_minflt", r->r.ru_minflt) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("ru_majflt", r->r.ru_majflt) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("ru_nswap", r->r.ru_nswap) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("ru_inblock", r->r.ru_inblock) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("ru_oublock", r->r.ru_oublock) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("ru_msgsnd", r->r.ru_msgsnd) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("ru_msgrcv", r->r.ru_msgrcv) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("ru_nsignals", r->r.ru_nsignals) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("ru_nvcsw", r->r.ru_nvcsw) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("ru_nivcsw", r->r.ru_nivcsw)
|
||||
<< __SRS_JOBJECT_END
|
||||
<< __SRS_JOBJECT_END;
|
||||
ss << SRS_JOBJECT_START
|
||||
<< SRS_JFIELD_ERROR(ERROR_SUCCESS) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("data", SRS_JOBJECT_START)
|
||||
<< SRS_JFIELD_ORG("ok", (r->ok? "true":"false")) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("sample_time", r->sample_time) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("ru_utime", r->r.ru_utime.tv_sec) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("ru_stime", r->r.ru_stime.tv_sec) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("ru_maxrss", r->r.ru_maxrss) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("ru_ixrss", r->r.ru_ixrss) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("ru_idrss", r->r.ru_idrss) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("ru_isrss", r->r.ru_isrss) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("ru_minflt", r->r.ru_minflt) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("ru_majflt", r->r.ru_majflt) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("ru_nswap", r->r.ru_nswap) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("ru_inblock", r->r.ru_inblock) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("ru_oublock", r->r.ru_oublock) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("ru_msgsnd", r->r.ru_msgsnd) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("ru_msgrcv", r->r.ru_msgrcv) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("ru_nsignals", r->r.ru_nsignals) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("ru_nvcsw", r->r.ru_nvcsw) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("ru_nivcsw", r->r.ru_nivcsw)
|
||||
<< SRS_JOBJECT_END
|
||||
<< SRS_JOBJECT_END;
|
||||
|
||||
return srs_go_http_response_json(w, ss.str());
|
||||
}
|
||||
|
@ -210,58 +210,58 @@ int SrsGoApiSelfProcStats::serve_http(ISrsHttpResponseWriter* w, SrsHttpMessage*
|
|||
|
||||
SrsProcSelfStat* u = srs_get_self_proc_stat();
|
||||
|
||||
ss << __SRS_JOBJECT_START
|
||||
<< __SRS_JFIELD_ERROR(ERROR_SUCCESS) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("data", __SRS_JOBJECT_START)
|
||||
<< __SRS_JFIELD_ORG("ok", (u->ok? "true":"false")) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("sample_time", u->sample_time) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("percent", u->percent) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("pid", u->pid) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("comm", u->comm) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("state", u->state) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("ppid", u->ppid) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("pgrp", u->pgrp) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("session", u->session) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("tty_nr", u->tty_nr) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("tpgid", u->tpgid) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("flags", u->flags) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("minflt", u->minflt) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("cminflt", u->cminflt) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("majflt", u->majflt) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("cmajflt", u->cmajflt) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("utime", u->utime) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("stime", u->stime) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("cutime", u->cutime) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("cstime", u->cstime) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("priority", u->priority) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("nice", u->nice) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("num_threads", u->num_threads) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("itrealvalue", u->itrealvalue) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("starttime", u->starttime) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("vsize", u->vsize) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("rss", u->rss) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("rsslim", u->rsslim) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("startcode", u->startcode) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("endcode", u->endcode) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("startstack", u->startstack) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("kstkesp", u->kstkesp) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("kstkeip", u->kstkeip) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("signal", u->signal) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("blocked", u->blocked) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("sigignore", u->sigignore) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("sigcatch", u->sigcatch) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("wchan", u->wchan) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("nswap", u->nswap) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("cnswap", u->cnswap) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("exit_signal", u->exit_signal) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("processor", u->processor) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("rt_priority", u->rt_priority) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("policy", u->policy) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("delayacct_blkio_ticks", u->delayacct_blkio_ticks) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("guest_time", u->guest_time) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("cguest_time", u->cguest_time)
|
||||
<< __SRS_JOBJECT_END
|
||||
<< __SRS_JOBJECT_END;
|
||||
ss << SRS_JOBJECT_START
|
||||
<< SRS_JFIELD_ERROR(ERROR_SUCCESS) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("data", SRS_JOBJECT_START)
|
||||
<< SRS_JFIELD_ORG("ok", (u->ok? "true":"false")) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("sample_time", u->sample_time) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("percent", u->percent) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("pid", u->pid) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("comm", u->comm) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("state", u->state) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("ppid", u->ppid) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("pgrp", u->pgrp) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("session", u->session) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("tty_nr", u->tty_nr) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("tpgid", u->tpgid) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("flags", u->flags) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("minflt", u->minflt) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("cminflt", u->cminflt) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("majflt", u->majflt) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("cmajflt", u->cmajflt) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("utime", u->utime) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("stime", u->stime) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("cutime", u->cutime) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("cstime", u->cstime) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("priority", u->priority) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("nice", u->nice) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("num_threads", u->num_threads) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("itrealvalue", u->itrealvalue) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("starttime", u->starttime) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("vsize", u->vsize) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("rss", u->rss) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("rsslim", u->rsslim) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("startcode", u->startcode) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("endcode", u->endcode) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("startstack", u->startstack) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("kstkesp", u->kstkesp) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("kstkeip", u->kstkeip) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("signal", u->signal) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("blocked", u->blocked) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("sigignore", u->sigignore) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("sigcatch", u->sigcatch) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("wchan", u->wchan) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("nswap", u->nswap) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("cnswap", u->cnswap) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("exit_signal", u->exit_signal) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("processor", u->processor) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("rt_priority", u->rt_priority) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("policy", u->policy) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("delayacct_blkio_ticks", u->delayacct_blkio_ticks) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("guest_time", u->guest_time) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("cguest_time", u->cguest_time)
|
||||
<< SRS_JOBJECT_END
|
||||
<< SRS_JOBJECT_END;
|
||||
|
||||
return srs_go_http_response_json(w, ss.str());
|
||||
}
|
||||
|
@ -280,23 +280,23 @@ int SrsGoApiSystemProcStats::serve_http(ISrsHttpResponseWriter* w, SrsHttpMessag
|
|||
|
||||
SrsProcSystemStat* s = srs_get_system_proc_stat();
|
||||
|
||||
ss << __SRS_JOBJECT_START
|
||||
<< __SRS_JFIELD_ERROR(ERROR_SUCCESS) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("data", __SRS_JOBJECT_START)
|
||||
<< __SRS_JFIELD_ORG("ok", (s->ok? "true":"false")) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("sample_time", s->sample_time) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("percent", s->percent) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("user", s->user) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("nice", s->nice) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("sys", s->sys) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("idle", s->idle) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("iowait", s->iowait) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("irq", s->irq) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("softirq", s->softirq) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("steal", s->steal) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("guest", s->guest)
|
||||
<< __SRS_JOBJECT_END
|
||||
<< __SRS_JOBJECT_END;
|
||||
ss << SRS_JOBJECT_START
|
||||
<< SRS_JFIELD_ERROR(ERROR_SUCCESS) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("data", SRS_JOBJECT_START)
|
||||
<< SRS_JFIELD_ORG("ok", (s->ok? "true":"false")) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("sample_time", s->sample_time) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("percent", s->percent) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("user", s->user) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("nice", s->nice) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("sys", s->sys) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("idle", s->idle) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("iowait", s->iowait) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("irq", s->irq) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("softirq", s->softirq) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("steal", s->steal) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("guest", s->guest)
|
||||
<< SRS_JOBJECT_END
|
||||
<< SRS_JOBJECT_END;
|
||||
|
||||
return srs_go_http_response_json(w, ss.str());
|
||||
}
|
||||
|
@ -315,24 +315,24 @@ int SrsGoApiMemInfos::serve_http(ISrsHttpResponseWriter* w, SrsHttpMessage* r)
|
|||
|
||||
SrsMemInfo* m = srs_get_meminfo();
|
||||
|
||||
ss << __SRS_JOBJECT_START
|
||||
<< __SRS_JFIELD_ERROR(ERROR_SUCCESS) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("data", __SRS_JOBJECT_START)
|
||||
<< __SRS_JFIELD_ORG("ok", (m->ok? "true":"false")) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("sample_time", m->sample_time) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("percent_ram", m->percent_ram) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("percent_swap", m->percent_swap) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("MemActive", m->MemActive) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("RealInUse", m->RealInUse) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("NotInUse", m->NotInUse) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("MemTotal", m->MemTotal) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("MemFree", m->MemFree) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("Buffers", m->Buffers) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("Cached", m->Cached) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("SwapTotal", m->SwapTotal) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("SwapFree", m->SwapFree)
|
||||
<< __SRS_JOBJECT_END
|
||||
<< __SRS_JOBJECT_END;
|
||||
ss << SRS_JOBJECT_START
|
||||
<< SRS_JFIELD_ERROR(ERROR_SUCCESS) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("data", SRS_JOBJECT_START)
|
||||
<< SRS_JFIELD_ORG("ok", (m->ok? "true":"false")) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("sample_time", m->sample_time) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("percent_ram", m->percent_ram) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("percent_swap", m->percent_swap) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("MemActive", m->MemActive) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("RealInUse", m->RealInUse) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("NotInUse", m->NotInUse) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("MemTotal", m->MemTotal) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("MemFree", m->MemFree) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("Buffers", m->Buffers) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("Cached", m->Cached) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("SwapTotal", m->SwapTotal) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("SwapFree", m->SwapFree)
|
||||
<< SRS_JOBJECT_END
|
||||
<< SRS_JOBJECT_END;
|
||||
|
||||
return srs_go_http_response_json(w, ss.str());
|
||||
}
|
||||
|
@ -349,15 +349,15 @@ int SrsGoApiAuthors::serve_http(ISrsHttpResponseWriter* w, SrsHttpMessage* r)
|
|||
{
|
||||
std::stringstream ss;
|
||||
|
||||
ss << __SRS_JOBJECT_START
|
||||
<< __SRS_JFIELD_ERROR(ERROR_SUCCESS) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("data", __SRS_JOBJECT_START)
|
||||
<< __SRS_JFIELD_STR("primary", RTMP_SIG_SRS_PRIMARY) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("authors", RTMP_SIG_SRS_AUTHROS) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("contributors_link", RTMP_SIG_SRS_CONTRIBUTORS_URL) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("contributors", SRS_AUTO_CONSTRIBUTORS)
|
||||
<< __SRS_JOBJECT_END
|
||||
<< __SRS_JOBJECT_END;
|
||||
ss << SRS_JOBJECT_START
|
||||
<< SRS_JFIELD_ERROR(ERROR_SUCCESS) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("data", SRS_JOBJECT_START)
|
||||
<< SRS_JFIELD_STR("primary", RTMP_SIG_SRS_PRIMARY) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("authors", RTMP_SIG_SRS_AUTHROS) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("contributors_link", RTMP_SIG_SRS_CONTRIBUTORS_URL) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("contributors", SRS_AUTO_CONSTRIBUTORS)
|
||||
<< SRS_JOBJECT_END
|
||||
<< SRS_JOBJECT_END;
|
||||
|
||||
return srs_go_http_response_json(w, ss.str());
|
||||
}
|
||||
|
@ -376,49 +376,49 @@ int SrsGoApiRequests::serve_http(ISrsHttpResponseWriter* w, SrsHttpMessage* r)
|
|||
|
||||
std::stringstream ss;
|
||||
|
||||
ss << __SRS_JOBJECT_START
|
||||
<< __SRS_JFIELD_ERROR(ERROR_SUCCESS) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("data", __SRS_JOBJECT_START)
|
||||
<< __SRS_JFIELD_STR("uri", req->uri()) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("path", req->path()) << __SRS_JFIELD_CONT;
|
||||
ss << SRS_JOBJECT_START
|
||||
<< SRS_JFIELD_ERROR(ERROR_SUCCESS) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("data", SRS_JOBJECT_START)
|
||||
<< SRS_JFIELD_STR("uri", req->uri()) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("path", req->path()) << SRS_JFIELD_CONT;
|
||||
|
||||
// method
|
||||
if (req->is_http_get()) {
|
||||
ss << __SRS_JFIELD_STR("METHOD", "GET");
|
||||
ss << SRS_JFIELD_STR("METHOD", "GET");
|
||||
} else if (req->is_http_post()) {
|
||||
ss << __SRS_JFIELD_STR("METHOD", "POST");
|
||||
ss << SRS_JFIELD_STR("METHOD", "POST");
|
||||
} else if (req->is_http_put()) {
|
||||
ss << __SRS_JFIELD_STR("METHOD", "PUT");
|
||||
ss << SRS_JFIELD_STR("METHOD", "PUT");
|
||||
} else if (req->is_http_delete()) {
|
||||
ss << __SRS_JFIELD_STR("METHOD", "DELETE");
|
||||
ss << SRS_JFIELD_STR("METHOD", "DELETE");
|
||||
} else {
|
||||
ss << __SRS_JFIELD_ORG("METHOD", req->method());
|
||||
ss << SRS_JFIELD_ORG("METHOD", req->method());
|
||||
}
|
||||
ss << __SRS_JFIELD_CONT;
|
||||
ss << SRS_JFIELD_CONT;
|
||||
|
||||
// request headers
|
||||
ss << __SRS_JFIELD_NAME("headers") << __SRS_JOBJECT_START;
|
||||
ss << SRS_JFIELD_NAME("headers") << SRS_JOBJECT_START;
|
||||
for (int i = 0; i < req->request_header_count(); i++) {
|
||||
std::string key = req->request_header_key_at(i);
|
||||
std::string value = req->request_header_value_at(i);
|
||||
if ( i < req->request_header_count() - 1) {
|
||||
ss << __SRS_JFIELD_STR(key, value) << __SRS_JFIELD_CONT;
|
||||
ss << SRS_JFIELD_STR(key, value) << SRS_JFIELD_CONT;
|
||||
} else {
|
||||
ss << __SRS_JFIELD_STR(key, value);
|
||||
ss << SRS_JFIELD_STR(key, value);
|
||||
}
|
||||
}
|
||||
ss << __SRS_JOBJECT_END << __SRS_JFIELD_CONT;
|
||||
ss << SRS_JOBJECT_END << SRS_JFIELD_CONT;
|
||||
|
||||
// server informations
|
||||
ss << __SRS_JFIELD_NAME("server") << __SRS_JOBJECT_START
|
||||
<< __SRS_JFIELD_STR("sigature", RTMP_SIG_SRS_KEY) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("name", RTMP_SIG_SRS_NAME) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("version", RTMP_SIG_SRS_VERSION) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("link", RTMP_SIG_SRS_URL) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("time", srs_get_system_time_ms())
|
||||
<< __SRS_JOBJECT_END
|
||||
<< __SRS_JOBJECT_END
|
||||
<< __SRS_JOBJECT_END;
|
||||
ss << SRS_JFIELD_NAME("server") << SRS_JOBJECT_START
|
||||
<< SRS_JFIELD_STR("sigature", RTMP_SIG_SRS_KEY) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("name", RTMP_SIG_SRS_NAME) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("version", RTMP_SIG_SRS_VERSION) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("link", RTMP_SIG_SRS_URL) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("time", srs_get_system_time_ms())
|
||||
<< SRS_JOBJECT_END
|
||||
<< SRS_JOBJECT_END
|
||||
<< SRS_JOBJECT_END;
|
||||
|
||||
return srs_go_http_response_json(w, ss.str());
|
||||
}
|
||||
|
@ -439,11 +439,11 @@ int SrsGoApiVhosts::serve_http(ISrsHttpResponseWriter* w, SrsHttpMessage* r)
|
|||
|
||||
std::stringstream ss;
|
||||
|
||||
ss << __SRS_JOBJECT_START
|
||||
<< __SRS_JFIELD_ERROR(ret) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("server", stat->server_id()) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("vhosts", data.str())
|
||||
<< __SRS_JOBJECT_END;
|
||||
ss << SRS_JOBJECT_START
|
||||
<< SRS_JFIELD_ERROR(ret) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("server", stat->server_id()) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("vhosts", data.str())
|
||||
<< SRS_JOBJECT_END;
|
||||
|
||||
return srs_go_http_response_json(w, ss.str());
|
||||
}
|
||||
|
@ -464,11 +464,11 @@ int SrsGoApiStreams::serve_http(ISrsHttpResponseWriter* w, SrsHttpMessage* r)
|
|||
|
||||
std::stringstream ss;
|
||||
|
||||
ss << __SRS_JOBJECT_START
|
||||
<< __SRS_JFIELD_ERROR(ret) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("server", stat->server_id()) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("streams", data.str())
|
||||
<< __SRS_JOBJECT_END;
|
||||
ss << SRS_JOBJECT_START
|
||||
<< SRS_JFIELD_ERROR(ret) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("server", stat->server_id()) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("streams", data.str())
|
||||
<< SRS_JOBJECT_END;
|
||||
|
||||
return srs_go_http_response_json(w, ss.str());
|
||||
}
|
||||
|
|
|
@ -87,13 +87,13 @@ int SrsHttpClient::post(string path, string req, SrsHttpMessage** ppmsg)
|
|||
// POST %s HTTP/1.1\r\nHost: %s\r\nContent-Length: %d\r\n\r\n%s
|
||||
std::stringstream ss;
|
||||
ss << "POST " << path << " "
|
||||
<< "HTTP/1.1" << __SRS_HTTP_CRLF
|
||||
<< "Host: " << host << __SRS_HTTP_CRLF
|
||||
<< "Connection: Keep-Alive" << __SRS_HTTP_CRLF
|
||||
<< "Content-Length: " << std::dec << req.length() << __SRS_HTTP_CRLF
|
||||
<< "User-Agent: " << RTMP_SIG_SRS_NAME << RTMP_SIG_SRS_VERSION << __SRS_HTTP_CRLF
|
||||
<< "Content-Type: application/json" << __SRS_HTTP_CRLF
|
||||
<< __SRS_HTTP_CRLF
|
||||
<< "HTTP/1.1" << SRS_HTTP_CRLF
|
||||
<< "Host: " << host << SRS_HTTP_CRLF
|
||||
<< "Connection: Keep-Alive" << SRS_HTTP_CRLF
|
||||
<< "Content-Length: " << std::dec << req.length() << SRS_HTTP_CRLF
|
||||
<< "User-Agent: " << RTMP_SIG_SRS_NAME << RTMP_SIG_SRS_VERSION << SRS_HTTP_CRLF
|
||||
<< "Content-Type: application/json" << SRS_HTTP_CRLF
|
||||
<< SRS_HTTP_CRLF
|
||||
<< req;
|
||||
|
||||
std::string data = ss.str();
|
||||
|
@ -133,13 +133,13 @@ int SrsHttpClient::get(string path, std::string req, SrsHttpMessage** ppmsg)
|
|||
// GET %s HTTP/1.1\r\nHost: %s\r\nContent-Length: %d\r\n\r\n%s
|
||||
std::stringstream ss;
|
||||
ss << "GET " << path << " "
|
||||
<< "HTTP/1.1" << __SRS_HTTP_CRLF
|
||||
<< "Host: " << host << __SRS_HTTP_CRLF
|
||||
<< "Connection: Keep-Alive" << __SRS_HTTP_CRLF
|
||||
<< "Content-Length: " << std::dec << req.length() << __SRS_HTTP_CRLF
|
||||
<< "User-Agent: " << RTMP_SIG_SRS_NAME << RTMP_SIG_SRS_VERSION << __SRS_HTTP_CRLF
|
||||
<< "Content-Type: application/json" << __SRS_HTTP_CRLF
|
||||
<< __SRS_HTTP_CRLF
|
||||
<< "HTTP/1.1" << SRS_HTTP_CRLF
|
||||
<< "Host: " << host << SRS_HTTP_CRLF
|
||||
<< "Connection: Keep-Alive" << SRS_HTTP_CRLF
|
||||
<< "Content-Length: " << std::dec << req.length() << SRS_HTTP_CRLF
|
||||
<< "User-Agent: " << RTMP_SIG_SRS_NAME << RTMP_SIG_SRS_VERSION << SRS_HTTP_CRLF
|
||||
<< "Content-Type: application/json" << SRS_HTTP_CRLF
|
||||
<< SRS_HTTP_CRLF
|
||||
<< req;
|
||||
|
||||
std::string data = ss.str();
|
||||
|
|
|
@ -37,7 +37,7 @@ using namespace std;
|
|||
#include <srs_app_http_client.hpp>
|
||||
#include <srs_core_autofree.hpp>
|
||||
|
||||
#define SRS_HTTP_RESPONSE_OK __SRS_XSTR(ERROR_SUCCESS)
|
||||
#define SRS_HTTP_RESPONSE_OK SRS_XSTR(ERROR_SUCCESS)
|
||||
|
||||
#define SRS_HTTP_HEADER_BUFFER 1024
|
||||
#define SRS_HTTP_BODY_BUFFER 32 * 1024
|
||||
|
@ -55,15 +55,15 @@ int SrsHttpHooks::on_connect(string url, int client_id, string ip, SrsRequest* r
|
|||
int ret = ERROR_SUCCESS;
|
||||
|
||||
std::stringstream ss;
|
||||
ss << __SRS_JOBJECT_START
|
||||
<< __SRS_JFIELD_STR("action", "on_connect") << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("client_id", client_id) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("ip", ip) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("vhost", req->vhost) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("app", req->app) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("tcUrl", req->tcUrl) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("pageUrl", req->pageUrl)
|
||||
<< __SRS_JOBJECT_END;
|
||||
ss << SRS_JOBJECT_START
|
||||
<< SRS_JFIELD_STR("action", "on_connect") << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("client_id", client_id) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("ip", ip) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("vhost", req->vhost) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("app", req->app) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("tcUrl", req->tcUrl) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("pageUrl", req->pageUrl)
|
||||
<< SRS_JOBJECT_END;
|
||||
|
||||
std::string data = ss.str();
|
||||
std::string res;
|
||||
|
@ -87,15 +87,15 @@ void SrsHttpHooks::on_close(string url, int client_id, string ip, SrsRequest* re
|
|||
int ret = ERROR_SUCCESS;
|
||||
|
||||
std::stringstream ss;
|
||||
ss << __SRS_JOBJECT_START
|
||||
<< __SRS_JFIELD_STR("action", "on_close") << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("client_id", client_id) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("ip", ip) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("vhost", req->vhost) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("send_bytes", send_bytes) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("recv_bytes", recv_bytes) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("app", req->app)
|
||||
<< __SRS_JOBJECT_END;
|
||||
ss << SRS_JOBJECT_START
|
||||
<< SRS_JFIELD_STR("action", "on_close") << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("client_id", client_id) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("ip", ip) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("vhost", req->vhost) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("send_bytes", send_bytes) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("recv_bytes", recv_bytes) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("app", req->app)
|
||||
<< SRS_JOBJECT_END;
|
||||
|
||||
std::string data = ss.str();
|
||||
std::string res;
|
||||
|
@ -119,14 +119,14 @@ int SrsHttpHooks::on_publish(string url, int client_id, string ip, SrsRequest* r
|
|||
int ret = ERROR_SUCCESS;
|
||||
|
||||
std::stringstream ss;
|
||||
ss << __SRS_JOBJECT_START
|
||||
<< __SRS_JFIELD_STR("action", "on_publish") << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("client_id", client_id) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("ip", ip) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("vhost", req->vhost) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("app", req->app) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("stream", req->stream)
|
||||
<< __SRS_JOBJECT_END;
|
||||
ss << SRS_JOBJECT_START
|
||||
<< SRS_JFIELD_STR("action", "on_publish") << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("client_id", client_id) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("ip", ip) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("vhost", req->vhost) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("app", req->app) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("stream", req->stream)
|
||||
<< SRS_JOBJECT_END;
|
||||
|
||||
std::string data = ss.str();
|
||||
std::string res;
|
||||
|
@ -150,14 +150,14 @@ void SrsHttpHooks::on_unpublish(string url, int client_id, string ip, SrsRequest
|
|||
int ret = ERROR_SUCCESS;
|
||||
|
||||
std::stringstream ss;
|
||||
ss << __SRS_JOBJECT_START
|
||||
<< __SRS_JFIELD_STR("action", "on_unpublish") << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("client_id", client_id) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("ip", ip) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("vhost", req->vhost) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("app", req->app) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("stream", req->stream)
|
||||
<< __SRS_JOBJECT_END;
|
||||
ss << SRS_JOBJECT_START
|
||||
<< SRS_JFIELD_STR("action", "on_unpublish") << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("client_id", client_id) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("ip", ip) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("vhost", req->vhost) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("app", req->app) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("stream", req->stream)
|
||||
<< SRS_JOBJECT_END;
|
||||
|
||||
std::string data = ss.str();
|
||||
std::string res;
|
||||
|
@ -181,14 +181,14 @@ int SrsHttpHooks::on_play(string url, int client_id, string ip, SrsRequest* req)
|
|||
int ret = ERROR_SUCCESS;
|
||||
|
||||
std::stringstream ss;
|
||||
ss << __SRS_JOBJECT_START
|
||||
<< __SRS_JFIELD_STR("action", "on_play") << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("client_id", client_id) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("ip", ip) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("vhost", req->vhost) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("app", req->app) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("stream", req->stream)
|
||||
<< __SRS_JOBJECT_END;
|
||||
ss << SRS_JOBJECT_START
|
||||
<< SRS_JFIELD_STR("action", "on_play") << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("client_id", client_id) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("ip", ip) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("vhost", req->vhost) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("app", req->app) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("stream", req->stream)
|
||||
<< SRS_JOBJECT_END;
|
||||
|
||||
std::string data = ss.str();
|
||||
std::string res;
|
||||
|
@ -212,14 +212,14 @@ void SrsHttpHooks::on_stop(string url, int client_id, string ip, SrsRequest* req
|
|||
int ret = ERROR_SUCCESS;
|
||||
|
||||
std::stringstream ss;
|
||||
ss << __SRS_JOBJECT_START
|
||||
<< __SRS_JFIELD_STR("action", "on_stop") << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("client_id", client_id) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("ip", ip) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("vhost", req->vhost) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("app", req->app) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("stream", req->stream)
|
||||
<< __SRS_JOBJECT_END;
|
||||
ss << SRS_JOBJECT_START
|
||||
<< SRS_JFIELD_STR("action", "on_stop") << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("client_id", client_id) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("ip", ip) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("vhost", req->vhost) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("app", req->app) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("stream", req->stream)
|
||||
<< SRS_JOBJECT_END;
|
||||
|
||||
std::string data = ss.str();
|
||||
std::string res;
|
||||
|
@ -243,16 +243,16 @@ int SrsHttpHooks::on_dvr(string url, int client_id, string ip, SrsRequest* req,
|
|||
int ret = ERROR_SUCCESS;
|
||||
|
||||
std::stringstream ss;
|
||||
ss << __SRS_JOBJECT_START
|
||||
<< __SRS_JFIELD_STR("action", "on_dvr") << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("client_id", client_id) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("ip", ip) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("vhost", req->vhost) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("app", req->app) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("stream", req->stream) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("cwd", cwd) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("file", file)
|
||||
<< __SRS_JOBJECT_END;
|
||||
ss << SRS_JOBJECT_START
|
||||
<< SRS_JFIELD_STR("action", "on_dvr") << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("client_id", client_id) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("ip", ip) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("vhost", req->vhost) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("app", req->app) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("stream", req->stream) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("cwd", cwd) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("file", file)
|
||||
<< SRS_JOBJECT_END;
|
||||
|
||||
std::string data = ss.str();
|
||||
std::string res;
|
||||
|
@ -276,15 +276,15 @@ int SrsHttpHooks::on_dvr_reap_segment(string url, int client_id, SrsRequest* req
|
|||
int ret = ERROR_SUCCESS;
|
||||
|
||||
std::stringstream ss;
|
||||
ss << __SRS_JOBJECT_START
|
||||
<< __SRS_JFIELD_STR("action", "on_dvr_reap_segment") << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("client_id", client_id) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("vhost", req->vhost) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("app", req->app) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("stream", req->stream) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("cwd", cwd) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("file", file)
|
||||
<< __SRS_JOBJECT_END;
|
||||
ss << SRS_JOBJECT_START
|
||||
<< SRS_JFIELD_STR("action", "on_dvr_reap_segment") << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("client_id", client_id) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("vhost", req->vhost) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("app", req->app) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("stream", req->stream) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("cwd", cwd) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("file", file)
|
||||
<< SRS_JOBJECT_END;
|
||||
|
||||
std::string data = ss.str();
|
||||
std::string res;
|
||||
|
|
|
@ -27,7 +27,7 @@ using namespace std;
|
|||
|
||||
#include <srs_kernel_log.hpp>
|
||||
|
||||
#ifdef __SRS_JSON_USE_NXJSON
|
||||
#ifdef SRS_JSON_USE_NXJSON
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -302,7 +302,7 @@ SrsJsonArray* SrsJsonAny::array()
|
|||
return new SrsJsonArray();
|
||||
}
|
||||
|
||||
#ifdef __SRS_JSON_USE_NXJSON
|
||||
#ifdef SRS_JSON_USE_NXJSON
|
||||
SrsJsonAny* srs_json_parse_tree_nx_json(const nx_json* node)
|
||||
{
|
||||
if (!node) {
|
||||
|
@ -504,7 +504,7 @@ void SrsJsonArray::add(SrsJsonAny* value)
|
|||
properties.push_back(value);
|
||||
}
|
||||
|
||||
#ifdef __SRS_JSON_USE_NXJSON
|
||||
#ifdef SRS_JSON_USE_NXJSON
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -34,8 +34,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
|
||||
// whether use nxjson
|
||||
// @see: https://bitbucket.org/yarosla/nxjson
|
||||
#undef __SRS_JSON_USE_NXJSON
|
||||
#define __SRS_JSON_USE_NXJSON
|
||||
#undef SRS_JSON_USE_NXJSON
|
||||
#define SRS_JSON_USE_NXJSON
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
@ -174,16 +174,16 @@ public:
|
|||
////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/* json encode
|
||||
cout<< __SRS_JOBJECT_START
|
||||
<< __SRS_JFIELD_STR("name", "srs") << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("version", 100) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_NAME("features") << __SRS_JOBJECT_START
|
||||
<< __SRS_JFIELD_STR("rtmp", "released") << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("hls", "released") << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("dash", "plan")
|
||||
<< __SRS_JOBJECT_END << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("author", "srs team")
|
||||
<< __SRS_JOBJECT_END
|
||||
cout<< SRS_JOBJECT_START
|
||||
<< SRS_JFIELD_STR("name", "srs") << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("version", 100) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_NAME("features") << SRS_JOBJECT_START
|
||||
<< SRS_JFIELD_STR("rtmp", "released") << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("hls", "released") << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("dash", "plan")
|
||||
<< SRS_JOBJECT_END << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("author", "srs team")
|
||||
<< SRS_JOBJECT_END
|
||||
it's:
|
||||
cont<< "{"
|
||||
<< "name:" << "srs" << ","
|
||||
|
@ -212,16 +212,16 @@ that is:
|
|||
////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
#define __SRS_JOBJECT_START "{"
|
||||
#define __SRS_JFIELD_NAME(k) "\"" << k << "\":"
|
||||
#define __SRS_JFIELD_STR(k, v) "\"" << k << "\":\"" << v << "\""
|
||||
#define __SRS_JFIELD_ORG(k, v) "\"" << k << "\":" << std::dec << v
|
||||
#define __SRS_JFIELD_BOOL(k, v) __SRS_JFIELD_ORG(k, (v? "true":"false"))
|
||||
#define __SRS_JFIELD_NULL(k) "\"" << k << "\":null"
|
||||
#define __SRS_JFIELD_ERROR(ret) "\"" << "code" << "\":" << ret
|
||||
#define __SRS_JFIELD_CONT ","
|
||||
#define __SRS_JOBJECT_END "}"
|
||||
#define __SRS_JARRAY_START "["
|
||||
#define __SRS_JARRAY_END "]"
|
||||
#define SRS_JOBJECT_START "{"
|
||||
#define SRS_JFIELD_NAME(k) "\"" << k << "\":"
|
||||
#define SRS_JFIELD_STR(k, v) "\"" << k << "\":\"" << v << "\""
|
||||
#define SRS_JFIELD_ORG(k, v) "\"" << k << "\":" << std::dec << v
|
||||
#define SRS_JFIELD_BOOL(k, v) SRS_JFIELD_ORG(k, (v? "true":"false"))
|
||||
#define SRS_JFIELD_NULL(k) "\"" << k << "\":null"
|
||||
#define SRS_JFIELD_ERROR(ret) "\"" << "code" << "\":" << ret
|
||||
#define SRS_JFIELD_CONT ","
|
||||
#define SRS_JOBJECT_END "}"
|
||||
#define SRS_JARRAY_START "["
|
||||
#define SRS_JARRAY_END "]"
|
||||
|
||||
#endif
|
||||
|
|
|
@ -250,22 +250,22 @@ int SrsStatistic::dumps_vhosts(stringstream& ss)
|
|||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
ss << __SRS_JARRAY_START;
|
||||
ss << SRS_JARRAY_START;
|
||||
std::map<std::string, SrsStatisticVhost*>::iterator it;
|
||||
for (it = vhosts.begin(); it != vhosts.end(); it++) {
|
||||
SrsStatisticVhost* vhost = it->second;
|
||||
if (it != vhosts.begin()) {
|
||||
ss << __SRS_JFIELD_CONT;
|
||||
ss << SRS_JFIELD_CONT;
|
||||
}
|
||||
|
||||
ss << __SRS_JOBJECT_START
|
||||
<< __SRS_JFIELD_ORG("id", vhost->id) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("name", vhost->vhost) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("send_bytes", vhost->kbps->get_send_bytes()) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("recv_bytes", vhost->kbps->get_recv_bytes())
|
||||
<< __SRS_JOBJECT_END;
|
||||
ss << SRS_JOBJECT_START
|
||||
<< SRS_JFIELD_ORG("id", vhost->id) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("name", vhost->vhost) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("send_bytes", vhost->kbps->get_send_bytes()) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("recv_bytes", vhost->kbps->get_recv_bytes())
|
||||
<< SRS_JOBJECT_END;
|
||||
}
|
||||
ss << __SRS_JARRAY_END;
|
||||
ss << SRS_JARRAY_END;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -274,12 +274,12 @@ int SrsStatistic::dumps_streams(stringstream& ss)
|
|||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
ss << __SRS_JARRAY_START;
|
||||
ss << SRS_JARRAY_START;
|
||||
std::map<std::string, SrsStatisticStream*>::iterator it;
|
||||
for (it = streams.begin(); it != streams.end(); it++) {
|
||||
SrsStatisticStream* stream = it->second;
|
||||
if (it != streams.begin()) {
|
||||
ss << __SRS_JFIELD_CONT;
|
||||
ss << SRS_JFIELD_CONT;
|
||||
}
|
||||
|
||||
int client_num = 0;
|
||||
|
@ -291,41 +291,41 @@ int SrsStatistic::dumps_streams(stringstream& ss)
|
|||
}
|
||||
}
|
||||
|
||||
ss << __SRS_JOBJECT_START
|
||||
<< __SRS_JFIELD_ORG("id", stream->id) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("name", stream->stream) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("vhost", stream->vhost->id) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("clients", client_num) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("send_bytes", stream->kbps->get_send_bytes()) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("recv_bytes", stream->kbps->get_recv_bytes()) << __SRS_JFIELD_CONT;
|
||||
ss << SRS_JOBJECT_START
|
||||
<< SRS_JFIELD_ORG("id", stream->id) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("name", stream->stream) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("vhost", stream->vhost->id) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("clients", client_num) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("send_bytes", stream->kbps->get_send_bytes()) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("recv_bytes", stream->kbps->get_recv_bytes()) << SRS_JFIELD_CONT;
|
||||
|
||||
if (!stream->has_video) {
|
||||
ss << __SRS_JFIELD_NULL("video") << __SRS_JFIELD_CONT;
|
||||
ss << SRS_JFIELD_NULL("video") << SRS_JFIELD_CONT;
|
||||
} else {
|
||||
ss << __SRS_JFIELD_NAME("video")
|
||||
<< __SRS_JOBJECT_START
|
||||
<< __SRS_JFIELD_STR("codec", srs_codec_video2str(stream->vcodec)) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("profile", srs_codec_avc_profile2str(stream->avc_profile)) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("level", srs_codec_avc_level2str(stream->avc_level))
|
||||
<< __SRS_JOBJECT_END
|
||||
<< __SRS_JFIELD_CONT;
|
||||
ss << SRS_JFIELD_NAME("video")
|
||||
<< SRS_JOBJECT_START
|
||||
<< SRS_JFIELD_STR("codec", srs_codec_video2str(stream->vcodec)) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("profile", srs_codec_avc_profile2str(stream->avc_profile)) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("level", srs_codec_avc_level2str(stream->avc_level))
|
||||
<< SRS_JOBJECT_END
|
||||
<< SRS_JFIELD_CONT;
|
||||
}
|
||||
|
||||
if (!stream->has_audio) {
|
||||
ss << __SRS_JFIELD_NULL("audio");
|
||||
ss << SRS_JFIELD_NULL("audio");
|
||||
} else {
|
||||
ss << __SRS_JFIELD_NAME("audio")
|
||||
<< __SRS_JOBJECT_START
|
||||
<< __SRS_JFIELD_STR("codec", srs_codec_audio2str(stream->acodec)) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("sample_rate", (int)flv_sample_rates[stream->asample_rate]) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("channel", (int)stream->asound_type + 1) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("profile", srs_codec_aac_object2str(stream->aac_object))
|
||||
<< __SRS_JOBJECT_END;
|
||||
ss << SRS_JFIELD_NAME("audio")
|
||||
<< SRS_JOBJECT_START
|
||||
<< SRS_JFIELD_STR("codec", srs_codec_audio2str(stream->acodec)) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("sample_rate", (int)flv_sample_rates[stream->asample_rate]) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("channel", (int)stream->asound_type + 1) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("profile", srs_codec_aac_object2str(stream->aac_object))
|
||||
<< SRS_JOBJECT_END;
|
||||
}
|
||||
|
||||
ss << __SRS_JOBJECT_END;
|
||||
ss << SRS_JOBJECT_END;
|
||||
}
|
||||
ss << __SRS_JARRAY_END;
|
||||
ss << SRS_JARRAY_END;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -1123,51 +1123,51 @@ void srs_api_dump_summaries(std::stringstream& ss)
|
|||
bool ok = (r->ok && u->ok && s->ok && c->ok
|
||||
&& d->ok && m->ok && p->ok && n_ok && nrs->ok);
|
||||
|
||||
ss << __SRS_JOBJECT_START
|
||||
<< __SRS_JFIELD_ERROR(ERROR_SUCCESS) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("data", __SRS_JOBJECT_START)
|
||||
<< __SRS_JFIELD_ORG("ok", (ok? "true":"false")) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("now_ms", now) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("self", __SRS_JOBJECT_START)
|
||||
<< __SRS_JFIELD_STR("version", RTMP_SIG_SRS_VERSION) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("pid", getpid()) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("ppid", u->ppid) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("argv", _srs_config->argv()) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_STR("cwd", _srs_config->cwd()) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("mem_kbyte", r->r.ru_maxrss) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("mem_percent", self_mem_percent) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("cpu_percent", u->percent) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("srs_uptime", srs_uptime)
|
||||
<< __SRS_JOBJECT_END << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("system", __SRS_JOBJECT_START)
|
||||
<< __SRS_JFIELD_ORG("cpu_percent", s->percent) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("disk_read_KBps", d->in_KBps) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("disk_write_KBps", d->out_KBps) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("disk_busy_percent", d->busy) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("mem_ram_kbyte", m->MemTotal) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("mem_ram_percent", m->percent_ram) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("mem_swap_kbyte", m->SwapTotal) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("mem_swap_percent", m->percent_swap) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("cpus", c->nb_processors) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("cpus_online", c->nb_processors_online) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("uptime", p->os_uptime) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("ilde_time", p->os_ilde_time) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("load_1m", p->load_one_minutes) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("load_5m", p->load_five_minutes) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("load_15m", p->load_fifteen_minutes) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("net_sample_time", n_sample_time) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("net_recv_bytes", nr_bytes) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("net_send_bytes", ns_bytes) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("srs_sample_time", nrs->sample_time) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("srs_recv_bytes", nrs->rbytes) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("srs_send_bytes", nrs->sbytes) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("conn_sys", nrs->nb_conn_sys) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("conn_sys_et", nrs->nb_conn_sys_et) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("conn_sys_tw", nrs->nb_conn_sys_tw) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("conn_sys_udp", nrs->nb_conn_sys_udp) << __SRS_JFIELD_CONT
|
||||
<< __SRS_JFIELD_ORG("conn_srs", nrs->nb_conn_srs)
|
||||
<< __SRS_JOBJECT_END
|
||||
<< __SRS_JOBJECT_END
|
||||
<< __SRS_JOBJECT_END;
|
||||
ss << SRS_JOBJECT_START
|
||||
<< SRS_JFIELD_ERROR(ERROR_SUCCESS) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("data", SRS_JOBJECT_START)
|
||||
<< SRS_JFIELD_ORG("ok", (ok? "true":"false")) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("now_ms", now) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("self", SRS_JOBJECT_START)
|
||||
<< SRS_JFIELD_STR("version", RTMP_SIG_SRS_VERSION) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("pid", getpid()) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("ppid", u->ppid) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("argv", _srs_config->argv()) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_STR("cwd", _srs_config->cwd()) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("mem_kbyte", r->r.ru_maxrss) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("mem_percent", self_mem_percent) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("cpu_percent", u->percent) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("srs_uptime", srs_uptime)
|
||||
<< SRS_JOBJECT_END << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("system", SRS_JOBJECT_START)
|
||||
<< SRS_JFIELD_ORG("cpu_percent", s->percent) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("disk_read_KBps", d->in_KBps) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("disk_write_KBps", d->out_KBps) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("disk_busy_percent", d->busy) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("mem_ram_kbyte", m->MemTotal) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("mem_ram_percent", m->percent_ram) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("mem_swap_kbyte", m->SwapTotal) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("mem_swap_percent", m->percent_swap) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("cpus", c->nb_processors) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("cpus_online", c->nb_processors_online) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("uptime", p->os_uptime) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("ilde_time", p->os_ilde_time) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("load_1m", p->load_one_minutes) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("load_5m", p->load_five_minutes) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("load_15m", p->load_fifteen_minutes) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("net_sample_time", n_sample_time) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("net_recv_bytes", nr_bytes) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("net_send_bytes", ns_bytes) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("srs_sample_time", nrs->sample_time) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("srs_recv_bytes", nrs->rbytes) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("srs_send_bytes", nrs->sbytes) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("conn_sys", nrs->nb_conn_sys) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("conn_sys_et", nrs->nb_conn_sys_et) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("conn_sys_tw", nrs->nb_conn_sys_tw) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("conn_sys_udp", nrs->nb_conn_sys_udp) << SRS_JFIELD_CONT
|
||||
<< SRS_JFIELD_ORG("conn_srs", nrs->nb_conn_srs)
|
||||
<< SRS_JOBJECT_END
|
||||
<< SRS_JOBJECT_END
|
||||
<< SRS_JOBJECT_END;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue