From a02b8baf5d10881abe9c6ea0d3b007d5a1c2d392 Mon Sep 17 00:00:00 2001 From: Obadja Hauser Date: Sun, 11 Dec 2011 01:56:57 +0100 Subject: [PATCH] New commandline options -W for Webaccess and -H for Streamingport --- src/avahi.c | 28 +++++++++++++++++++++++++--- src/avahi.h | 5 ++++- src/htsp.c | 10 ++++++++-- src/htsp.h | 6 +++++- src/http.c | 9 +++++++-- src/http.h | 6 +++++- src/main.c | 39 +++++++++++++++++++++++++++++++++++---- 7 files changed, 89 insertions(+), 14 deletions(-) diff --git a/src/avahi.c b/src/avahi.c index 4dc14f3..39f29a6 100644 --- a/src/avahi.c +++ b/src/avahi.c @@ -55,6 +55,13 @@ static AvahiEntryGroup *group = NULL; static char *name = NULL; +/* + * Modified by obadja.hauser@gmail.com / 20.09.2011 + * Setable PORT for WebUI and HTSP-Streaming + */ +static long wwwport = 9981; +static long htspport = 9982; + static void create_services(AvahiClient *c); static void @@ -131,9 +138,13 @@ create_services(AvahiClient *c) tvhlog(LOG_DEBUG, "AVAHI", "Adding service '%s'", name); /* Add the service for HTSP */ + /* + * Modified by obadja.hauser@gmail.com / 20.09.2011 + * Setable PORT for WebUI and HTSP-Streaming + */ if ((ret = avahi_entry_group_add_service(group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, name, - "_htsp._tcp", NULL, NULL, 9982, + "_htsp._tcp", NULL, NULL, htspport, NULL)) < 0) { if (ret == AVAHI_ERR_COLLISION) @@ -147,9 +158,13 @@ create_services(AvahiClient *c) /* Add the service for HTTP */ + /* + * Modified by obadja.hauser@gmail.com / 20.09.2011 + * Setable PORT for WebUI and HTSP-Streaming + */ if ((ret = avahi_entry_group_add_service(group, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, 0, name, - "_http._tcp", NULL, NULL, 9981, + "_http._tcp", NULL, NULL, wwwport, "path=/", NULL)) < 0) { @@ -264,9 +279,16 @@ avahi_thread(void *aux) /** * */ + /* + * Modified by obadja.hauser@gmail.com / 20.09.2011 + * Setable PORT for WebUI and HTSP-Streaming + */ void -avahi_init(void) +avahi_init(long www_port, long htsp_port) { + if (htsp_port > 0 && htsp_port <= 65536) htspport = htsp_port; + if (www_port > 0 && www_port <= 65536) wwwport = www_port; + pthread_t tid; pthread_create(&tid, NULL, avahi_thread, NULL); diff --git a/src/avahi.h b/src/avahi.h index 891820c..559bb69 100644 --- a/src/avahi.h +++ b/src/avahi.h @@ -1 +1,4 @@ -void avahi_init(void); +/* +/ obadja.hauser@gmail.com +*/ +void avahi_init(long www_port, long htsp_port); diff --git a/src/htsp.c b/src/htsp.c index 8bb803b..bc98a57 100644 --- a/src/htsp.c +++ b/src/htsp.c @@ -1341,10 +1341,16 @@ htsp_serve(int fd, void *opaque, struct sockaddr_in *source, /** * Fire up HTSP server */ + /* + * Modified by obadja.hauser@gmail.com / 20.09.2011 + * Setable PORT for WebUI and HTSP-Streaming + */ + void -htsp_init(void) +htsp_init(long htsp_port) { - htsp_server = tcp_server_create(9982, htsp_serve, NULL); + htsp_server = tcp_server_create(htsp_port, htsp_serve, NULL); + tvhlog(LOG_NOTICE, "START", "Streaming is etablished on Port %d", htsp_port); } /** diff --git a/src/htsp.h b/src/htsp.h index f150ec2..69576a4 100644 --- a/src/htsp.h +++ b/src/htsp.h @@ -22,7 +22,11 @@ #include "epg.h" #include "dvr/dvr.h" -void htsp_init(void); +/* + * Modified by obadja.hauser@gmail.com / 20.09.2011 + * Setable PORT for WebUI and HTSP-Streaming + */ +void htsp_init(long htsp_port); void htsp_channel_update_current(channel_t *ch); diff --git a/src/http.c b/src/http.c index f56f5f2..451a118 100644 --- a/src/http.c +++ b/src/http.c @@ -806,8 +806,13 @@ http_serve(int fd, void *opaque, struct sockaddr_in *peer, /** * Fire up HTTP server */ +/* + * Modified by obadja.hauser@gmail.com / 20.09.2011 + * Setable PORT for WebUI and HTSP-Streaming + */ void -http_server_init(void) +http_server_init(long www_port) { - http_server = tcp_server_create(9981, http_serve, NULL); + http_server = tcp_server_create(www_port, http_serve, NULL); + tvhlog(LOG_NOTICE, "START", "Webaccess is etablished on Port %d", www_port); } diff --git a/src/http.h b/src/http.h index 2a29b8a..0e76dd4 100644 --- a/src/http.h +++ b/src/http.h @@ -133,7 +133,11 @@ http_path_t *http_path_add(const char *path, void *opaque, -void http_server_init(void); +/* + * Modified by obadja.hauser@gmail.com / 20.09.2011 + * Setable PORT for WebUI and HTSP-Streaming + */ +void http_server_init(long www_port); int http_access_verify(http_connection_t *hc, int mask); diff --git a/src/main.c b/src/main.c index 370bb2a..a782115 100644 --- a/src/main.c +++ b/src/main.c @@ -245,11 +245,19 @@ main(int argc, char **argv) char *p, *endp; uint32_t adapter_mask = 0xffffffff; int crash = 0; +/* + * Modified by obadja.hauser@gmail.com / 20.09.2011 + * Setable PORT for WebUI and HTSP-Streaming + */ + uint32_t htsp_port; + uint32_t www_port; + htsp_port = 9982; + www_port = 9981; // make sure the timezone is set tzset(); - while((c = getopt(argc, argv, "Aa:fp:u:g:c:Chdr:j:s")) != -1) { + while((c = getopt(argc, argv, "Aa:fp:u:g:c:Chdr:j:s:H:W:")) != -1) { switch(c) { case 'a': adapter_mask = 0x0; @@ -304,6 +312,16 @@ main(int argc, char **argv) case 'j': join_transport = optarg; break; + /* + * Modified by obadja.hauser@gmail.com / 20.09.2011 + * Setable PORT for WebUI and HTSP-Streaming + */ + case 'H': + htsp_port = atol(optarg); + break; + case 'W': + www_port = atol(optarg); + break; default: usage(argv[0]); } @@ -385,7 +403,12 @@ main(int argc, char **argv) #if ENABLE_V4L v4l_init(); #endif - http_server_init(); + +/* + * Modified by obadja.hauser@gmail.com / 20.09.2011 + * Setable PORT for WebUI and HTSP-Streaming + */ + http_server_init(www_port); webui_init(TVHEADEND_CONTENT_PATH); @@ -399,7 +422,11 @@ main(int argc, char **argv) dvr_init(); - htsp_init(); +/* + * Modified by obadja.hauser@gmail.com / 20.09.2011 + * Setable PORT for WebUI and HTSP-Streaming + */ + htsp_init(htsp_port); ffdecsa_init(); @@ -410,7 +437,11 @@ main(int argc, char **argv) subscription_dummy_join(join_transport, 1); #ifdef CONFIG_AVAHI - avahi_init(); +/* + * Modified by obadja.hauser@gmail.com / 20.09.2011 + * Setable PORT for WebUI and HTSP-Streaming + */ + avahi_init(www_port, htsp_port); #endif pthread_mutex_unlock(&global_lock); -- 1.7.7.1.msysgit.0