Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/pr/247'
Browse files Browse the repository at this point in the history
Conflicts:
	man/tvheadend.1
  • Loading branch information
adamsutton committed Feb 21, 2013
2 parents c5f4725 + a3fdc6f commit 290dcb8
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 41 deletions.
69 changes: 41 additions & 28 deletions man/tvheadend.1
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,43 @@ Media player.
.SH OPTIONS
All arguments are optional.
.TP
\fB\-A\fR, \fB\-\-abort\fR
Immediately abort on startup (for debug).
\fB\-v\fR, \fB\-\-version\fR
Show version information.
.TP
\fB\-a\fR, \fB\-\-adapters\fR
Only use specified DVB adapters (comma separated).
\fB\-h\fR, \fB\-\-help\fR
Show built-in help information (may be more up to date).
.TP
\fB\-c\fR, \fB\-\-config\fR
Specify an alternate config path; the default is \fI${HOME}/.hts\fR
.TP
\fB\-f
Fork and become a background process (deamon). Default no.
.TP
\fB\-u\fR \fIusername\fR, \fB\-\-user\fR \fIusername\fR
Run as user \fIusername\fR. Only applicable if daemonizing. Default is to
use the uid of 1 (daemon on most systems).
.TP
\fB\-g\fR \fIgroupname\fR, \fB\-\-group \fR\fIgroupname\fR
Run as group \fR\fIgroupname\fR. Only applicable if daemonizing. Default is to use the 'video' group. If the 'video' group does not exist, gid 1 (daemon) will be used.
.TP
\fB\-p\fR \fIpidpath\fR, \fB\-\-pid \fR\fIpidpath\fR
Specify alternative PID path file (default /var/run/tvheadend.pid).
.TP
\fB\-C\fR, \fB\-\-firstrun\fR
If no useraccount exist then create one with no username and no
password. Use with care as it will allow world-wide administrative
access to your Tvheadend installation until you edit the
access-control from within the Tvheadend UI.
.TP
\fB\-d\fR, \fB\-\-debug\fR
Enable all debug.
\fB\-a\fR, \fB\-\-adapters\fR
Only use specified DVB adapters (comma separated).
.TP
\fB\-f
Fork and become a background process (deamon). Default no.
\fB\-6\fR, \fB\-\-ipv6\fR
Listen on IPv6.
.TP
\fB\-g\fR \fIgroupname\fR, \fB\-\-group \fR\fIgroupname\fR
Run as group \fR\fIgroupname\fR. Only applicable if daemonizing. Default is to use the 'video' group. If the 'video' group does not exist, gid 1 (daemon) will be used.
\fB\-b\fR \fIaddress\fR, \fB\-\-bindaddr\fR \fIaddress\fR
Specify an interface IP address on which incoming HTTP and HTSP connections
will be accepted. By default, connections are accepted on all interfaces.
.TP
\fB\-\-http_port
Specify alternative http port (default 9881).
Expand All @@ -49,33 +63,32 @@ Specify alternative htsp port (default 9882).
\fB\-\-htsp_port2
Specify extra htsp port.
.TP
\fB\-j\fR, \fB\-\-join\fR
Subscribe to a service permanently.
.TP
\fB\-l\fR, \fB\-\-log\fR
Log to file.
.TP
\fB\-r\fR, \fB\-\-rawts\fR
Use rawts file to generate virtual services.
.TP
\fB\-R\fR, \fB\-\-dvbraw\fR
Use rawts file to create virtual adapter.
\fB\-d\fR, \fB\-\-debug\fR
Enable all debug.
.TP
\fB\-s\fR, \fB\-\-syslog\fR
Enable debug to syslog.
.TP
\fB\-\-uidebug
Enable web UI debug.
.TP
\fB\-u\fR \fIusername\fR, \fB\-\-user\fR \fIusername\fR
Run as user \fIusername\fR. Only applicable if daemonizing. Default is to
use the uid of 1 (daemon on most systems).
\fB\-l\fR, \fB\-\-log\fR
Log to file.
.TP
\fB\-6\fR, \fB\-\-ipv6\fR
Listen on IPv6.
\fB\-A\fR, \fB\-\-abort\fR
Immediately abort on startup (for debug).
.TP
\fB\-v
Show version information.
\fB\-\-noacl
Do not perform any access control checking.
.TP
\fB\-R\fR, \fB\-\-dvbraw\fR
Use rawts file to create virtual adapter.
.TP
\fB\-r\fR, \fB\-\-rawts\fR
Use rawts file to generate virtual services.
.TP
\fB\-j\fR, \fB\-\-join\fR
Subscribe to a service permanently.
.SH "LOGGING"
All activity inside tvheadend is logged to syslog using log facility
\fBLOG_DAEMON\fR.
Expand Down
6 changes: 3 additions & 3 deletions src/htsp_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -1966,12 +1966,12 @@ htsp_serve(int fd, void *opaque, struct sockaddr_storage *source,
* Fire up HTSP server
*/
void
htsp_init(void)
htsp_init(const char *bindaddr)
{
extern int tvheadend_htsp_port_extra;
htsp_server = tcp_server_create(tvheadend_htsp_port, htsp_serve, NULL);
htsp_server = tcp_server_create(bindaddr, tvheadend_htsp_port, htsp_serve, NULL);
if(tvheadend_htsp_port_extra)
htsp_server_2 = tcp_server_create(tvheadend_htsp_port_extra, htsp_serve, NULL);
htsp_server_2 = tcp_server_create(bindaddr, tvheadend_htsp_port_extra, htsp_serve, NULL);
}

/* **************************************************************************
Expand Down
2 changes: 1 addition & 1 deletion src/htsp_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "epg.h"
#include "dvr/dvr.h"

void htsp_init(void);
void htsp_init(const char *bindaddr);

void htsp_channel_update_current(channel_t *ch);

Expand Down
4 changes: 2 additions & 2 deletions src/http.c
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,7 @@ http_serve(int fd, void *opaque, struct sockaddr_storage *peer,
* Fire up HTTP server
*/
void
http_server_init(void)
http_server_init(const char *bindaddr)
{
http_server = tcp_server_create(tvheadend_webui_port, http_serve, NULL);
http_server = tcp_server_create(bindaddr, tvheadend_webui_port, http_serve, NULL);
}
2 changes: 1 addition & 1 deletion src/http.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ http_path_t *http_path_add(const char *path, void *opaque,



void http_server_init(void);
void http_server_init(const char *bindaddr);

int http_access_verify(http_connection_t *hc, int mask);

Expand Down
6 changes: 4 additions & 2 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ main(int argc, char **argv)
*opt_dvb_raw = NULL,
#endif
*opt_rawts = NULL,
*opt_bindaddr = NULL,
*opt_subscribe = NULL;
cmdline_opt_t cmdline_opts[] = {
{ 0, NULL, "Generic Options", OPT_BOOL, NULL },
Expand All @@ -400,6 +401,7 @@ main(int argc, char **argv)
#endif
{ 0, NULL, "Server Connectivity", OPT_BOOL, NULL },
{ '6', "ipv6", "Listen on IPv6", OPT_BOOL, &opt_ipv6 },
{ 'b', "bindaddr", "Specify bind address", OPT_STR, &opt_bindaddr},
{ 0, "http_port", "Specify alternative http port",
OPT_INT, &tvheadend_webui_port },
{ 0, "http_root", "Specify alternative http webroot",
Expand Down Expand Up @@ -625,7 +627,7 @@ main(int argc, char **argv)
#endif

tcp_server_init(opt_ipv6);
http_server_init();
http_server_init(opt_bindaddr);
webui_init();

serviceprobe_init();
Expand All @@ -643,7 +645,7 @@ main(int argc, char **argv)

dvr_init();

htsp_init();
htsp_init(opt_bindaddr);

if(opt_rawts != NULL)
rawts_init(opt_rawts);
Expand Down
12 changes: 9 additions & 3 deletions src/tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ tcp_server_loop(void *aux)
*
*/
void *
tcp_server_create(int port, tcp_server_callback_t *start, void *opaque)
tcp_server_create(const char *bindaddr, int port, tcp_server_callback_t *start, void *opaque)
{
int fd, x;
struct epoll_event e;
Expand All @@ -515,14 +515,19 @@ tcp_server_create(int port, tcp_server_callback_t *start, void *opaque)

memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_flags = AI_PASSIVE;
if (bindaddr != NULL)
hints.ai_flags |= AI_NUMERICHOST;
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;

x = getaddrinfo(NULL, portBuf, &hints, &res);
x = getaddrinfo(bindaddr, portBuf, &hints, &res);
free(portBuf);

if(x != 0)
if(x != 0) {
tvhlog(LOG_ERR, "tcp", "getaddrinfo: %s: %s", bindaddr != NULL ? bindaddr : "*",
x == EAI_SYSTEM ? strerror(errno) : gai_strerror(x));
return NULL;
}

ressave = res;
while(res)
Expand Down Expand Up @@ -553,6 +558,7 @@ tcp_server_create(int port, tcp_server_callback_t *start, void *opaque)

if(x != 0)
{
tvhlog(LOG_ERR, "tcp", "bind: %s: %s", bindaddr != NULL ? bindaddr : "*", strerror(errno));
close(fd);
return NULL;
}
Expand Down
2 changes: 1 addition & 1 deletion src/tcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ typedef void (tcp_server_callback_t)(int fd, void *opaque,
struct sockaddr_storage *peer,
struct sockaddr_storage *self);

void *tcp_server_create(int port, tcp_server_callback_t *start, void *opaque);
void *tcp_server_create(const char *bindaddr, int port, tcp_server_callback_t *start, void *opaque);

int tcp_read(int fd, void *buf, size_t len);

Expand Down

0 comments on commit 290dcb8

Please sign in to comment.