Now possible to set the HTTP server port
It is now possible to set the HTTP server port using the HTTP_SRV_PORT configuration variable.
This commit is contained in:
parent
6773aac1ab
commit
cb16e53187
|
|
@ -110,7 +110,9 @@ second.
|
|||
.B CODECS
|
||||
A comma separated list of allowed codecs. For the moment only one codec can be
|
||||
specified. Choose from the following codecs: OPUS, SPEEX, GSM, S16
|
||||
(uncompressed signed 16 bit), RAW (uncompressed 32 bit floats).
|
||||
(uncompressed signed 16 bit), RAW (uncompressed 32 bit floats). The default is
|
||||
OPUS and you should have a very good reason for changing this since that codec
|
||||
provide both low bandwidth (~20kbps by default) and very good audio quality.
|
||||
.TP
|
||||
.B TG_FOR_V1_CLIENTS
|
||||
Set which talk group to place protocol version 1 clients in. Without this
|
||||
|
|
@ -126,7 +128,18 @@ two colon separated values. The first one is the lower limit and the second
|
|||
value is the number of talk groups in the range. As an example, if set to
|
||||
1239900:100 QSY talk groups will be selected from the range 1239900 to 1239999.
|
||||
The recommended lower range to use is <MCC>9900 where MCC is the ITU-T E.212
|
||||
Mobile Country Code for your country, e.g. 2409900 for Sweden.
|
||||
Mobile Country Code for your country, e.g. 240 for Sweden.
|
||||
.TP
|
||||
.B HTTP_SRV_PORT
|
||||
Set which port to use for the HTTP server. The HTTP server can be used to fetch
|
||||
reflector status. No port is set by default. Don't expose this port to the
|
||||
public Internet. There are multiple reasons for that. The built in web server
|
||||
is very simple and could be incompatible with some clients. It has not been
|
||||
audited for security problems so there may be security issues. There is also
|
||||
the risk of some client overwhelming the reflector with requests causing
|
||||
disturbances in the reflector operation.
|
||||
|
||||
Example: HTTP_SRV_PORT=8080
|
||||
.
|
||||
.SS USERS and PASSWORDS sections
|
||||
.
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ namespace {
|
|||
|
||||
Reflector::Reflector(void)
|
||||
: m_srv(0), m_udp_sock(0), m_tg_for_v1_clients(1), m_random_qsy_lo(0),
|
||||
m_random_qsy_hi(0), m_random_qsy_tg(0), m_http_server("8080")
|
||||
m_random_qsy_hi(0), m_random_qsy_tg(0), m_http_server(0)
|
||||
{
|
||||
TGHandler::instance()->talkerUpdated.connect(
|
||||
mem_fun(*this, &Reflector::onTalkerUpdated));
|
||||
|
|
@ -135,14 +135,19 @@ Reflector::Reflector(void)
|
|||
|
||||
Reflector::~Reflector(void)
|
||||
{
|
||||
delete m_http_server;
|
||||
m_http_server = 0;
|
||||
delete m_udp_sock;
|
||||
m_udp_sock = 0;
|
||||
delete m_srv;
|
||||
m_srv = 0;
|
||||
|
||||
for (ReflectorClientMap::iterator it = m_client_map.begin();
|
||||
it != m_client_map.end(); ++it)
|
||||
{
|
||||
delete (*it).second;
|
||||
}
|
||||
m_client_map.clear();
|
||||
|
||||
delete TGHandler::instance();
|
||||
} /* Reflector::~Reflector */
|
||||
|
|
@ -217,10 +222,15 @@ bool Reflector::initialize(Async::Config &cfg)
|
|||
m_random_qsy_tg = m_random_qsy_hi;
|
||||
}
|
||||
|
||||
m_http_server.clientConnected.connect(
|
||||
sigc::mem_fun(*this, &Reflector::httpClientConnected));
|
||||
m_http_server.clientDisconnected.connect(
|
||||
sigc::mem_fun(*this, &Reflector::httpClientDisconnected));
|
||||
std::string http_srv_port;
|
||||
if (m_cfg->getValue("GLOBAL", "HTTP_SRV_PORT", http_srv_port))
|
||||
{
|
||||
m_http_server = new Async::TcpServer<Async::HttpServerConnection>(http_srv_port);
|
||||
m_http_server->clientConnected.connect(
|
||||
sigc::mem_fun(*this, &Reflector::httpClientConnected));
|
||||
m_http_server->clientDisconnected.connect(
|
||||
sigc::mem_fun(*this, &Reflector::httpClientDisconnected));
|
||||
}
|
||||
|
||||
return true;
|
||||
} /* Reflector::initialize */
|
||||
|
|
@ -604,7 +614,7 @@ void Reflector::httpRequestReceived(Async::HttpServerConnection *con,
|
|||
{
|
||||
res.setCode(404);
|
||||
res.setContent("application/json",
|
||||
"{\"msg\":\"Object not found!\"}");
|
||||
"{\"msg\":\"Not found!\"}");
|
||||
con->write(res);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -187,16 +187,16 @@ class Reflector : public sigc::trackable
|
|||
ReflectorClient*> ReflectorClientConMap;
|
||||
typedef Async::TcpServer<Async::FramedTcpConnection> FramedTcpServer;
|
||||
|
||||
FramedTcpServer* m_srv;
|
||||
Async::UdpSocket* m_udp_sock;
|
||||
ReflectorClientMap m_client_map;
|
||||
ReflectorClientConMap m_client_con_map;
|
||||
Async::Config* m_cfg;
|
||||
uint32_t m_tg_for_v1_clients;
|
||||
uint32_t m_random_qsy_lo;
|
||||
uint32_t m_random_qsy_hi;
|
||||
uint32_t m_random_qsy_tg;
|
||||
Async::TcpServer<Async::HttpServerConnection> m_http_server;
|
||||
FramedTcpServer* m_srv;
|
||||
Async::UdpSocket* m_udp_sock;
|
||||
ReflectorClientMap m_client_map;
|
||||
ReflectorClientConMap m_client_con_map;
|
||||
Async::Config* m_cfg;
|
||||
uint32_t m_tg_for_v1_clients;
|
||||
uint32_t m_random_qsy_lo;
|
||||
uint32_t m_random_qsy_hi;
|
||||
uint32_t m_random_qsy_tg;
|
||||
Async::TcpServer<Async::HttpServerConnection>* m_http_server;
|
||||
|
||||
Reflector(const Reflector&);
|
||||
Reflector& operator=(const Reflector&);
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ LISTEN_PORT=5300
|
|||
#CODECS=OPUS
|
||||
TG_FOR_V1_CLIENTS=999
|
||||
#RANDOM_QSY_RANGE=12399:100
|
||||
#HTTP_SRV_PORT=8080
|
||||
|
||||
[USERS]
|
||||
#SM0ABC-1=MyNodes
|
||||
|
|
|
|||
Loading…
Reference in New Issue