Projects
Multimedia
vdr-plugin-mcli
Sign Up
Log In
Username
Password
We truncated the diff of some files because they were too big. If you want to see the full diff for every file,
click here
.
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 2
View file
vdr-plugin-mcli.spec
Changed
@@ -1,11 +1,13 @@ # # spec file for package vdr-plugin-mcli # +# svn co https://svn.baycom.de/repos/vdr-mcli-plugin/ +# tar cj --exclude=.svn -f vdr-mcli-plugin.tar.bz2 vdr-mcli-plugin # # norootforbuild -%define pluginversion 0.9.1 +%define pluginversion 0.9.186 %define pluginname mcli %define pluginurl http://www.baycom.de # @@ -16,7 +18,7 @@ Name: vdr-plugin-mcli Version: %pkgversion -Release: 2 +Release: 0 Source: %plugintarball Source1: sysconfig.vdr-mcli BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -119,6 +121,8 @@ %changelog +* Fri Aug 19 2011 Manfred Tremmel <Manfred.Tremmel@iiv.de> - 0.9.186-0.pm.0 +- update to svn 186 * Sun Jan 16 2011 Manfred Tremmel <Manfred.Tremmel@iiv.de> - 0.9.1-2.pm.0 - update to svn 176 * Sun Jun 20 2010 Manfred Tremmel <Manfred.Tremmel@iiv.de> - 0.9.1-0.pm.3
View file
vdr-mcli-plugin.tar.bz2/README
Changed
@@ -50,4 +50,11 @@ this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +To properly integrate the mcli plugin into your VDR please apply these two +patches: + +vdr-1.6.0-altmenuaction.patch (allows CAM messages to be displayed) +vdr-1.6.0-intcamdevices.patch (enables selection of encrypted channels + without local CI stack). \ No newline at end of file
View file
vdr-mcli-plugin.tar.bz2/device.c
Changed
@@ -89,6 +89,10 @@ DELETENULL (m_PB); } +bool cMcliDevice::Ready() { + return m_mcli ? m_mcli->Ready() : false; +} + void cMcliDevice::SetTenData (tra_t * ten) { if(!ten->lastseen) {
View file
vdr-mcli-plugin.tar.bz2/device.h
Changed
@@ -71,6 +71,7 @@ cMcliFilters *m_filters; cMcliDevice (void); virtual ~ cMcliDevice (); + virtual bool Ready(); void SetMcliRef(cPluginMcli *m) { m_mcli=m;
View file
vdr-mcli-plugin.tar.bz2/mcast/client/api_shm_test.c
Changed
@@ -1,127 +0,0 @@ -/* - * (c) BayCom GmbH, http://www.baycom.de, info@baycom.de - * - * See the COPYING file for copyright information and - * how to reach the author. - * - */ - -#include "headers.h" - - -int main (int argc, char **argv) -{ -#ifdef USE_SHM_API - #define API_WAIT_RESPONSE(cmd) { cmd->state=API_REQUEST; while (cmd->state == API_REQUEST) usleep(10*1000); if (cmd->state == API_ERROR) warn ("SHM parameter error\n");} - - int fd = shm_open (API_SHM_NAMESPACE, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR); - if (fd == -1 ) { - warn ("Cannot get a shared memory handle\n"); - return -1; - } - - if (ftruncate (fd, sizeof(api_cmd_t)) == -1) { - err ("Cannot truncate shared memory\n"); - } - - api_cmd_t *api_cmd = mmap(NULL, sizeof(api_cmd_t), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); - if ( api_cmd == MAP_FAILED ) { - err ("MMap of shared memory region failed\n"); - } - close(fd); -#endif -#ifdef USE_SOCK_API - #define API_WAIT_RESPONSE(cmd) { cmd->state=API_REQUEST; send (sock_comm, &sock_cmd, sizeof(api_cmd_t), 0); recv (sock_comm, &sock_cmd, sizeof(api_cmd_t), 0); if (cmd->state == API_ERROR) warn ("SHM parameter error\n");} - - int sock_comm; - int sock_name_len = 0; - struct sockaddr_un sock_name; - api_cmd_t sock_cmd; - api_cmd_t *api_cmd=&sock_cmd; - sock_name.sun_family = AF_UNIX; - - strcpy(sock_name.sun_path, API_SOCK_NAMESPACE); - sock_name_len = strlen(API_SOCK_NAMESPACE) + sizeof(sock_name.sun_family); - - if((sock_comm = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) - { - warn ("socket create failure %d\n", errno); - return -1; - } - - if (connect(sock_comm, &sock_name, sock_name_len) < 0) { - err ("connect failure\n"); - } -#endif - api_cmd->cmd=API_GET_NC_NUM; - API_WAIT_RESPONSE(api_cmd); - - printf("nc_num: %d\n", api_cmd->parm[API_PARM_NC_NUM]); - int nc_num=api_cmd->parm[API_PARM_NC_NUM]; - int i; - for(i=0;i<nc_num;i++) { - api_cmd->cmd=API_GET_NC_INFO; - api_cmd->parm[API_PARM_NC_NUM]=i; - API_WAIT_RESPONSE(api_cmd); - printf("nc_info.uuid: %s nc_info.lastseen: %u nc_info.tuner_num: %d\n", api_cmd->u.nc_info.uuid, (unsigned int) api_cmd->u.nc_info.lastseen, api_cmd->u.nc_info.tuner_num); - int j; - int tuner_num=api_cmd->u.nc_info.tuner_num; - for(j=0;j<tuner_num;j++) { - api_cmd->cmd=API_GET_TUNER_INFO; - api_cmd->parm[API_PARM_TUNER_NUM]=j; - API_WAIT_RESPONSE(api_cmd); - printf("tuner_info.fe_info.name: %s SatList: %s\n",api_cmd->u.tuner_info.fe_info.name, api_cmd->u.tuner_info.SatelliteListName); - } - - - int sat_list_num=api_cmd->u.nc_info.sat_list_num; - for(j=0;j<sat_list_num;j++) { - api_cmd->cmd=API_GET_SAT_LIST_INFO; - api_cmd->parm[API_PARM_NC_NUM]=i; - api_cmd->parm[API_PARM_SAT_LIST_NUM]=j; - API_WAIT_RESPONSE(api_cmd); - - printf("sat_list_info.Name: %s sat_list_info.sat_num: %d\n", api_cmd->u.sat_list.Name, api_cmd->u.sat_list.sat_num); - - int sat_num=api_cmd->u.sat_list.sat_num; - int k; - for(k=0;k<sat_num;k++) { - api_cmd->cmd=API_GET_SAT_INFO; - api_cmd->parm[API_PARM_SAT_LIST_NUM]=j; - api_cmd->parm[API_PARM_SAT_NUM]=k; - API_WAIT_RESPONSE(api_cmd); - printf("sat_info.Name: %s\n",api_cmd->u.sat_info.Name); - int comp_num=api_cmd->u.sat_info.comp_num; - int l; - for(l=0;l<comp_num;l++) { - api_cmd->cmd=API_GET_SAT_COMP_INFO; - api_cmd->parm[API_PARM_SAT_LIST_NUM]=j; - api_cmd->parm[API_PARM_SAT_NUM]=k; - api_cmd->parm[API_PARM_SAT_COMP_NUM]=l; - API_WAIT_RESPONSE(api_cmd); - printf("sat_comp.Polarisation: %d sat_comp.RangeMin: %d sat_comp.RangeMax: %d sat_comp.LOF: %d\n", api_cmd->u.sat_comp.Polarisation, api_cmd->u.sat_comp.RangeMin, api_cmd->u.sat_comp.RangeMax, api_cmd->u.sat_comp.LOF); - } - } - } - } - - while (1) { - api_cmd->cmd=API_GET_TRA_NUM; - API_WAIT_RESPONSE(api_cmd); - - printf("tra_num: %d\n", api_cmd->parm[API_PARM_TRA_NUM]); - int tra_num=api_cmd->parm[API_PARM_TRA_NUM]; - for(i=0;i<tra_num;i++) { - api_cmd->cmd=API_GET_TRA_INFO; - api_cmd->parm[API_PARM_TRA_NUM]=i; - API_WAIT_RESPONSE(api_cmd); - char host[INET6_ADDRSTRLEN]; - inet_ntop (AF_INET6, &api_cmd->u.tra.mcg, (char *) host, INET6_ADDRSTRLEN); - - printf("tra.slot:%d tra.fe_type: %d tra.InUse: % 3d tra.mcg: %s tra.uuid: %s tra.lastseen: %u tra.lock:%d tra.strength:%d tra.snr:%d tra.ber:%d\n", api_cmd->u.tra.slot, api_cmd->u.tra.fe_type, api_cmd->u.tra.InUse, host, api_cmd->u.tra.uuid, (unsigned int) api_cmd->u.tra.lastseen, api_cmd->u.tra.s.st, api_cmd->u.tra.s.strength, api_cmd->u.tra.s.snr, api_cmd->u.tra.s.ber); - } - sleep(2); - } - return 0; -} - +(symlink to api_test.c)
View file
vdr-mcli-plugin.tar.bz2/mcast/client/api_sock_test.c
Changed
@@ -1,127 +0,0 @@ -/* - * (c) BayCom GmbH, http://www.baycom.de, info@baycom.de - * - * See the COPYING file for copyright information and - * how to reach the author. - * - */ - -#include "headers.h" - - -int main (int argc, char **argv) -{ -#ifdef USE_SHM_API - #define API_WAIT_RESPONSE(cmd) { cmd->state=API_REQUEST; while (cmd->state == API_REQUEST) usleep(10*1000); if (cmd->state == API_ERROR) warn ("SHM parameter error\n");} - - int fd = shm_open (API_SHM_NAMESPACE, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR); - if (fd == -1 ) { - warn ("Cannot get a shared memory handle\n"); - return -1; - } - - if (ftruncate (fd, sizeof(api_cmd_t)) == -1) { - err ("Cannot truncate shared memory\n"); - } - - api_cmd_t *api_cmd = mmap(NULL, sizeof(api_cmd_t), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); - if ( api_cmd == MAP_FAILED ) { - err ("MMap of shared memory region failed\n"); - } - close(fd); -#endif -#ifdef USE_SOCK_API - #define API_WAIT_RESPONSE(cmd) { cmd->state=API_REQUEST; send (sock_comm, &sock_cmd, sizeof(api_cmd_t), 0); recv (sock_comm, &sock_cmd, sizeof(api_cmd_t), 0); if (cmd->state == API_ERROR) warn ("SHM parameter error\n");} - - int sock_comm; - int sock_name_len = 0; - struct sockaddr_un sock_name; - api_cmd_t sock_cmd; - api_cmd_t *api_cmd=&sock_cmd; - sock_name.sun_family = AF_UNIX; - - strcpy(sock_name.sun_path, API_SOCK_NAMESPACE); - sock_name_len = strlen(API_SOCK_NAMESPACE) + sizeof(sock_name.sun_family); - - if((sock_comm = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) - { - warn ("socket create failure %d\n", errno); - return -1; - } - - if (connect(sock_comm, &sock_name, sock_name_len) < 0) { - err ("connect failure\n"); - } -#endif - api_cmd->cmd=API_GET_NC_NUM; - API_WAIT_RESPONSE(api_cmd); - - printf("nc_num: %d\n", api_cmd->parm[API_PARM_NC_NUM]); - int nc_num=api_cmd->parm[API_PARM_NC_NUM]; - int i; - for(i=0;i<nc_num;i++) { - api_cmd->cmd=API_GET_NC_INFO; - api_cmd->parm[API_PARM_NC_NUM]=i; - API_WAIT_RESPONSE(api_cmd); - printf("nc_info.uuid: %s nc_info.lastseen: %u nc_info.tuner_num: %d\n", api_cmd->u.nc_info.uuid, (unsigned int) api_cmd->u.nc_info.lastseen, api_cmd->u.nc_info.tuner_num); - int j; - int tuner_num=api_cmd->u.nc_info.tuner_num; - for(j=0;j<tuner_num;j++) { - api_cmd->cmd=API_GET_TUNER_INFO; - api_cmd->parm[API_PARM_TUNER_NUM]=j; - API_WAIT_RESPONSE(api_cmd); - printf("tuner_info.fe_info.name: %s SatList: %s\n",api_cmd->u.tuner_info.fe_info.name, api_cmd->u.tuner_info.SatelliteListName); - } - - - int sat_list_num=api_cmd->u.nc_info.sat_list_num; - for(j=0;j<sat_list_num;j++) { - api_cmd->cmd=API_GET_SAT_LIST_INFO; - api_cmd->parm[API_PARM_NC_NUM]=i; - api_cmd->parm[API_PARM_SAT_LIST_NUM]=j; - API_WAIT_RESPONSE(api_cmd); - - printf("sat_list_info.Name: %s sat_list_info.sat_num: %d\n", api_cmd->u.sat_list.Name, api_cmd->u.sat_list.sat_num); - - int sat_num=api_cmd->u.sat_list.sat_num; - int k; - for(k=0;k<sat_num;k++) { - api_cmd->cmd=API_GET_SAT_INFO; - api_cmd->parm[API_PARM_SAT_LIST_NUM]=j; - api_cmd->parm[API_PARM_SAT_NUM]=k; - API_WAIT_RESPONSE(api_cmd); - printf("sat_info.Name: %s\n",api_cmd->u.sat_info.Name); - int comp_num=api_cmd->u.sat_info.comp_num; - int l; - for(l=0;l<comp_num;l++) { - api_cmd->cmd=API_GET_SAT_COMP_INFO; - api_cmd->parm[API_PARM_SAT_LIST_NUM]=j; - api_cmd->parm[API_PARM_SAT_NUM]=k; - api_cmd->parm[API_PARM_SAT_COMP_NUM]=l; - API_WAIT_RESPONSE(api_cmd); - printf("sat_comp.Polarisation: %d sat_comp.RangeMin: %d sat_comp.RangeMax: %d sat_comp.LOF: %d\n", api_cmd->u.sat_comp.Polarisation, api_cmd->u.sat_comp.RangeMin, api_cmd->u.sat_comp.RangeMax, api_cmd->u.sat_comp.LOF); - } - } - } - } - - while (1) { - api_cmd->cmd=API_GET_TRA_NUM; - API_WAIT_RESPONSE(api_cmd); - - printf("tra_num: %d\n", api_cmd->parm[API_PARM_TRA_NUM]); - int tra_num=api_cmd->parm[API_PARM_TRA_NUM]; - for(i=0;i<tra_num;i++) { - api_cmd->cmd=API_GET_TRA_INFO; - api_cmd->parm[API_PARM_TRA_NUM]=i; - API_WAIT_RESPONSE(api_cmd); - char host[INET6_ADDRSTRLEN]; - inet_ntop (AF_INET6, &api_cmd->u.tra.mcg, (char *) host, INET6_ADDRSTRLEN); - - printf("tra.slot:%d tra.fe_type: %d tra.InUse: % 3d tra.mcg: %s tra.uuid: %s tra.lastseen: %u tra.lock:%d tra.strength:%d tra.snr:%d tra.ber:%d\n", api_cmd->u.tra.slot, api_cmd->u.tra.fe_type, api_cmd->u.tra.InUse, host, api_cmd->u.tra.uuid, (unsigned int) api_cmd->u.tra.lastseen, api_cmd->u.tra.s.st, api_cmd->u.tra.s.strength, api_cmd->u.tra.s.snr, api_cmd->u.tra.s.ber); - } - sleep(2); - } - return 0; -} - +(symlink to api_test.c)
View file
vdr-mcli-plugin.tar.bz2/mcast/client/ci_handler.c
Changed
@@ -121,7 +121,11 @@ pthread_cleanup_push (clean_ci_recv_thread, c); c->rxdata = (u_int8_t *) malloc (CA_TPDU_MAX + 2); + if (!c->rxdata) + err ("ci_recv: out of memory\n"); c->txdata = (u_int8_t *) malloc (CA_TPDU_MAX + 2); + if (!c->txdata) + err ("ci_recv: out of memory\n"); if (c->rxdata && c->txdata) { c->recv_run = 1; @@ -201,7 +205,8 @@ static ci_dev_t *ci_add (void) { ci_dev_t *c = (ci_dev_t *) malloc (sizeof (ci_dev_t)); - + if (!c) + return NULL; memset (c, 0, sizeof (ci_dev_t)); dvbmc_list_add_head (&devs.list, &c->list); return c;
View file
vdr-mcli-plugin.tar.bz2/mcast/client/ciparser.c
Changed
@@ -1,691 +0,0 @@ -/* - * (c) BayCom GmbH, http://www.baycom.de, info@baycom.de - * - * See the COPYING file for copyright information and - * how to reach the author. - * - */ - -//#define TESTING -#ifdef TESTING -#include <stdio.h> -#include <unistd.h> -#include <string.h> -#include <netinet/in.h> -#include <stdlib.h> - -#include "ciparser.h" -static unsigned char ll[] = { 0x00, 0x01, 0xA0, 0x28, 0x01, 0x90, 0x02, 0x00, 0x05, 0x9F, 0x80, 0x32, 0x1F, 0x03, 0x32, 0xC9, 0x01, 0x00, 0x0F, 0x01, 0x09, 0x06, 0x17, 0x62, 0xE0, 0x65, 0x00, 0x09, 0x09, 0x04, 0x17, 0x02, 0xE1, 0x2D, 0x02, 0x00, 0xA0, 0x00, 0x00, 0x04, 0x00, 0xA1, 0x00, 0x00 }; -static unsigned char lr[] = { 0x00, 0x01, 0x80, 0x02, 0x01, 0x80 }; -static unsigned char la[] = { 0x00, 0x01, 0xA0, 0x07, 0x01, 0x91, 0x04, 0x00, 0x01, 0x00, 0x41, 0x80, 0x02, 0x01, 0x00 }; -static unsigned char lb[] = { 0x00, 0x01, 0xA0, 0x82, 0x00, 0x17, 0x01, 0x90, 0x02, 0x00, 0x03, 0x9F, 0x80, 0x31, 0x0E, 0x06, 0x02, 0x06, 0x02, 0x17, 0x02, 0x17, 0x62, 0x01, 0x00, 0x05, 0x00, 0x18, 0x00, 0x80, 0x02, 0x01, 0x00 }; -static unsigned char lc[] = { 0x01, 0x02, 0xA0, 0x5F, 0x02, 0x90, 0x02, 0x00, 0x06, 0x9F, 0x80, 0x32, 0x56, 0x03, 0x03, 0x8B, 0x01, 0x00, 0x00, 0x02, 0x00, 0xA3, 0x00, 0x23, 0x01, 0x09, 0x0F, 0x05, 0x00, 0xE2, 0xC3, 0x10, 0x01, 0x00, 0x13, 0x01, 0x20, 0x14, 0x03, 0x00, 0x94, 0x0D, 0x09, 0x0F, 0x05, 0x00, 0xE2, 0xCD, 0x10, 0x01, 0x00, 0x13, 0x01, 0x20, 0x14, 0x03, 0x02, 0x38, 0x08, 0x04, 0x00, 0x5C, 0x00, 0x23, 0x01, 0x09, 0x0F, 0x05, 0x00, 0xE2, 0xC3, 0x10, 0x01, 0x00, 0x13, 0x01, 0x20, 0x14, 0x03, 0x00, 0x94, 0x0D, 0x09, 0x0F, 0x05, 0x00, 0xE2, 0xCD, 0x10, 0x01, 0x00, 0x13, 0x01, 0x20, 0x14, 0x03, 0x02, 0x38, 0x08 }; -static unsigned char ld[] = { 0x00, 0x01, 0xA0, 0x82, 0x00, 0x10, 0x01, 0x90, 0x02, 0x00, 0x03, 0x9F, 0x80, 0x33, 0x07, 0x2D, 0xB9, 0x01, 0x81, 0x00, 0x08, 0x00, 0x80, 0x02, 0x01, 0x00 }; -static unsigned char le[] = { 0x00, 0x01, 0xA0, 0x34, 0x01, 0x90, 0x02, 0x00, 0x03, 0x9F, 0x80, 0x32, 0x2B, 0x03, 0x00, 0x0B, 0x01, 0x00, 0x11, 0x01, 0x09, 0x06, 0x17, 0x22, 0xF0, 0x0B, 0x00, 0x0B, 0x09, 0x06, 0x17, 0x02, 0xF0, 0x0B, 0x00, 0x0B, 0x02, 0x06, 0xFF, 0x00, 0x00, 0x04, 0x07, 0x00, 0x00, 0x00, 0x04, 0x07, 0x01, 0x00, 0x00, 0x00, 0x07, 0x03, 0x00, 0x00}; - -#define dbg(format, arg...) printf("%s:%d " format , __FILE__ , __LINE__ , ## arg) -#define err(format, arg...) {printf("err:%s:%d: %s (%d): " format , __FILE__ , __LINE__ ,strerror(errno), errno, ## arg);print_trace();abort();} -#define info(format, arg...) printf("%s:%d: " format , __FILE__ , __LINE__ ,## arg) -#define warn(format, arg...) printf("%s:%d: " format , __FILE__ , __LINE__ ,## arg) -#define STATIC -#else -//#define DEBUG -#include "headers.h" -#endif - -#define CA_MAX_CAIDS 16 -#define CA_MAX_PIDS 16 -#ifndef CA_MAX_SLOTS -#define CA_MAX_SLOTS 3 -#endif -typedef struct -{ - u_int16_t caid[CA_MAX_CAIDS]; - u_int16_t pid[CA_MAX_PIDS]; - u_int16_t capid[CA_MAX_PIDS]; -} caid_pid_list_t; - -static caid_pid_list_t cpl[CA_MAX_SLOTS]; - -STATIC void dump(u_int8_t *data, int len) -{ -#ifdef DEBUG - int j; - printf("Dump: "); - for(j=0;j<len;j++) { - printf("%02x ",data[j]); - } - printf("\n"); -#endif -} - -STATIC int ci_cpl_find_pid (int slot, int pid) -{ - if (slot < 0 || slot >= CA_MAX_SLOTS) { - return -1; - } - int i; - for (i = 0; i < CA_MAX_PIDS; i++) { - if (pid == cpl[slot].pid[i]) - return 1; - } - return 0; -} - -STATIC int ci_cpl_find_caid (int slot, int caid) -{ - if (slot < 0 || slot >= CA_MAX_SLOTS) { - return -1; - } - int i; - for (i = 0; i < CA_MAX_CAIDS; i++) { - if (caid == cpl[slot].caid[i]) - return 1; - } - return 0; -} - -STATIC int ci_cpl_find_capid (int slot, int pid) -{ - if (slot < 0 || slot >= CA_MAX_SLOTS) { - return -1; - } - int i; - for (i = 0; i < CA_MAX_PIDS; i++) { - if (pid == cpl[slot].capid[i]) - return 1; - } - return 0; -} - -STATIC int ci_cpl_delete_pid (int slot, int pid) -{ - if (slot < 0 || slot >= CA_MAX_SLOTS) { - return -1; - } - int i; - for (i = 0; i < CA_MAX_PIDS; i++) { - if (cpl[slot].pid[i]==pid) { - cpl[slot].pid[i] = 0; - dbg ("-------> Slot: %d Deleted pid: %04x\n", slot, pid); - return 1; - } - } - return 0; -} - -STATIC int ci_cpl_update_pid (int slot, int pid) -{ - if (slot < 0 || slot >= CA_MAX_SLOTS) { - return -1; - } - if (!ci_cpl_find_pid (slot, pid)) { - int i; - for (i = 0; i < CA_MAX_PIDS; i++) { - if (!cpl[slot].pid[i]) { - cpl[slot].pid[i] = pid; - dbg ("-------> Slot: %d Added pid: %04x\n", slot, pid); - return 1; - } - } - } - return 0; -} - -STATIC int ci_cpl_update_caid (int slot, int caid) -{ - if (slot < 0 || slot >= CA_MAX_SLOTS) { - return -1; - } - if (!ci_cpl_find_caid (slot, caid)) { - int i; - for (i = 0; i < CA_MAX_CAIDS; i++) { - if (!cpl[slot].caid[i]) { - cpl[slot].caid[i] = caid; - dbg ("-------> Slot: %d Added caid: %04x\n", slot, caid); - return 1; - } - } - } - return 0; -} - -STATIC int ci_cpl_update_capid (int slot, int capid) -{ - if (slot < 0 || slot >= CA_MAX_SLOTS) { - return -1; - } - if (!ci_cpl_find_capid (slot, capid)) { - int i; - for (i = 0; i < CA_MAX_PIDS; i++) { - if (!cpl[slot].capid[i]) { - cpl[slot].capid[i] = capid; - dbg ("-------> Slot: %d Added capid: %04x\n", slot, capid); - return 1; - } - } - } - return 0; -} - -int ci_cpl_find_caid_by_pid (int pid) -{ - int i; - int slot; - - if(!pid) { - return 0; - } - for (slot = 0; slot < CA_MAX_SLOTS; slot++) { - for (i = 0; i < CA_MAX_PIDS; i++) { - if (pid == cpl[slot].pid[i]) { - return cpl[slot].caid[0]; - } - } - } - return 0; -} - -int ci_cpl_find_slot_by_caid_and_pid (int caid, int pid) -{ - int slot; - for (slot = 0; slot < CA_MAX_SLOTS; slot++) { - if (ci_cpl_find_pid (slot, pid) && ci_cpl_find_caid (slot, caid)) { - return slot; - } - } - return -1; -} - +(symlink to ../common/ciparser.c)
View file
vdr-mcli-plugin.tar.bz2/mcast/client/dummy_client.c
Changed
@@ -44,7 +44,7 @@ dvb_pid_t pids[3]; netceiver_info_list_t *nc_list=nc_get_list(); - +#if 0 printf("Looking for netceivers out there....\n"); while(run) { nc_lock_list(); @@ -61,7 +61,7 @@ } sleep(1); } - +#endif f=fopen("out.ts","wb"); r = recv_add(); @@ -86,7 +86,11 @@ memset(&pids, 0, sizeof(pids)); pids[0].pid=511; pids[1].pid=512; - pids[2].pid=-1; + pids[2].pid=511; + pids[2].id=2; + pids[3].pid=511; + pids[3].id=1; + pids[4].pid=-1; printf("\nTuning a station and writing transport data to file 'out.ts':\n"); recv_tune (r, (fe_type_t)FE_QPSK, 1800+192, &sec, &fep, pids);
View file
vdr-mcli-plugin.tar.bz2/mcast/client/dvblo_handler.c
Changed
@@ -453,6 +453,8 @@ { dvblo_dev_t *d = (dvblo_dev_t *) malloc (sizeof (dvblo_dev_t)); + if (!d) + return NULL; memset (d, 0, sizeof (dvblo_dev_t)); dvbmc_list_add_head (&devs.list, &d->list); return d; @@ -630,7 +632,7 @@ strcpy (d->uuid, nci->tuner[i].uuid); if (!cmd.reelcammode) { if (cidev < CA_MAX_SLOTS && (cmd.ca_enable & (1 << dev_num))) { - d->cacaps=(dvblo_cacaps_t*) &nci->ci; + d->cacaps=(dvblo_cacaps_t*)((void *) &nci->ci); d->ca_enable = 1; dbg ("Enabling CA support for device %d\n", dev_num); char addrstr[INET6_ADDRSTRLEN]; @@ -655,7 +657,7 @@ d->ca_enable = 1; dbg ("Enabling CA support for device %d\n", dev_num); if (!cidev) { - d->cacaps = (dvblo_cacaps_t*) &nci->ci; + d->cacaps = (dvblo_cacaps_t*)((void *) &nci->ci); char addrstr[INET6_ADDRSTRLEN]; dvblo_get_nc_addr (addrstr, d->uuid); dbg ("dvblo_get_nc_addr: %s %s\n", addrstr, d->uuid);
View file
vdr-mcli-plugin.tar.bz2/mcast/client/inet_aton.c
Changed
@@ -1,55 +0,0 @@ -/* - * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan - * (Royal Institute of Technology, Stockholm, Sweden). - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* $Id: inet_aton.c,v 1.6 2003/11/16 09:36:49 guy Exp $ */ - -#include "defs.h" - -/* Minimal implementation of inet_aton. - * Cannot distinguish between failure and a local broadcast address. */ - -#ifndef INADDR_NONE -#define INADDR_NONE 0xffffffff -#endif - -int -inet_aton(const char *cp, struct in_addr *addr) -{ - addr->s_addr = inet_addr(cp); - return (addr->s_addr == INADDR_NONE) ? 0 : 1; -} +(symlink to ../common/win32/inet_aton.c)
View file
vdr-mcli-plugin.tar.bz2/mcast/client/inet_ntop.c
Changed
@@ -1,211 +0,0 @@ -/* - * Copyright (c) 1999 Kungliga Tekniska Högskolan - * (Royal Institute of Technology, Stockholm, Sweden). - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* $Id: inet_ntop.c,v 1.8 2005/02/09 02:25:46 guy Exp $ */ - -#include "defs.h" - -/* - * - */ - -#ifndef IN6ADDRSZ -#define IN6ADDRSZ 16 /* IPv6 T_AAAA */ -#endif - -#ifndef INT16SZ -#define INT16SZ 2 /* word size */ -#endif - -static const char * -inet_ntop_v4 (const void *src, char *dst, size_t size) -{ - const char digits[] = "0123456789"; - int i; - struct in_addr *addr = (struct in_addr *)src; - u_long a = ntohl(addr->s_addr); - const char *orig_dst = dst; - - if (size < INET_ADDRSTRLEN) { - errno = ENOSPC; - return NULL; - } - for (i = 0; i < 4; ++i) { - int n = (a >> (24 - i * 8)) & 0xFF; - int non_zerop = 0; - - if (non_zerop || n / 100 > 0) { - *dst++ = digits[n / 100]; - n %= 100; - non_zerop = 1; - } - if (non_zerop || n / 10 > 0) { - *dst++ = digits[n / 10]; - n %= 10; - non_zerop = 1; - } - *dst++ = digits[n]; - if (i != 3) - *dst++ = '.'; - } - *dst++ = '\0'; - return orig_dst; -} - -#ifdef INET6 -/* - * Convert IPv6 binary address into presentation (printable) format. - */ -static const char * -inet_ntop_v6 (const u_char *src, char *dst, size_t size) -{ - /* - * Note that int32_t and int16_t need only be "at least" large enough - * to contain a value of the specified size. On some systems, like - * Crays, there is no such thing as an integer variable with 16 bits. - * Keep this in mind if you think this function should have been coded - * to use pointer overlays. All the world's not a VAX. - */ - char tmp [INET6_ADDRSTRLEN+1]; - char *tp; - struct { - long base; - long len; - } best, cur; - u_long words [IN6ADDRSZ / INT16SZ]; - int i; - - /* Preprocess: - * Copy the input (bytewise) array into a wordwise array. - * Find the longest run of 0x00's in src[] for :: shorthanding. - */ - memset (words, 0, sizeof(words)); - for (i = 0; i < IN6ADDRSZ; i++) - words[i/2] |= (src[i] << ((1 - (i % 2)) << 3)); - - best.base = -1; - cur.base = -1; - for (i = 0; i < (IN6ADDRSZ / INT16SZ); i++) - { - if (words[i] == 0) - { - if (cur.base == -1) - cur.base = i, cur.len = 1; - else cur.len++; - } - else if (cur.base != -1) - { - if (best.base == -1 || cur.len > best.len) - best = cur; - cur.base = -1; - } - } - if ((cur.base != -1) && (best.base == -1 || cur.len > best.len)) - best = cur; - if (best.base != -1 && best.len < 2) - best.base = -1; - - /* Format the result. - */ - tp = tmp; - for (i = 0; i < (IN6ADDRSZ / INT16SZ); i++) - { - /* Are we inside the best run of 0x00's? - */ - if (best.base != -1 && i >= best.base && i < (best.base + best.len)) - { - if (i == best.base) - *tp++ = ':'; - continue; - } - - /* Are we following an initial run of 0x00s or any real hex? - */ - if (i != 0) - *tp++ = ':'; - - /* Is this address an encapsulated IPv4? - */ - if (i == 6 && best.base == 0 && - (best.len == 6 || (best.len == 5 && words[5] == 0xffff))) - { - if (!inet_ntop_v4(src+12, tp, sizeof(tmp) - (tp - tmp))) - { - errno = ENOSPC; - return (NULL); - } - tp += strlen(tp); - break; - } - tp += sprintf (tp, "%lX", words[i]); - } - - /* Was it a trailing run of 0x00's? - */ - if (best.base != -1 && (best.base + best.len) == (IN6ADDRSZ / INT16SZ)) - *tp++ = ':'; - *tp++ = '\0'; - - /* Check for overflow, copy, and we're done. - */ - if ((size_t)(tp - tmp) > size) - { - errno = ENOSPC; - return (NULL); - } - return strcpy (dst, tmp); - return (NULL); -} -#endif /* INET6 */ - - -const char * -inet_ntop(int af, const void *src, char *dst, size_t size) -{ +(symlink to ../common/win32/inet_ntop.c)
View file
vdr-mcli-plugin.tar.bz2/mcast/client/inet_pton.c
Changed
@@ -1,59 +0,0 @@ -/* - * Copyright (c) 1999 Kungliga Tekniska Högskolan - * (Royal Institute of Technology, Stockholm, Sweden). - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the Kungliga Tekniska - * Högskolan and its contributors. - * - * 4. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* $Id: inet_pton.c,v 1.6 2003/11/16 09:36:51 guy Exp $ */ - -#include "defs.h" - -int -inet_pton(int af, const char *src, void *dst) -{ - if (af == AF_INET6) { - struct sockaddr_storage ss; - int sslen = sizeof(ss); - int ret; - ret=WSAStringToAddressA((LPSTR)src, AF_INET6, NULL, (struct sockaddr*)&ss, &sslen); - memcpy(dst, &((struct sockaddr_in6 *)&ss)->sin6_addr, sizeof(struct in6_addr)); - return ret; - } - if (af != AF_INET) { - errno = EAFNOSUPPORT; - return -1; - } - return inet_aton (src, (struct in_addr *)dst); -} +(symlink to ../common/win32/inet_pton.c)
View file
vdr-mcli-plugin.tar.bz2/mcast/client/input.c
Changed
@@ -9,6 +9,10 @@ #include "headers.h" #define CI_RESET_WAIT 10 +#ifdef __MINGW32__ +#include <getopt.h> +#endif + cmdline_t cmd; //--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
View file
vdr-mcli-plugin.tar.bz2/mcast/client/interfaces.c
Changed
@@ -1,339 +0,0 @@ -/* - * (c) BayCom GmbH, http://www.baycom.de, info@baycom.de - * - * See the COPYING file for copyright information and - * how to reach the author. - * - */ - -#include "headers.h" - -void int_destroy (struct intnode *intn) -{ - dbg ("Destroying interface %s\n", intn->name); - - /* Resetting the MTU to zero disabled the interface */ - intn->mtu = 0; -} - -struct intnode *int_find (unsigned int ifindex) -{ - unsigned int i; - for (i = 0; i < g_conf->maxinterfaces; i++) { - if(g_conf->ints[i].ifindex == ifindex) { - return g_conf->ints+i; - } - } - return NULL; -} - -struct intnode *int_find_name (char *ifname) -{ - unsigned int i; - for (i = 0; i < g_conf->maxinterfaces; i++) { - if (!strcmp (ifname, g_conf->ints[i].name) && g_conf->ints[i].mtu != 0) { - return g_conf->ints+i; - } - } - return NULL; -} - - -struct intnode *int_find_first (void) -{ - unsigned int i; - for (i = 0; i < g_conf->maxinterfaces; i++) { - dbg("int: %d %s\n",i, g_conf->ints[i].name); - if (g_conf->ints[i].mtu != 0) { - return g_conf->ints+i; - } - } - return NULL; -} - -//----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -#if ! (defined WIN32 || defined APPLE) || defined __CYGWIN__ - -/* Initiliaze interfaces */ -void update_interfaces (struct intnode *intn) -{ - struct in6_addr addr; - - FILE *file; - unsigned int prefixlen, scope, flags, ifindex; - char devname[IFNAMSIZ]; - - /* Only update every 5 seconds to avoid rerunning it every packet */ - if (g_conf->maxinterfaces) - return; - - dbg ("Updating Interfaces\n"); - - /* Get link local addresses from /proc/net/if_inet6 */ - file = fopen ("/proc/net/if_inet6", "r"); - - /* We can live without it though */ - if (!file) { - err ("Cannot open /proc/net/if_inet6\n"); - return; - } - - char buf[255]; - /* Format "fe80000000000000029027fffe24bbab 02 0a 20 80 eth0" */ - while (fgets (buf, sizeof (buf), file)) { - if (21 != sscanf (buf, "%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx %x %x %x %x %8s", &addr.s6_addr[0], &addr.s6_addr[1], &addr.s6_addr[2], &addr.s6_addr[3], &addr.s6_addr[4], &addr.s6_addr[5], &addr.s6_addr[6], &addr.s6_addr[7], &addr.s6_addr[8], &addr.s6_addr[9], &addr.s6_addr[10], &addr.s6_addr[11], &addr.s6_addr[12], &addr.s6_addr[13], &addr.s6_addr[14], &addr.s6_addr[15], &ifindex, &prefixlen, &scope, &flags, devname)) { - - warn ("/proc/net/if_inet6 in wrong format!\n"); - continue; - } - if (!IN6_IS_ADDR_LINKLOCAL (&addr) && (IN6_IS_ADDR_UNSPECIFIED (&addr) || IN6_IS_ADDR_LOOPBACK (&addr) || IN6_IS_ADDR_MULTICAST (&addr))) { - continue; - } - - if((intn=int_find(ifindex))==NULL) { - g_conf->ints=(struct intnode*)realloc(g_conf->ints, sizeof(struct intnode)*(++g_conf->maxinterfaces)); - if (!g_conf->ints) { - err ("Cannot get memory for interface structures.\n"); - } - intn=g_conf->ints+g_conf->maxinterfaces-1; - memset(intn, 0, sizeof(struct intnode)); - } -#ifdef WIN32 - // Ugly WINXP workaround - if(scope==0x20 && flags==0x80) { - intn->mtu=1480; - } else { - intn->mtu=0; - } -#else - intn->ifindex = ifindex; - strcpy(intn->name, devname); - - struct ifreq ifreq; - int sock; - sock = socket (AF_INET6, SOCK_DGRAM, 0); - if (sock < 0) { - err ("Cannot get socket for setup\n"); - } - - memcpy (&ifreq.ifr_name, &intn->name, sizeof (ifreq.ifr_name)); - /* Get the MTU size of this interface */ - /* We will use that for fragmentation */ - if (ioctl (sock, SIOCGIFMTU, &ifreq) != 0) { - warn ("Cannot get MTU size for %s index %d: %s\n", intn->name, intn->ifindex, strerror (errno)); - } - intn->mtu = ifreq.ifr_mtu; - - /* Get hardware address + type */ - if (ioctl (sock, SIOCGIFHWADDR, &ifreq) != 0) { - warn ("Cannot get hardware address for %s, interface index %d : %s\n", intn->name, intn->ifindex, strerror (errno)); - } - intn->hwaddr = ifreq.ifr_hwaddr; - close (sock); -#endif - /* Link Local IPv6 address ? */ - if (IN6_IS_ADDR_LINKLOCAL (&addr)) { - /* Update the linklocal address */ - intn->linklocal = addr; - } else { - intn->global = addr; - } - - dbg ("Available interface %s index %u hardware %s/%u MTU %d\n", intn->name, intn->ifindex, (intn->hwaddr.sa_family == ARPHRD_ETHER ? "Ethernet" : (intn->hwaddr.sa_family == ARPHRD_SIT ? "sit" : "Unknown")), intn->hwaddr.sa_family, intn->mtu); - } - - fclose (file); -} -#endif -#if defined WIN32 && ! defined __CYGWIN__ - -unsigned int if_nametoindex (const char *ifname) -{ - unsigned int ifindex; - for (ifindex = 0; ifindex < g_conf->maxinterfaces; ifindex++) { - if (!strcmp (ifname, g_conf->ints[ifindex].name) && g_conf->ints[ifindex].mtu != 0) { - return g_conf->ints[ifindex].ifindex; - } - } - return 0; -} - -void update_interfaces (struct intnode *intn) -{ - - /* Declare and initialize variables */ - - DWORD dwRetVal = 0; - - int i = 0; - - // Set the flags to pass to GetAdaptersAddresses - ULONG flags = GAA_FLAG_INCLUDE_PREFIX; - - // default to unspecified address family (both) - ULONG family = AF_INET6; - - PIP_ADAPTER_ADDRESSES pAddresses = NULL; - ULONG outBufLen = 0; - - PIP_ADAPTER_ADDRESSES pCurrAddresses = NULL; - PIP_ADAPTER_UNICAST_ADDRESS pUnicast = NULL; - - outBufLen = sizeof (IP_ADAPTER_ADDRESSES); - pAddresses = (IP_ADAPTER_ADDRESSES *) malloc (outBufLen); - if (pAddresses == NULL) { - printf ("Memory allocation failed for IP_ADAPTER_ADDRESSES struct\n"); - exit (1); - } - // Make an initial call to GetAdaptersAddresses to get the - // size needed into the outBufLen variable - if (GetAdaptersAddresses (family, flags, NULL, pAddresses, &outBufLen) == ERROR_BUFFER_OVERFLOW) { - free (pAddresses); - pAddresses = (IP_ADAPTER_ADDRESSES *) malloc (outBufLen); - } - - if (pAddresses == NULL) { - printf ("Memory allocation failed for IP_ADAPTER_ADDRESSES struct\n"); - exit (1); - } - +(symlink to ../common/interfaces.c)
View file
vdr-mcli-plugin.tar.bz2/mcast/client/main.c
Changed
@@ -20,11 +20,15 @@ printf ("DVB - TV Client Version " MCLI_VERSION_STR " (c) BayCom GmbH\n\n"); //#if (defined WIN32 || defined APPLE) #ifdef WIN32 +#ifndef __MINGW32__ cmdline_t cmd; cmd.iface[0]=0; cmd.port=0; cmd.mld_start=1; #else + get_options (argc, argv); +#endif +#else #ifdef BACKTRACE signal(SIGSEGV, SignalHandlerCrash); signal(SIGBUS, SignalHandlerCrash);
View file
vdr-mcli-plugin.tar.bz2/mcast/client/mcast.c
Changed
@@ -1,657 +0,0 @@ -/* - * (c) BayCom GmbH, http://www.baycom.de, info@baycom.de - * - * See the COPYING file for copyright information and - * how to reach the author. - * - * modified by Reel Multimedia, http://www.reel-multimedia.com, info@reel-multimedia.com - * 01042010 DL: use a single thread for reading from network layer (uses less resources) - * - */ - -#include "headers.h" - -//---------------------------------------------------------------------------------------------------------------------------------- -STATIC int udp_ipv6_is_multicast_address (const struct sockaddr *addr) -{ -#ifdef IPV4 - if (addr->sa_family == AF_INET) - return IN_MULTICAST (ntohl (((struct sockaddr_in *) addr)->sin_addr.s_addr)); -#endif - if (addr->sa_family == AF_INET6) - return IN6_IS_ADDR_MULTICAST (&((struct sockaddr_in6 *) addr)->sin6_addr); - return -1; -} - -//--------------------------------------------------------------------------------------------------------------------------------- -STATIC int udp_ipv6_set_multicast_ttl (SOCKET sockfd, int mcastTTL, struct sockaddr *addr) -{ -#ifdef IPV4 - if (addr->sa_family == AF_INET) { - if (setsockopt (sockfd, IPPROTO_IP, IP_MULTICAST_TTL, &mcastTTL, sizeof (mcastTTL)) < 0) { - perror ("setsockopt(IP_MULTICAST_TTL)"); - return -1; - } - } -#endif - if (addr->sa_family == AF_INET6) { - if (setsockopt (sockfd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, (_SOTYPE)&mcastTTL, sizeof (mcastTTL)) < 0) { - perror ("setsockopt(IPV6_MULTICAST_HOPS)"); - return -1; - } - } - return 0; -} - -//--------------------------------------------------------------------------------------------------------------------------------- -int udp_ipv6_join_multicast_group (SOCKET sockfd, int iface, struct sockaddr *addr) -{ -#ifdef IPV4 - if (addr->sa_family == AF_INET) { - struct ip_mreq mreq; - mreq.imr_multiaddr.s_addr = ((struct sockaddr_in *) addr)->sin_addr.s_addr; - mreq.imr_interface.s_addr = INADDR_ANY; - if (setsockopt (sockfd, IPPROTO_IP, IP_ADD_MEMBERSHIP, (const void *) &mreq, sizeof (mreq)) < 0) { - perror ("setsockopt(IP_ADD_MEMBERSHIP)"); - return -1; - } - } -#endif - if (addr->sa_family == AF_INET6) { - struct ipv6_mreq mreq6; - memcpy (&mreq6.ipv6mr_multiaddr, &(((struct sockaddr_in6 *) addr)->sin6_addr), sizeof (struct in6_addr)); - mreq6.ipv6mr_interface = iface; - if (setsockopt (sockfd, IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP, (_SOTYPE)&mreq6, sizeof (mreq6)) < 0) { - perror ("setsockopt(IPV6_ADD_MEMBERSHIP)"); - return -1; - } - } - return 0; -} - -//--------------------------------------------------------------------------------------------------------------------------------- -int udp_ipv6_leave_multicast_group (SOCKET sockfd, int iface, struct sockaddr *addr) -{ -#ifdef IPV4 - if (addr->sa_family == AF_INET) { - struct ip_mreq mreq; - mreq.imr_multiaddr.s_addr = ((struct sockaddr_in *) addr)->sin_addr.s_addr; - mreq.imr_interface.s_addr = INADDR_ANY; - if (setsockopt (sockfd, IPPROTO_IP, IP_DROP_MEMBERSHIP, (const void *) &mreq, sizeof (mreq)) < 0) { - perror ("setsockopt(IP_DROP_MEMBERSHIP)"); - return -1; - } - } -#endif - if (addr->sa_family == AF_INET6) { - struct ipv6_mreq mreq6; - memcpy (&mreq6.ipv6mr_multiaddr, &(((struct sockaddr_in6 *) addr)->sin6_addr), sizeof (struct in6_addr)); - mreq6.ipv6mr_interface = iface; - if (setsockopt (sockfd, IPPROTO_IPV6, IPV6_DROP_MEMBERSHIP, (_SOTYPE)&mreq6, sizeof (mreq6)) < 0) { - perror ("setsockopt(IPV6_DROP_MEMBERSHIP)"); - return -1; - } - } - return 0; -} - -//----------------------------------------------------------------------------------------------------------------------------------- -STATIC int sockfd_to_family (SOCKET sockfd) -{ - struct sockaddr_storage ss; - socklen_t len; - - len = sizeof (ss); - if (getsockname (sockfd, (SA *) & ss, &len) < 0) - return (-1); - return (ss.ss_family); -} - -/* end sockfd_to_family */ -//---------------------------------------------------------------------------------------------------------------------------------- -int mcast_set_if (SOCKET sockfd, const char *ifname, u_int ifindex) -{ - switch (sockfd_to_family (sockfd)) { -#ifdef IPV4 - case AF_INET:{ - struct in_addr inaddr; - struct ifreq ifreq; - - if (ifindex > 0) { - if (if_indextoname (ifindex, ifreq.ifr_name) == NULL) { - errno = ENXIO; /* i/f index not found */ - return (-1); - } - goto doioctl; - } else if (ifname != NULL) { - memset(&ifreq, 0, sizeof(struct ifreq)); - strncpy (ifreq.ifr_name, ifname, IFNAMSIZ-1); - doioctl: - if (ioctl (sockfd, SIOCGIFADDR, &ifreq) < 0) - return (-1); - memcpy (&inaddr, &((struct sockaddr_in *) &ifreq.ifr_addr)->sin_addr, sizeof (struct in_addr)); - } else - inaddr.s_addr = htonl (INADDR_ANY); /* remove prev. set default */ - - return (setsockopt (sockfd, IPPROTO_IP, IP_MULTICAST_IF, &inaddr, sizeof (struct in_addr))); - } -#endif - case AF_INET6:{ - u_int idx; -// printf("Changing interface IPV6...\n"); - if ((idx = ifindex) == 0) { - if (ifname == NULL) { - errno = EINVAL; /* must supply either index or name */ - return (-1); - } - if ((idx = if_nametoindex (ifname)) == 0) { - errno = ENXIO; /* i/f name not found */ - return (-1); - } - } - return (setsockopt (sockfd, IPPROTO_IPV6, IPV6_MULTICAST_IF, (_SOTYPE)&idx, sizeof (idx))); - } - - default: -// errno = EAFNOSUPPORT; - return (-1); - } -} - -//-------------------------------------------------------------------------------------------------------------------------------------------- -UDPContext *server_udp_open (const struct in6_addr *mcg, int port, const char *ifname) -{ - UDPContext *s; - int sendfd; - int n; - - pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, NULL); - - s = (UDPContext *) calloc (1, sizeof (UDPContext)); - if (!s) { - err ("Cannot allocate memory !\n"); - goto error; - } - struct sockaddr_in6 *addr = (struct sockaddr_in6 *) &s->dest_addr; - - addr->sin6_addr=*mcg;; - addr->sin6_family = AF_INET6; - addr->sin6_port = htons (port); - s->dest_addr_len = sizeof (struct sockaddr_in6); - - sendfd = socket (PF_INET6, SOCK_DGRAM, IPPROTO_UDP); - if (sendfd < 0) { - err ("cannot get socket\n"); - } - - s->dest_addr_len = sizeof (struct sockaddr_in6); - - if ((udp_ipv6_is_multicast_address ((struct sockaddr *) &s->dest_addr))) { - if (ifname && strlen (ifname) && (mcast_set_if (sendfd, ifname, 0) < 0)) { - warn ("mcast_set_if error\n"); - goto error; - } - if (udp_ipv6_set_multicast_ttl (sendfd, MCAST_TTL, (struct sockaddr *) &s->dest_addr) < 0) { - warn ("udp_ipv6_set_multicast_ttl"); - } - } - - n = UDP_TX_BUF_SIZE; +(symlink to ../common/mcast.c)
View file
vdr-mcli-plugin.tar.bz2/mcast/client/mingw/Makefile
Changed
@@ -1,8 +1,9 @@ -PATH:=/MinGW/bin/:$(PATH) +# Set by batch file +#PATH:=/MinGW/bin/:$(PATH) CC:=gcc -#Comment this out to disable debugging output -DEBUG=1 +#Uncomment the following line to enable debugging output +#DEBUG=1 #VERBOSE=1 #API_SOCK=1 @@ -13,9 +14,9 @@ DEBUG=1 endif -CFLAGS:= $(DEFS) -Wall -Iwin32/include $(CFLAGS) -LDFLAGS:= -Lwin32/lib $(LDFLAGS) -LDLIBS:= -lwsock32 -liphlpapi -lpthreadGC2 -lxml2 -lzdll +CFLAGS:= $(DEFS) -O2 -Wall -I../win32/include -I../../common $(CFLAGS) +LDFLAGS:= -s -L../win32/lib $(LDFLAGS) +LDLIBS:= -liphlpapi -lpthreadGC2 -lws2_32 -lxml2 -lz ifdef DEBUG LDFLAGS:= $(LDFLAGS) -g @@ -25,21 +26,28 @@ endif MCLI = mcli -MCLI_OBJS = mld_common.o mld_client.o mld_reporter.o mcast.o recv_tv.o recv_ccpp.o tools.o tca_handler.o tra_handler.o satlists.o interfaces.o inet_pton.o inet_ntop.o inet_aton.o -MCLI_SOBJS := main.o dummy_client.o +MCLI_OBJS = mld_common.o mld_client.o mld_reporter.o mcast.o recv_tv.o recv_ccpp.o tools.o tca_handler.o tra_handler.o satlists.o interfaces.o inet_pton.o inet_ntop.o inet_aton.o poll.o +MCLI_SOBJS := main.o dummy_client.o api_server.o input.o + +all: lib$(MCLI).a $(MCLI).exe -all: lib$(MCLI) +lib$(MCLI).a: $(MCLI_OBJS) + $(AR) $(ARFLAGS) $@ $(MCLI_OBJS) + @copy /b $@ ..\\win32\\lib\\ + @echo "You can find all libraries in directory ..\\win32\lib" + @echo "If you need a shared library you need MSVC installed." + @echo "To build the shared library execute the following:" + @echo "mingw32-make libmcli.dll" -lib$(MCLI): $(MCLI_OBJS) - $(CC) $(LDFLAGS) -shared -o $@.dll $(MCLI_OBJS) $(LDLIBS) -Wl,--out-implib,$@.a -Wl,--output-def,$@.def -# $(AR) $(ARFLAGS) $@.a $(MCLI_OBJS) - @copy /b $@.dll win32\\lib\\ - @copy /b $@.a win32\\lib\\ - @copy /b $@.def win32\\lib\\ - lib.exe /def:$@.def /machine:x86 /out:win32\\lib\\$@.lib - @echo "You can find all libraries in directory win32\lib" +lib$(MCLI).dll: $(MCLI_OBJS) + @echo You need MSVC lib.exe for shared libraries! + $(CC) $(LDFLAGS) -shared -o $@ $(MCLI_OBJS) $(LDLIBS) -Wl,--out-implib,lib$(MCLI).a -Wl,--output-def,lib$(MCLI).def + @copy /b $@ ..\\win32\\lib\\ + @copy /b lib$(MCLI).def ..\\win32\\lib\\ + @lib.exe /def:lib$(MCLI).def /machine:x86 /out:..\\win32\\lib\\lib$(MCLI).lib + @echo "You can find all libraries in directory ..\\win32\lib" -$(MCLI): $(MCLI_OBJS) $(MCLI_SOBJS) +$(MCLI).exe: $(MCLI_OBJS) $(MCLI_SOBJS) $(CC) $(LDFLAGS) -o $@ $(MCLI_OBJS) $(MCLI_SOBJS) $(LDLIBS) $(MCLI)-shared: lib$(MCLI) @@ -48,8 +56,9 @@ $(CC) $(LDFLAGS) -o $@ $(MCLI_SOBJS) $(LDLIBS) -lmcli clean: - @del $(MCLI)*.exe lib$(MCLI).* *.lib *.o *.la *~ + @-del $(MCLI)*.exe lib$(MCLI).* *.lib *.o *.la *~ + @-del ..\\win32\\lib\\lib$(MCLI).* -%.o: %.c +%.o: ../%.c $(CC) -c $(CFLAGS) -o $@ $<
View file
vdr-mcli-plugin.tar.bz2/mcast/client/mingw/build.cmd
Changed
@@ -1,2 +1,2 @@ -@set %PATH%=c:\MinGw\bin;%PATH% -@mingw32-make clean libmcli +@set PATH=c:\MinGw\bin;%PATH% +@mingw32-make
View file
vdr-mcli-plugin.tar.bz2/mcast/client/mingw/clean.cmd
Added
@@ -0,0 +1,2 @@ +@set PATH=c:\MinGw\bin;%PATH% +@mingw32-make clean
View file
vdr-mcli-plugin.tar.bz2/mcast/client/mld_client.c
Changed
@@ -1,244 +0,0 @@ -/* - * (c) BayCom GmbH, http://www.baycom.de, info@baycom.de - * - * See the COPYING file for copyright information and - * how to reach the author. - * - */ - -#undef DEBUG -#include "headers.h" - -//----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -int send_mldv2_report (struct intnode *intn, int grec_number, struct in6_addr *mcas, int srcn, struct in6_addr *sources, int mode) -{ - unsigned int length; - struct mld_report_packet - { - struct ip6_hdr ip6; - struct ip6_hbh hbh; - struct - { - uint8_t type; - uint8_t length; - uint16_t value; - uint8_t optpad[2]; - } routeralert; - struct mld2_report mld2r; - } *packet; - struct mld2_grec *grec = NULL; - struct in6_addr *src = NULL; - int mca_index, src_index; - int count = 0; - - bool any = false; - - - //printf("creating multicast listener report packet....\n"); - //printf("size src = %d size grec = %d \n",sizeof(*src),sizeof(*grec)); - if (intn->mtu < sizeof (*packet)) { - /* - * MTU is too small to support this type of packet - * Should not happen though - */ - dbg ("MTU too small for packet while sending MLDv2 report on interface %s/%u mtu=%u!?\n", intn->name, intn->ifindex, intn->mtu); - return -1; - } - - /* Allocate a buffer matching the MTU size of this interface */ - packet = (struct mld_report_packet *) malloc (intn->mtu); - - if (!packet) { - err ("Cannot get memory for MLD2 report packet, aborting\n"); - } -// printf("addr packet = %u \n",packet); - memset (packet, 0, intn->mtu); - - - /* Create the IPv6 packet */ - packet->ip6.ip6_vfc = 0x60; - packet->ip6.ip6_plen = ntohs (sizeof (*packet) - sizeof (packet->ip6)); - packet->ip6.ip6_nxt = IPPROTO_HOPOPTS; - packet->ip6.ip6_hlim = 1; - - /* - * The source address must be the link-local address - * of the interface we are sending on - */ - memcpy (&packet->ip6.ip6_src, &intn->linklocal, sizeof (packet->ip6.ip6_src)); - - /* MLDv2 Report -> All IPv6 Multicast Routers (ff02::16) */ - packet->ip6.ip6_dst.s6_addr[0] = 0xff; - packet->ip6.ip6_dst.s6_addr[1] = 0x02; - packet->ip6.ip6_dst.s6_addr[15] = 0x16; - - /* HopByHop Header Extension */ - packet->hbh.ip6h_nxt = IPPROTO_ICMPV6; - packet->hbh.ip6h_len = 0; - - /* Router Alert Option */ - packet->routeralert.type = 5; - packet->routeralert.length = sizeof (packet->routeralert.value); - packet->routeralert.value = 0; /* MLD ;) */ - - /* Option Padding */ - packet->routeralert.optpad[0] = IP6OPT_PADN; - packet->routeralert.optpad[1] = 0; - - /* ICMPv6 MLD Report */ - packet->mld2r.type = ICMP6_V2_MEMBERSHIP_REPORT; - //number of multi cast address reocrds - packet->mld2r.ngrec = 0; //grec_number;//htons(1); - length = 0; - count = 0; - for (mca_index = 0; mca_index < grec_number; mca_index++) { - src = NULL; - if (!grec) { - length = sizeof (*packet) + sizeof (*grec) - sizeof (packet->ip6); - //fprintf(stdout,"(grec = %02d) %02d. current report length = %04d MTU: %04d)\n",packet->mld2r.ngrec,mca_index,length+sizeof(packet->ip6),intn->mtu); - - if (length + sizeof (packet->ip6) > intn->mtu) { - /* Should not happen! Would mean the MTU is smaller than a standard mld report */ - dbg ("No grec and MTU too small for packet while sending MLDv2 report on interface %s/%u mtu=%u!?\n", intn->name, intn->ifindex, intn->mtu); - free (packet); - return (-1); - } else - grec = (struct mld2_grec *) (((char *) packet) + sizeof (*packet)); - - packet->mld2r.ngrec++; - } else { - if (!src) - length = ((((char *) grec) - ((char *) packet)) + sizeof (*grec) + (sizeof (*src) * (grec->grec_nsrcs))) - sizeof (packet->ip6); - - //fprintf(stdout,"\nloop1:(grec = %02d) %02d.length = %04d (Total : %04d MTU: %04d)\n\n", packet->mld2r.ngrec , mca_index,length,(length + sizeof(packet->ip6)), intn->mtu); - - if (((length + sizeof (packet->ip6) + sizeof (*grec)) > intn->mtu)) { - - /* Take care of endianess */ - //fprintf(stdout,"next grec record does not fit... sending... \n"); - - packet->mld2r.ngrec = htons (packet->mld2r.ngrec); - grec->grec_nsrcs = htons (grec->grec_nsrcs); - - /* Calculate and fill in the checksum */ - packet->ip6.ip6_plen = htons (length); - packet->mld2r.csum = htons (0); - packet->mld2r.csum = ipv6_checksum (&packet->ip6, IPPROTO_ICMPV6, (uint8_t *) & packet->mld2r, length - sizeof (struct ip6_hbh) - sizeof (packet->routeralert)); - count++; -#ifdef DEBUG - dbg ("%04d.Sending2 MLDv2 Report on %s/%u, ngrec=%u, length=%u sources=%u (in last grec)\n", count, intn->name, intn->ifindex, ntohs (packet->mld2r.ngrec), length, ntohs (grec->grec_nsrcs)); - sendpacket6 (intn, (const struct ip6_hdr *) packet, length + sizeof (packet->ip6)); -#endif - /* Increase ICMP sent statistics */ - g_conf->stat_icmp_sent++; - intn->stat_icmp_sent++; - - /* Reset the MLDv2 struct */ - packet->mld2r.ngrec = 0; - grec = (struct mld2_grec *) (((char *) packet) + sizeof (*packet)); - } else { - //next grec - grec->grec_nsrcs = htons (grec->grec_nsrcs); - grec = (struct mld2_grec *) (((char *) grec) + sizeof (*grec) + (sizeof (*src) * ntohs (grec->grec_nsrcs))); - - } - packet->mld2r.ngrec++; - } - //Copy MCA to record - memcpy (&grec->grec_mca, mcas + mca_index, sizeof (grec->grec_mca)); - - /* Zero sources upto now */ - grec->grec_nsrcs = 0; - /* 0 Sources -> Exclude those */ - grec->grec_type = MLD2_MODE_IS_EXCLUDE; - if (mode) { - grec->grec_type = mode; - } - - /* Nothing added yet */ - any = false; - - for (src_index = 0; src_index < srcn || (!srcn && src_index == 0); src_index++) { - - //check for duplicate source reocrds and any address - - /* Packet with at least one grec and one or more src's, excluding ip6 header */ - - length = (((char *) grec) - ((char *) packet)) + sizeof (*grec) + (sizeof (*src) * (grec->grec_nsrcs)) - sizeof (packet->ip6); - - //fprintf(stdout,"loop2:(grec = %02d) %02d.length = %04d (Total : %04d MTU: %04d)\n", packet->mld2r.ngrec,mca_index,length,(length + sizeof(packet->ip6)),intn->mtu); - /* Would adding it not fit? -> Send it out */ - if (((length + sizeof (packet->ip6) + sizeof (*src)) > (intn->mtu)) && srcn) { - //fprintf(stdout,"next source addr. does not fit... sending... \n"); - //fprintf(stdout,"src_index = %d grec->grec_nsrcs = %d \n",src_index,grec->grec_nsrcs); - - /* Take care of endianess */ - packet->mld2r.ngrec = htons (packet->mld2r.ngrec); - grec->grec_nsrcs = htons (grec->grec_nsrcs); - /* Calculate and fill in the checksum */ - - packet->ip6.ip6_plen = htons (length); - packet->mld2r.csum = htons (0); - packet->mld2r.csum = ipv6_checksum (&packet->ip6, IPPROTO_ICMPV6, (uint8_t *) & packet->mld2r, length - sizeof (struct ip6_hbh) - sizeof (packet->routeralert)); - - count++; - dbg ("%04d.Sending2 MLDv2 Report on %s/%u, ngrec=%u, length=%u sources=%u (in last grec)\n", count, intn->name, intn->ifindex, ntohs (packet->mld2r.ngrec), length, ntohs (grec->grec_nsrcs)); - sendpacket6 (intn, (const struct ip6_hdr *) packet, length + sizeof (packet->ip6)); - - /* Increase ICMP sent statistics */ - g_conf->stat_icmp_sent++; - intn->stat_icmp_sent++; - - /* Reset the MLDv2 struct */ - packet->mld2r.ngrec = 0; - src = NULL; - grec = NULL; - //if not IS_EX or TO EXCLUDE_MODE splitting must be done - break; - } - +(symlink to ../common/mld_client.c)
View file
vdr-mcli-plugin.tar.bz2/mcast/client/mld_common.c
Changed
@@ -1,243 +0,0 @@ -/* - * (c) BayCom GmbH, http://www.baycom.de, info@baycom.de - * - * See the COPYING file for copyright information and - * how to reach the author. - * - */ - -#include "headers.h" -struct conf *g_conf=NULL; - -//----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -#ifdef DEBUG -struct lookup icmpv6_types[] = { - {ICMP6_DST_UNREACH, "Destination Unreachable"}, - {ICMP6_PACKET_TOO_BIG, "Packet too big"}, - {ICMP6_TIME_EXCEEDED, "Time Exceeded"}, - {ICMP6_PARAM_PROB, "Parameter Problem"}, - {ICMP6_ECHO_REQUEST, "Echo Request"}, - {ICMP6_ECHO_REPLY, "Echo Reply"}, - {ICMP6_MEMBERSHIP_QUERY, "Membership Query"}, - {ICMP6_MEMBERSHIP_REPORT, "Membership Report"}, - {ICMP6_MEMBERSHIP_REDUCTION, "Membership Reduction"}, - {ICMP6_V2_MEMBERSHIP_REPORT, "Membership Report (V2)"}, - {ICMP6_V2_MEMBERSHIP_REPORT_EXP, "Membership Report (V2) - Experimental"}, - {ND_ROUTER_SOLICIT, "ND Router Solicitation"}, - {ND_ROUTER_ADVERT, "ND Router Advertisement"}, - {ND_NEIGHBOR_SOLICIT, "ND Neighbour Solicitation"}, - {ND_NEIGHBOR_ADVERT, "ND Neighbour Advertisement"}, - {ND_REDIRECT, "ND Redirect"}, - {ICMP6_ROUTER_RENUMBERING, "Router Renumbering",}, - {ICMP6_NI_QUERY, "Node Information Query"}, - {ICMP6_NI_REPLY, "Node Information Reply"}, - {MLD_MTRACE_RESP, "Mtrace Response"}, - {MLD_MTRACE, "Mtrace Message"}, - {0, NULL}, -}, icmpv6_codes_unreach[] = { - {ICMP6_DST_UNREACH_NOROUTE, "No route to destination"}, - {ICMP6_DST_UNREACH_ADMIN, "Administratively prohibited"}, - {ICMP6_DST_UNREACH_NOTNEIGHBOR, "Not a neighbor (obsolete)"}, - {ICMP6_DST_UNREACH_BEYONDSCOPE, "Beyond scope of source address"}, - {ICMP6_DST_UNREACH_ADDR, "Address Unreachable"}, - {ICMP6_DST_UNREACH_NOPORT, "Port Unreachable"}, -}, icmpv6_codes_ttl[] = { - - {ICMP6_TIME_EXCEED_TRANSIT, "Time Exceeded during Transit",}, - {ICMP6_TIME_EXCEED_REASSEMBLY, "Time Exceeded during Reassembly"}, -}, icmpv6_codes_param[] = { - - {ICMP6_PARAMPROB_HEADER, "Erroneous Header Field"}, - {ICMP6_PARAMPROB_NEXTHEADER, "Unrecognized Next Header"}, - {ICMP6_PARAMPROB_OPTION, "Unrecognized Option"}, -}, icmpv6_codes_ni[] = { - - {ICMP6_NI_SUCCESS, "Node Information Successful Reply"}, - {ICMP6_NI_REFUSED, "Node Information Request Is Refused"}, - {ICMP6_NI_UNKNOWN, "Unknown Qtype"}, -}, icmpv6_codes_renumber[] = { - - {ICMP6_ROUTER_RENUMBERING_COMMAND, "Router Renumbering Command"}, - {ICMP6_ROUTER_RENUMBERING_RESULT, "Router Renumbering Result"}, - {ICMP6_ROUTER_RENUMBERING_SEQNUM_RESET, "Router Renumbering Sequence Number Reset"}, -}, mld2_grec_types[] = { - - {MLD2_MODE_IS_INCLUDE, "MLDv2 Mode Is Include"}, - {MLD2_MODE_IS_EXCLUDE, "MLDv2 Mode Is Exclude"}, - {MLD2_CHANGE_TO_INCLUDE, "MLDv2 Change to Include"}, - {MLD2_CHANGE_TO_EXCLUDE, "MLDv2 Change to Exclude"}, - {MLD2_ALLOW_NEW_SOURCES, "MLDv2 Allow New Source"}, - {MLD2_BLOCK_OLD_SOURCES, "MLDv2 Block Old Sources"}, -}; -#endif - -//---------------------------------------------------------------------------------------------------------------- -const char *lookup (struct lookup *l, unsigned int num) -{ - unsigned int i; - for (i = 0; l && l[i].desc; i++) { - if (l[i].num != num) - continue; - return l[i].desc; - } - return "Unknown"; -} - -const char *icmpv6_type (unsigned int type) -{ -#ifdef DEBUG - return lookup (icmpv6_types, type); -#else - return ""; -#endif -} - -const char *icmpv6_code (unsigned int type, unsigned int code) -{ -#ifdef DEBUG - struct lookup *l = NULL; - switch (type) { - case ICMP6_DST_UNREACH: - l = icmpv6_codes_unreach; - break; - case ICMP6_TIME_EXCEEDED: - l = icmpv6_codes_ttl; - break; - case ICMP6_PARAM_PROB: - l = icmpv6_codes_param; - break; - case ICMP6_NI_QUERY: - case ICMP6_NI_REPLY: - l = icmpv6_codes_ni; - break; - case ICMP6_ROUTER_RENUMBERING: - l = icmpv6_codes_renumber; - break; - } - return lookup (l, code); -#else - return ""; -#endif -} - -//----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -uint16_t inchksum (const void *data, uint32_t length) -{ - register long sum = 0; - register const uint16_t *wrd = (const uint16_t *) data; - register long slen = (long) length; - - while (slen >= 2) { - sum += *wrd++; - slen -= 2; - } - - if (slen > 0) - sum += *(const uint8_t *) wrd; - - while (sum >> 16) - sum = (sum & 0xffff) + (sum >> 16); - - return (uint16_t) sum; -} - -//----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -uint16_t ipv6_checksum (const struct ip6_hdr * ip6, uint8_t protocol, const void *data, const uint16_t length) -{ - struct - { - uint16_t length; - uint16_t zero1; - uint8_t zero2; - uint8_t next; - } pseudo; - register uint32_t chksum = 0; - - pseudo.length = htons (length); - pseudo.zero1 = 0; - pseudo.zero2 = 0; - pseudo.next = protocol; - - /* IPv6 Source + Dest */ - chksum = inchksum (&ip6->ip6_src, sizeof (ip6->ip6_src) + sizeof (ip6->ip6_dst)); - chksum += inchksum (&pseudo, sizeof (pseudo)); - chksum += inchksum (data, length); - - /* Wrap in the carries to reduce chksum to 16 bits. */ - chksum = (chksum >> 16) + (chksum & 0xffff); - chksum += (chksum >> 16); - - /* Take ones-complement and replace 0 with 0xFFFF. */ - chksum = (uint16_t) ~ chksum; - if (chksum == 0UL) - chksum = 0xffffUL; - return (uint16_t) chksum; -} - -//----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -void sendpacket6 (struct intnode *intn, const struct ip6_hdr *iph, const uint16_t len) -{ - int sent; -#if ! (defined WIN32 || defined APPLE) - struct sockaddr_ll sa; - - memset (&sa, 0, sizeof (sa)); - - sa.sll_family = AF_PACKET; - sa.sll_protocol = htons (ETH_P_IPV6); - sa.sll_ifindex = intn->ifindex; - sa.sll_hatype = intn->hwaddr.sa_family; - sa.sll_pkttype = 0; - sa.sll_halen = 6; - - /* - * Construct a Ethernet MAC address from the IPv6 destination multicast address. - * Per RFC2464 - */ - sa.sll_addr[0] = 0x33; - sa.sll_addr[1] = 0x33; - sa.sll_addr[2] = iph->ip6_dst.s6_addr[12]; +(symlink to ../common/mld_common.c)
View file
vdr-mcli-plugin.tar.bz2/mcast/client/mld_reporter.c
Changed
@@ -60,7 +60,11 @@ memset(&c, 0, sizeof(mld_reporter_context_t)); c.mld_mca_add=(struct in6_addr *)malloc(maxpids*sizeof(struct in6_addr)); + if (!c.mld_mca_add) + err ("mld_send_reports: out of memory\n"); c.mld_mca_drop=(struct in6_addr *)malloc(maxpids*sizeof(struct in6_addr)); + if (!c.mld_mca_drop) + err ("mld_send_reports: out of memory\n"); pthread_cleanup_push (clean_mld_send_reports_thread, &c); @@ -78,7 +82,11 @@ if(pids>maxpids) { maxpids=pids; c.mld_mca_add=(struct in6_addr *)realloc(c.mld_mca_add, pids*sizeof(struct in6_addr)); + if (!c.mld_mca_add) + err ("mld_send_reports: out of memory\n"); c.mld_mca_drop=(struct in6_addr *)realloc(c.mld_mca_drop, pids*sizeof(struct in6_addr)); + if (!c.mld_mca_drop) + err ("mld_send_reports: out of memory\n"); } //Send listener reports for all recently dropped MCGs
View file
vdr-mcli-plugin.tar.bz2/mcast/client/mmi_handler.c
Changed
@@ -130,14 +130,11 @@ int mmi_get_menu_text (int sockfd, char *buf, int buf_len, int timeout) { int n = -1; - fd_set rfds; - struct timeval tv; - FD_ZERO (&rfds); - FD_SET (sockfd, &rfds); - tv.tv_sec = 0; - tv.tv_usec = timeout; + struct pollfd p; memset (buf, 0, buf_len); - if (select (sockfd + 1, &rfds, NULL, NULL, &tv) > 0) { + p.fd = sockfd; + p.events = POLLIN; + if (poll (&p, 1, (timeout+999)>>10) > 0) { n = recv (sockfd, buf, buf_len, 0); //MSG_DONTWAIT); } if (n > 0) { @@ -298,6 +295,8 @@ mcg_get_id (&mcg, &sid); mcg_set_id (&mcg, 0); mmi_info->caids = (caid_mcg_t *) realloc (mmi_info->caids, sizeof (caid_mcg_t) * (mmi_info->caid_num + 1)); + if (!mmi_info->caids) + err ("mmi_get_data: out of memory\n"); caid_mcg_t *cm = mmi_info->caids + mmi_info->caid_num; cm->caid = sid; cm->mcg = mcg;
View file
vdr-mcli-plugin.tar.bz2/mcast/client/poll.c
Added
+(symlink to ../common/win32/poll.c)
View file
vdr-mcli-plugin.tar.bz2/mcast/client/recv_ccpp.c
Changed
@@ -1,1329 +0,0 @@ -/* - * (c) BayCom GmbH, http://www.baycom.de, info@baycom.de - * - * See the COPYING file for copyright information and - * how to reach the author. - * - */ - -#undef DEBUG -#include "headers.h" - -extern int port; -extern char iface[IFNAMSIZ]; - -typedef struct -{ - xmlDocPtr doc; - xmlChar *str, *key; -} xml_parser_context_t; - -STATIC void clean_xml_parser_thread (void *arg) -{ - xml_parser_context_t *c = (xml_parser_context_t *) arg; - if (c->str) { - xmlFree (c->str); - } - if (c->key) { - xmlFree (c->key); - } - if (c->doc) { - xmlFreeDoc (c->doc); - } - dbg ("Free XML parser structures!\n"); -} - -int get_tra_data (xmlChar * xmlbuff, int buffersize, tra_info_t * tra_info) -{ - xml_parser_context_t c; - xmlNode *root_element = NULL, *cur_node = NULL; - - xmlKeepBlanksDefault (0); //reomve this f. "text" nodes - c.doc = xmlParseMemory ((char *) xmlbuff, buffersize); - root_element = xmlDocGetRootElement (c.doc); - pthread_cleanup_push (clean_xml_parser_thread, &c); - time_t t=time(NULL); - - if (root_element != NULL) { - - cur_node = root_element->children; - - if (!xmlStrcmp (cur_node->name, (xmlChar *) "Description")) { - - root_element = cur_node->children; - while (root_element != NULL) { - c.key = NULL; - c.str = NULL; - if ((xmlStrcmp (root_element->name, (const xmlChar *) "component"))) { - warn ("Cannot parse XML data\n"); - root_element = root_element->next; - continue; - } - - cur_node = root_element->children; - if ((!xmlStrcmp (cur_node->name, (const xmlChar *) "Description"))) { - c.str = xmlGetProp (cur_node, (unsigned char *) "about"); -// fprintf(stdout,"\n%s:\n",c.str); -// fprintf(stdout,"-----------------------------------------------------------\n"); - } else { - warn ("Cannot parse XML data\n"); - root_element = root_element->next; - continue; - } -#ifdef P2P - if (c.str && (!xmlStrcmp (c.str, (const xmlChar *) "P2P_Data"))) { - cur_node = cur_node->children; - while (cur_node != NULL) { - if ((!xmlStrcmp (cur_node->name, (const xmlChar *) "Quit"))) { - c.key = xmlNodeListGetString (c.doc, cur_node->xmlChildrenNode, 1); - if (c.key) { - dbg ("Quit: %s\n", c.key); - tra_info->quit = atoi ((char *) c.key); - xmlFree (c.key); - } - } else if ((!xmlStrcmp (cur_node->name, (const xmlChar *) "TCA_ID"))) { - c.key = xmlNodeListGetString (c.doc, cur_node->xmlChildrenNode, 1); - if (c.key) { - dbg ("TCA_ID: %s\n", c.key); - tra_info->tca_id = atoi ((char *) c.key); - xmlFree (c.key); - } - } else if ((!xmlStrcmp (cur_node->name, (const xmlChar *) "MC_Groups"))) { - c.key = xmlNodeListGetString (c.doc, cur_node->xmlChildrenNode, 1); - if (c.key) { - dbg ("MC_Groups: %s\n", c.key); - tra_info->mca_grps = atoi ((char *) c.key); - xmlFree (c.key); - } - } else if ((!xmlStrcmp (cur_node->name, (const xmlChar *) "IP"))) { - c.key = xmlNodeListGetString (c.doc, cur_node->xmlChildrenNode, 1); - if (c.key) { - dbg ("IP: %s\n", c.key); - inet_pton (AF_INET6, (char *) c.key, &tra_info->ipv6); - xmlFree (c.key); - } - } - cur_node = cur_node->next; - } - } else if (c.str && (!xmlStrcmp (c.str, (const xmlChar *) "Tuner_Status"))) { -#else - if (c.str && (!xmlStrcmp (c.str, (const xmlChar *) "Tuner_Status"))) { -#endif - cur_node = cur_node->children; - tra_info->tra = (tra_t *) realloc (tra_info->tra, (tra_info->tra_num + 1) * sizeof (tra_t)); - if (!tra_info->tra) { - err ("Cannot get memory for tra_t\n"); - } - tra_t *tra = tra_info->tra + tra_info->tra_num; - memset(tra, 0, sizeof (tra_t)); - tra->magic=MCLI_MAGIC; - tra->version=MCLI_VERSION; - - while (cur_node != NULL) { - if ((!xmlStrcmp (cur_node->name, (const xmlChar *) "Status"))) { - c.key = xmlNodeListGetString (c.doc, cur_node->xmlChildrenNode, 1); - if (c.key) { - dbg ("Status: %s\n", c.key); - tra->s.st = (fe_status_t) atoi ((char *) c.key); - xmlFree (c.key); - } - } else if ((!xmlStrcmp (cur_node->name, (const xmlChar *) "Signal"))) { - c.key = xmlNodeListGetString (c.doc, cur_node->xmlChildrenNode, 1); - if (c.key) { - dbg ("Signal: %s\n", c.key); - tra->s.strength = (u_int16_t) atoi ((char *) c.key); - xmlFree (c.key); - } - } else if ((!xmlStrcmp (cur_node->name, (const xmlChar *) "SNR"))) { - c.key = xmlNodeListGetString (c.doc, cur_node->xmlChildrenNode, 1); - if (c.key) { - dbg ("SNR: %s\n", c.key); - tra->s.snr = (u_int16_t) atoi ((char *) c.key); - xmlFree (c.key); - } - } else if ((!xmlStrcmp (cur_node->name, (const xmlChar *) "BER"))) { - c.key = xmlNodeListGetString (c.doc, cur_node->xmlChildrenNode, 1); - if (c.key) { - dbg ("BER: %s\n", c.key); - tra->s.ber = (u_int32_t) atoi ((char *) c.key); - xmlFree (c.key); - } - } else if ((!xmlStrcmp (cur_node->name, (const xmlChar *) "UNC"))) { - c.key = xmlNodeListGetString (c.doc, cur_node->xmlChildrenNode, 1); - if (c.key) { - dbg ("UNC: %s\n", c.key); - tra->s.ucblocks = (u_int32_t) atoi ((char *) c.key); - xmlFree (c.key); - } - } else if ((!xmlStrcmp (cur_node->name, (const xmlChar *) "Slot"))) { - c.key = xmlNodeListGetString (c.doc, cur_node->xmlChildrenNode, 1); - if (c.key) { - dbg ("Slot: %s\n", c.key); - tra->slot = atoi ((char *) c.key); - xmlFree (c.key); - } - } else if ((!xmlStrcmp (cur_node->name, (const xmlChar *) "RotorStatus"))) { - c.key = xmlNodeListGetString (c.doc, cur_node->xmlChildrenNode, 1); - if (c.key) { - dbg ("Rotor: %s\n", c.key); - tra->rotor_status = (u_int32_t) atoi ((char *) c.key); - xmlFree (c.key); - } - - } else if ((!xmlStrcmp (cur_node->name, (const xmlChar *) "RotorDiff"))) { - c.key = xmlNodeListGetString (c.doc, cur_node->xmlChildrenNode, 1); - if (c.key) { - dbg ("Rotor: %s\n", c.key); - tra->rotor_diff = (u_int32_t) atoi ((char *) c.key); - xmlFree (c.key); - } - } else if ((!xmlStrcmp (cur_node->name, (const xmlChar *) "UUID"))) { - c.key = xmlNodeListGetString (c.doc, cur_node->xmlChildrenNode, 1); - if (c.key) { - dbg ("UUID: %s\n", c.key); - strncpy (tra->uuid, (char *) c.key, UUID_SIZE-1); - xmlFree (c.key); - } - } else if ((!xmlStrcmp (cur_node->name, (const xmlChar *) "MCG"))) { - c.key = xmlNodeListGetString (c.doc, cur_node->xmlChildrenNode, 1); - if (c.key) { - dbg ("MCG: %s\n", c.key); - inet_pton (AF_INET6, (char *) c.key, &tra->mcg); - xmlFree (c.key); - } - } else if ((!xmlStrcmp (cur_node->name, (const xmlChar *) "Redirect"))) { - c.key = xmlNodeListGetString (c.doc, cur_node->xmlChildrenNode, 1); - if (c.key) { - dbg ("Redirect: %s\n", c.key); - tra->redirect = atoi ((char *) c.key); - xmlFree (c.key); +(symlink to ../common/recv_ccpp.c)
View file
vdr-mcli-plugin.tar.bz2/mcast/client/recv_tv.c
Changed
@@ -146,29 +146,28 @@ if (n >0 ) { pid_info_t *p = (pid_info_t *) arg; recv_info_t *r = p->recv; - unsigned char *ptr = buf; - if (n % 188) { - warn ("Received %d bytes is not multiple of 188!\n", n); - } int i; - for (i = 0; i < (n / 188); i++) { - unsigned char *ts = buf + (i * 188); + for (i = 0; i < n; i += 188) { + unsigned char *ts = buf + i; int adaption_field = (ts[3] >> 4) & 3; int cont = ts[3] & 0xf; int pid = ((ts[1] << 8) | ts[2]) & 0x1fff; int transport_error_indicator = ts[1]&0x80; if (pid != 8191 && (adaption_field & 1) && (((p->cont_old + 1) & 0xf) != cont) && p->cont_old >= 0) { - warn ("Discontinuity on receiver %p for pid %d: %d->%d at pos %d/%d\n", r, pid, p->cont_old, cont, i, n / 188); + warn ("Discontinuity on receiver %p for pid %d: %d->%d at pos %d/%d\n", r, pid, p->cont_old, cont, i / 188, n / 188); } if (transport_error_indicator) { - warn ("Transport error indicator set on receiver %p for pid %d: %d->%d at pos %d/%d\n", r, pid, p->cont_old, cont, i, n / 188); + warn ("Transport error indicator set on receiver %p for pid %d: %d->%d at pos %d/%d\n", r, pid, p->cont_old, cont, i / 188, n / 188); } p->cont_old = cont; } + if (i != n) { + warn ("Received %d bytes is not multiple of 188!\n", n); + } if(r->handle_ts) { while (n) { - int res = r->handle_ts (ptr, n, r->handle_ts_context); + int res = r->handle_ts (buf, n, r->handle_ts_context); if (res != n) { warn ("Not same amount of data written: res:%d<=n:%d\n", res, n); } @@ -177,7 +176,7 @@ perror ("Write failed"); break; } else { - ptr += res; + buf += res; n -= res; } } @@ -520,6 +519,7 @@ //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- #ifdef RE +#if 0 static int find_redirected_sid (recv_info_t * r, int id) { pid_info_t *slot; @@ -531,6 +531,7 @@ return 0; } +#endif int check_if_already_redirected(recv_info_t *r, int sid) {
View file
vdr-mcli-plugin.tar.bz2/mcast/client/satlists.c
Changed
@@ -49,7 +49,7 @@ sat->SatPosMin, newpos , sat->SatPosMax, newpos); // Check if coded sat pos matches - if (sat->type==SAT_SRC_LNB && mode == 0 && sec->diseqc_cmd.msg_len>0 && + if ((sat->type==SAT_SRC_LNB || sat->type==SAT_SRC_UNI) && mode == 0 && sec->diseqc_cmd.msg_len>0 && (freq >= comp->RangeMin) && (freq <= comp->RangeMax) && !memcmp (buf, &sec->diseqc_cmd.msg, sec->diseqc_cmd.msg_len)) { dbg("Satpos MATCH\n"); @@ -70,7 +70,7 @@ comp->sec.diseqc_cmd.msg[0], comp->sec.diseqc_cmd.msg[1], comp->sec.diseqc_cmd.msg[2], comp->sec.diseqc_cmd.msg[3], comp->sec.diseqc_cmd.msg[4], comp->sec.diseqc_cmd.msg[5]); ret=1; - }else if (mode == 2 && comp->Polarisation == sec->voltage && comp->sec.tone_mode== sec->tone_mode && comp->sec.mini_cmd == sec->mini_cmd) { + }else if (mode == 2 && (fe_sec_voltage_t)comp->Polarisation == sec->voltage && comp->sec.tone_mode== sec->tone_mode && comp->sec.mini_cmd == sec->mini_cmd) { dbg("Legacy Match, pol %i, tone %i, cmd %i\n",comp->Polarisation,comp->sec.tone_mode,comp->sec.mini_cmd); ret=1; }
View file
vdr-mcli-plugin.tar.bz2/mcast/client/tools.c
Changed
@@ -1,777 +0,0 @@ -/* - * (c) BayCom GmbH, http://www.baycom.de, info@baycom.de - * - * See the COPYING file for copyright information and - * how to reach the author. - * - */ - -#define DEBUG 1 -#include "headers.h" - -#ifdef DEBUG -const Param inversion_list[] = { - {"INVERSION_OFF", INVERSION_OFF}, - {"INVERSION_ON", INVERSION_ON}, - {"INVERSION_AUTO", INVERSION_AUTO} -}; - -const Param bw_list[] = { - {"BANDWIDTH_6_MHZ", BANDWIDTH_6_MHZ}, - {"BANDWIDTH_7_MHZ", BANDWIDTH_7_MHZ}, - {"BANDWIDTH_8_MHZ", BANDWIDTH_8_MHZ} -}; - -const Param fec_list[] = { - {"FEC_1_2", FEC_1_2}, - {"FEC_2_3", FEC_2_3}, - {"FEC_3_4", FEC_3_4}, - {"FEC_4_5", FEC_4_5}, - {"FEC_5_6", FEC_5_6}, - {"FEC_6_7", FEC_6_7}, - {"FEC_7_8", FEC_7_8}, - {"FEC_8_9", FEC_8_9}, - {"FEC_AUTO", FEC_AUTO}, - {"FEC_NONE", FEC_NONE}, - {"FEC_1_4", FEC_1_4}, // RMM S2 Extension - {"FEC_1_3", FEC_1_3}, - {"FEC_2_5", FEC_2_5}, - {"FEC_9_10", FEC_9_10} -}; - -const Param guard_list[] = { - {"GUARD_INTERVAL_1_16", GUARD_INTERVAL_1_16}, - {"GUARD_INTERVAL_1_32", GUARD_INTERVAL_1_32}, - {"GUARD_INTERVAL_1_4", GUARD_INTERVAL_1_4}, - {"GUARD_INTERVAL_1_8", GUARD_INTERVAL_1_8} -}; - -const Param hierarchy_list[] = { - {"HIERARCHY_1", HIERARCHY_1}, - {"HIERARCHY_2", HIERARCHY_2}, - {"HIERARCHY_4", HIERARCHY_4}, - {"HIERARCHY_NONE", HIERARCHY_NONE} -}; - -const Param constellation_list[] = { - {"QPSK", QPSK}, - {"QAM_128", QAM_128}, - {"QAM_16", QAM_16}, - {"QAM_256", QAM_256}, - {"QAM_32", QAM_32}, - {"QAM_64", QAM_64}, - {"QPSK_S2", QPSK_S2}, // RMM S2 Extension - {"PSK8", PSK8} -}; - -const Param transmissionmode_list[] = { - {"TRANSMISSION_MODE_2K", TRANSMISSION_MODE_2K}, - {"TRANSMISSION_MODE_8K", TRANSMISSION_MODE_8K}, -}; - -const Param capabilities_list[] = { - {"Stupid: ", FE_IS_STUPID}, - {"FE_CAN_INVERSION_AUTO: ", FE_CAN_INVERSION_AUTO}, - {"CAN_FEC_1_2: ", FE_CAN_FEC_1_2}, - {"CAN_FEC_2_3: ", FE_CAN_FEC_2_3}, - {"CAN_FEC_3_4: ", FE_CAN_FEC_3_4}, - {"CAN_FEC_4_5: ", FE_CAN_FEC_4_5}, - {"CAN_FEC_6_7: ", FE_CAN_FEC_6_7}, - {"CAN_FEC_7_8: ", FE_CAN_FEC_7_8}, - {"CAN_FEC_8_9: ", FE_CAN_FEC_8_9}, - {"CAN_FEC_AUTO: ", FE_CAN_FEC_AUTO}, - {"FE_CAN_QPSK: ", FE_CAN_QPSK}, - {"FE_CAN_QAM_16: ", FE_CAN_QAM_16}, - {"FE_CAN_QAM_32: ", FE_CAN_QAM_32}, - {"FE_CAN_QAM_64: ", FE_CAN_QAM_64}, - {"FE_CAN_QAM_128: ", FE_CAN_QAM_128}, - {"FE_CAN_QAM_256: ", FE_CAN_QAM_256}, - {"FE_CAN_QAM_AUTO: ", FE_CAN_QAM_AUTO}, - {"FE_CAN_TRANSMISSION_MODE_AUTO: ", FE_CAN_TRANSMISSION_MODE_AUTO}, - {"FE_CAN_BANDWIDTH_AUTO: ", FE_CAN_BANDWIDTH_AUTO}, - {"FE_CAN_GUARD_INTERVAL_AUTO: ", FE_CAN_GUARD_INTERVAL_AUTO}, - {"FE_CAN_HIERARCHY_AUTO: ", FE_CAN_HIERARCHY_AUTO}, - {"FE_CAN_MUTE_TS: ", FE_CAN_MUTE_TS} -// {"FE_CAN_CLEAN_SETUP: ",FE_CAN_CLEAN_SETUP} -}; - -#define LIST_SIZE(x) sizeof(x)/sizeof(Param) - -//----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -void print_fe_info (struct dvb_frontend_info *fe_info) -{ - fprintf (stdout, "-------------------------------------------\n"); - fprintf (stdout, "Tuner name: %s\n", fe_info->name); - fprintf (stdout, "Tuner type: %u\n", (unsigned int) fe_info->type); - fprintf (stdout, "Frequency min.: %u\n", fe_info->frequency_min); - fprintf (stdout, "Frequency max.: %u\n", fe_info->frequency_max); - fprintf (stdout, "Frequency stepsize: %u\n", fe_info->frequency_stepsize); - fprintf (stdout, "Frequency tolerance: %u\n", fe_info->frequency_tolerance); - fprintf (stdout, "Symbol rate min: %u\n", fe_info->symbol_rate_min); - fprintf (stdout, "Symbol rate max: %u\n", fe_info->symbol_rate_max); - fprintf (stdout, "Symbol rate tolerance: %u\n", fe_info->symbol_rate_tolerance); - fprintf (stdout, "Notifier delay: %u\n", fe_info->notifier_delay); - fprintf (stdout, "Cpas: 0x%x\n", (unsigned int) fe_info->caps); - - fprintf (stdout, "-------------------------------------------\n"); - fprintf (stdout, "Frontend Capabilities:\n"); - int i; - - for (i = 0; i < LIST_SIZE (capabilities_list); i++) { - if (fe_info->caps & capabilities_list[i].value) - fprintf (stdout, "%syes\n", capabilities_list[i].name); - else - fprintf (stdout, "%sno\n", capabilities_list[i].name); - } - fprintf (stdout, "-------------------------------------------\n"); -} - -//----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -void print_frontend_settings (struct dvb_frontend_parameters *frontend_param) -{ - int i; - fprintf (stdout, "\n----- Front End Settings ----- "); - fprintf (stdout, "\nFrequency : %u \n", frontend_param->frequency); - for (i = 0; i < LIST_SIZE (inversion_list); i++) { - if (inversion_list[i].value == frontend_param->inversion) - fprintf (stdout, "Inversion : %s\n", inversion_list[i].name); - - } - // - for (i = 0; i < LIST_SIZE (bw_list); i++) { - if (frontend_param->u.ofdm.bandwidth == bw_list[i].value) - fprintf (stdout, "Bandwidth : %s\n", bw_list[i].name); - - } - for (i = 0; i < LIST_SIZE (fec_list); i++) { - if (fec_list[i].value == frontend_param->u.ofdm.code_rate_HP) - fprintf (stdout, "Code Rate HP : %s\n", fec_list[i].name); - - } - for (i = 0; i < LIST_SIZE (fec_list); i++) { - if (fec_list[i].value == frontend_param->u.ofdm.code_rate_LP) - fprintf (stdout, "Code Rate LP : %s\n", fec_list[i].name); - - } - - for (i = 0; i < LIST_SIZE (constellation_list); i++) { - if (constellation_list[i].value == frontend_param->u.ofdm.constellation) - fprintf (stdout, "Modulation : %s\n", constellation_list[i].name); - - } - - for (i = 0; i < LIST_SIZE (transmissionmode_list); i++) { - if (transmissionmode_list[i].value == frontend_param->u.ofdm.transmission_mode) - fprintf (stdout, "Transmission mode : %s\n", transmissionmode_list[i].name); - - } - - for (i = 0; i < LIST_SIZE (guard_list); i++) { - if (guard_list[i].value == frontend_param->u.ofdm.guard_interval) - fprintf (stdout, "Guard interval : %s\n", guard_list[i].name); - - } - - for (i = 0; i < LIST_SIZE (hierarchy_list); i++) { - if (hierarchy_list[i].value == frontend_param->u.ofdm.hierarchy_information) - fprintf (stdout, "Hierarchy Information : %s\n", hierarchy_list[i].name); - - } - -} - -//----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -void print_mcg (struct in6_addr *mcg) -{ - char host[80]; - unsigned int freq; - struct in6_addr mc; - int i; - - for (i = 0; i < 8; i++) { - mc.s6_addr16[i] = ntohs (mcg->s6_addr16[i]); - } - - freq = mc.s6_addr16[6] | (mc.s6_addr16[7] & NOPID_MASK) << 3; - - inet_ntop (AF_INET6, mcg->s6_addr, (char *) host, INET6_ADDRSTRLEN); - fprintf (stdout, "MCG: %s\n", host); - +(symlink to ../common/tools.c)
View file
vdr-mcli-plugin.tar.bz2/mcast/client/win32
Changed
-(directory) +(symlink to ../common/win32)
View file
vdr-mcli-plugin.tar.bz2/mcast/common/ciparser.c
Changed
@@ -256,6 +256,7 @@ return ret; } +#if 0 STATIC int ci_decode_al_ca_info (ci_al_t * al) { int i = 0; @@ -281,10 +282,14 @@ } return data - al->data; } +#endif STATIC int ca_decode_ca_descr (ca_desc_t ** cadescr, int count, u_int8_t * data, int len, int *magic) { *cadescr = (ca_desc_t *) realloc (*cadescr, sizeof (ca_desc_t *) * (count + 1)); + if (!*cadescr) { + err ("ca_decode_ca_descr: out of memory\n"); + } ca_desc_t *c = *cadescr + count; // u_int8_t descriptor_tag = *data; @@ -371,6 +376,9 @@ while (len>0) { p.pidinfo = (pidinfo_t *) realloc (p.pidinfo, sizeof (pidinfo_t) * (pidn + 1)); + if (!p.pidinfo) { + err ("ci_decode_al_ca_pmt: out of memory"); + } memset (&p.pidinfo[pidn], 0, sizeof (pidinfo_t)); p.pidinfo[pidn].stream_type = *data; data++; @@ -450,6 +458,9 @@ while (len>0) { p.pidcaenable = (pid_ca_enable_t *) realloc (p.pidcaenable, sizeof (pid_ca_enable_t) * (pidn + 1)); + if (!p.pidcaenable) { + err ("ci_decode_al_ca_pmt_reply: out of memory\n"); + } memset (&p.pidcaenable[pidn], 0, sizeof (pid_ca_enable_t)); p.pidcaenable[pidn].pid = ntohs16 (data); data += 2;
View file
vdr-mcli-plugin.tar.bz2/mcast/common/darwin/include/linux
Changed
-(directory) +(symlink to ../../win32/include/linux)
View file
vdr-mcli-plugin.tar.bz2/mcast/common/defs.h
Changed
@@ -35,9 +35,12 @@ int inet_pton(int af, const char *src, void *dst); const char *inet_ntop(int af, const void *src, char *dst, size_t size); int inet_aton(const char *cp, struct in_addr *addr); - int getopt(int nargc, char **nargv, char *ostr); - extern int opterr, optind, optopt, optreset; - extern char *optarg; + #ifndef __MINGW32__ + int getopt(int nargc, char **nargv, char *ostr); + extern int opterr, optind, optopt, optreset; + extern char *optarg; + #define inline __inline + #endif typedef struct { @@ -65,7 +68,11 @@ #ifdef LIBRARY #define DLL_SYMBOL CALLCONV __declspec( dllexport ) #else - #define DLL_SYMBOL CALLCONV __declspec( dllimport ) + #ifdef STATICLIB + #define DLL_SYMBOL CALLCONV + #else + #define DLL_SYMBOL CALLCONV __declspec( dllimport ) + #endif #endif #define pthread_exist(x) (x).p @@ -76,6 +83,8 @@ #define LIBXML_STATIC #define PTW32_STATIC_LIB #define MULTI_THREAD_RECEIVER + + #include <poll.h> #endif #else #if defined __cplusplus @@ -305,6 +314,15 @@ fprintf(stderr, "%s:%d: %s", __FILE__ , __LINE__ , buffer ); va_end (args); } + static void inline sys(const char *format, ...) + { + char buffer[1024]; + va_list args; + va_start (args, format); + vsprintf(buffer, format , args); + printf("%s:%d: %s", __FILE__ , __LINE__ , buffer ); + va_end (args); + } #else static void inline dbg (char *format, ...) { @@ -337,6 +355,15 @@ fputs(buffer, stderr); va_end (args); } + static void inline sys(const char *format, ...) + { + char buffer[1024]; + va_list args; + va_start (args, format); + vsprintf(buffer, format, args); + fputs(buffer, stdout); + va_end (args); + } #endif //DEBUG #endif // WIN32
View file
vdr-mcli-plugin.tar.bz2/mcast/common/interfaces.c
Changed
@@ -208,11 +208,19 @@ if( /* pCurrAddresses->Flags & IP_ADAPTER_IPV6_ENABLED && */ (pCurrAddresses->IfType == IF_TYPE_ETHERNET_CSMACD || pCurrAddresses->IfType == IF_TYPE_IEEE80211) && pCurrAddresses->OperStatus == IfOperStatusUp ) { g_conf->ints=(struct intnode*)realloc(g_conf->ints, sizeof(struct intnode)*(g_conf->maxinterfaces+1)); + if (!g_conf->ints) { + err ("update_interfaces: out of memory\n"); + } intn=g_conf->ints+g_conf->maxinterfaces; memset(intn, 0, sizeof(struct intnode)); +#ifndef __MINGW32__ printf ("Interface: %s (%wS)\n", pCurrAddresses->AdapterName, pCurrAddresses->Description); dbg ("\tFriendly name: %wS\n", pCurrAddresses->FriendlyName); +#else + printf ("Interface: %s (%ls)\n", pCurrAddresses->AdapterName, pCurrAddresses->Description); + dbg ("\tFriendly name: %ls\n", pCurrAddresses->FriendlyName); +#endif dbg ("\tFlags: %x\n", pCurrAddresses->Flags); dbg ("\tIfType: %ld\n", pCurrAddresses->IfType); dbg ("\tOperStatus: %ld\n", pCurrAddresses->OperStatus);
View file
vdr-mcli-plugin.tar.bz2/mcast/common/mcast.c
Changed
@@ -10,7 +10,6 @@ */ #include "headers.h" - //---------------------------------------------------------------------------------------------------------------------------------- STATIC int udp_ipv6_is_multicast_address (const struct sockaddr *addr) { @@ -246,7 +245,8 @@ #ifndef WIN32 addr->sin6_addr=*mcg; #else - struct in6_addr any=IN6ADDR_ANY_INIT; + struct in6_addr any; + memset(&any,0,sizeof(any)); addr->sin6_addr=any; #endif addr->sin6_family = AF_INET6; @@ -347,14 +347,11 @@ from=&from_local; } - fd_set rfds; - struct timeval tv; - FD_ZERO(&rfds); - FD_SET(s->udp_fd, &rfds); - tv.tv_sec = 0; - tv.tv_usec = timeout; - - if(select(s->udp_fd+1, &rfds, NULL, NULL, &tv)>0) { + struct pollfd p; + p.fd = s->udp_fd; + p.events = POLLIN; + + if(poll(&p,1,(timeout+999)>>10)>0) { return recvfrom (s->udp_fd, (char *)buf, size, 0, (struct sockaddr *) from, &from_len); } return -1; @@ -399,6 +396,8 @@ UDPContext *gConList[MAX_CON_LIST]; pthread_mutex_t gConListLock = PTHREAD_MUTEX_INITIALIZER; static int gConListInit=0; +static int gConListModified; +static UDPContext *gConChain; STATIC void client_upd_cleanup (void *arg) { if(!gConListInit) return; @@ -422,43 +421,42 @@ unsigned char buff[MAX_BUFF_SIZE]; socklen_t from_len = sizeof (struct sockaddr_storage); struct sockaddr_storage from_local; - struct timeval timeout; struct pollfd fds[MAX_CON_LIST]; pthread_cleanup_push (client_upd_cleanup, 0); - int i; + int max_fd=0; while(1) { - int max_fd=0; + UDPContext *e; pthread_mutex_lock(&gConListLock); - for(i=0;i<MAX_CON_LIST;i++) { - if(gConList[i]) { - fds[max_fd].fd = gConList[i]->udp_fd; + if(gConListModified) { + gConListModified=0; + max_fd=0; + for(e=gConChain;e;e=e->next) { + fds[max_fd].fd = e->udp_fd; fds[max_fd].events = POLLIN; fds[max_fd].revents = 0; - gConList[i]->pfd = &fds[max_fd]; + e->pfd = &fds[max_fd]; max_fd++; - } // if - } // for + } // for + } // if pthread_mutex_unlock(&gConListLock); - timeout.tv_sec = 0; - timeout.tv_usec = 100000; int rs = poll(fds, max_fd, 1000); if(rs>0) { pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, NULL); pthread_mutex_lock(&gConListLock); - for(i=0;i<MAX_CON_LIST;i++) { - if(gConList[i] && gConList[i]->pfd && (gConList[i]->pfd->revents & POLLIN)) { - if(gConList[i]->cb) { - int ret = recvfrom (gConList[i]->udp_fd, (char *)buff, MAX_BUFF_SIZE, 0, 0, 0/*(struct sockaddr *) &from_local, &from_len*/); + for(e=gConChain;e;e=e->next) { + if(e->pfd && (e->pfd->revents & POLLIN)) { + if(e->cb) { + int ret = recvfrom (e->udp_fd, (char *)buff, MAX_BUFF_SIZE, 0, 0, 0/*(struct sockaddr *) &from_local, &from_len*/); if(ret>0) - gConList[i]->cb(buff, ret, gConList[i]->arg); - } else if(gConList[i]->buff && !gConList[i]->bufflen) { - pthread_mutex_lock(&gConList[i]->bufflock); - int ret = recvfrom (gConList[i]->udp_fd, (char *)gConList[i]->buff, gConList[i]->buffmax, 0, (struct sockaddr *) &from_local, &from_len); + e->cb(buff, ret, e->arg); + } else if(e->buff && !e->bufflen) { + pthread_mutex_lock(&e->bufflock); + int ret = recvfrom (e->udp_fd, (char *)e->buff, e->buffmax, 0, (struct sockaddr *) &from_local, &from_len); if(ret>0) - gConList[i]->bufflen = ret; - pthread_mutex_unlock(&gConList[i]->bufflock); + e->bufflen = ret; + pthread_mutex_unlock(&e->bufflock); } // if } // if } // for @@ -478,6 +476,8 @@ return 1; } // if memset(&gConList, 0, sizeof(gConList)); + gConListModified = 0; + gConChain = NULL; pthread_t client_upd_thread; if(0==pthread_create (&client_upd_thread, NULL, client_upd_process, 0)) { gConListInit = 1; @@ -493,6 +493,9 @@ ret->buff = (unsigned char *)malloc(buff_size); ret->buffmax = buff_size; ret->bufflen = 0; + if (!ret->buff) { + err ("client_udp_open_buff: out of memory\n"); + } } // if return ret; } // client_udp_open_buff @@ -597,6 +600,9 @@ for(i=0;i<MAX_CON_LIST;i++) { if(!gConList[i]) { gConList[i]=s; + gConListModified=1; + s->next=gConChain; + gConChain=s; break; } // if } // for @@ -640,9 +646,20 @@ { int i; pthread_mutex_lock(&gConListLock); - for(i=0;i<MAX_CON_LIST;i++) - if(gConList[i] == s) + for(i=0;i<MAX_CON_LIST;i++) { + if(gConList[i] == s) { gConList[i]=0; + gConListModified=1; + UDPContext **e; + for(e=&gConChain;*e;e=&(*e)->next) { + if(*e == s) { + *e=(*e)->next; + break; + } + } + break; + } + } pthread_mutex_unlock(&gConListLock); if (s->is_multicast) udp_ipv6_leave_multicast_group (s->udp_fd, s->idx, (struct sockaddr *) &s->dest_addr);
View file
vdr-mcli-plugin.tar.bz2/mcast/common/mcast.h
Changed
@@ -14,8 +14,9 @@ typedef void (*client_udp_cb)(unsigned char *buf, int n, void *arg); -typedef struct +typedef struct _UDPContext { + struct _UDPContext *next; SOCKET udp_fd; int ttl; int idx;
View file
vdr-mcli-plugin.tar.bz2/mcast/common/recv_ccpp.c
Changed
@@ -256,7 +256,7 @@ if (c.key) { dbg ("SymbolRate: %s\n", c.key); int val=atoi ((char *) c.key); - switch(tra->fe_type) { + switch((int)tra->fe_type) { case FE_DVBS2: case FE_QPSK: tra->fep.u.qpsk.symbol_rate=val; @@ -275,7 +275,7 @@ if (c.key) { dbg ("FecInner: %s\n", c.key); int val=atoi ((char *) c.key); - switch(tra->fe_type) { + switch((int)tra->fe_type) { case FE_DVBS2: case FE_QPSK: tra->fep.u.qpsk.fec_inner=(fe_code_rate_t)val; @@ -294,7 +294,7 @@ if (c.key) { dbg ("Modulation: %s\n", c.key); int val=atoi ((char *) c.key); - switch(tra->fe_type) { + switch((int)tra->fe_type) { case FE_QAM: tra->fep.u.qam.modulation=(fe_modulation_t)val; break;
View file
vdr-mcli-plugin.tar.bz2/mcast/common/satlists.h
Changed
@@ -7,6 +7,7 @@ */ #define DISEQC_MAX_EXTRA 8 +#define MAX_EXTRA_DATA 16 typedef enum { @@ -36,8 +37,9 @@ typedef enum { - SAT_SRC_LNB, - SAT_SRC_ROTOR, + SAT_SRC_LNB=0, + SAT_SRC_ROTOR=1, + SAT_SRC_UNI=2, // !!! match DISEQC_* values in dvb_server.h !!! } satellite_source_t; typedef struct @@ -57,6 +59,8 @@ int AutoFocus; int Latitude; int Longitude; + int num_extra_data; + int extra_data[MAX_EXTRA_DATA]; // reserved } satellite_info_t; typedef struct satellite_list
View file
vdr-mcli-plugin.tar.bz2/mcast/common/siparser.c
Changed
@@ -227,6 +227,10 @@ *month = m; *day = d; + } else { + *year = 0; + *month = 0; + *day = 0; } } @@ -243,7 +247,7 @@ long y,m,d; get_time_mjd(mjd, &y, &m, &d); - info("TIME: [= %02d-%02d-%02d %02lx:%02lx:%02lx (UTC) ]\n\n",y,m,d,(utc>>16) &0xFF, (utc>>8) &0xFF, (utc) &0xFF); + info("TIME: [= %02ld-%02ld-%02ld %02x:%02x:%02x (UTC) ]\n\n",y,m,d,(utc>>16) &0xFF, (utc>>8) &0xFF, (utc) &0xFF); info("--------------------------------------------------------------\n"); } @@ -256,7 +260,7 @@ info("Reserverd : %d (%#x)\n",p->reserved,p->reserved); info("CA pid : %d (%#x)\n",p->ca_pid,p->ca_pid); - printhex_buf("Private data",p->private_data,p->descriptor_length-4); + printhex_buf((char *)"Private data",p->private_data,p->descriptor_length-4); } //----------------------------------------------------------------------------------- @@ -488,7 +492,7 @@ pmt_hdr->reserved_1=(ptr[1] >> 4) & 3; pmt_hdr->section_length=((ptr[1] << 8) | ptr[2]) & 0xfff; - if (pmt_hdr->section_length < 13 || pmt_hdr->section_length > 1021 || pmt_hdr->section_length > size) { + if (pmt_hdr->section_length < 13 || pmt_hdr->section_length > 1021 || (int)pmt_hdr->section_length > size) { info("#####\nERROR: Invalid section length!\n"); return -1; } @@ -505,12 +509,12 @@ } pmt_hdr->program_number=(ptr[3] << 8) | ptr[4]; - if (pmt_hdr->program_number != sid) { + if ((int)pmt_hdr->program_number != sid) { info("#####\nERROR: Invalid SID in PMT !!!\n"); return -1; } pmt_hdr->program_info_length=((ptr[10] << 8) | ptr[11]) & 0x0fff; - if (pmt_hdr->program_info_length < 0 || pmt_hdr->program_info_length > 1021 - 9 || pmt_hdr->program_info_length > size - 9) { + if (pmt_hdr->program_info_length < 0 || pmt_hdr->program_info_length > 1021 - 9 || (int)pmt_hdr->program_info_length > size - 9) { info("#####\nERROR: Invalid PI length in PMT!\n"); return -1; } @@ -570,6 +574,10 @@ //parsing ok we can take this program level descriptors if (pm_cads->size && pm_cads->cads) { pm_cads->cad = (unsigned char*)malloc(sizeof(unsigned char)*pm_cads->size); + if (!pm_cads->cad) { + info("ERROR: parse_ca_desc() : out of memory\n"); + return -1; + } memcpy(pm_cads->cad, tmp, pm_cads->size); } @@ -588,7 +596,7 @@ esi.reserved_2=(ptr[3] >> 4) & 0xf; esi.es_info_length=((ptr[3] << 8) | ptr[4]) & 0x0fff; - if (esi.es_info_length > buf_len) { + if ((int)esi.es_info_length > buf_len) { info("PMT: Invalid ES info length !\n"); err = -1; break; @@ -684,6 +692,12 @@ //parsing ok we can take this ES level descriptors if (((es_cads->cads && es_cads->size) || (pm_cads->cads && es_cads->size)) || *fta) { //take ES stream info if we have PM or ES desc. es_cads->cad = (unsigned char*)malloc(sizeof(unsigned char)*es_cads->size); + if (!es_cads->cad) { + info("ERROR: parse_ca_desc() : out of memory\n"); + if (pm_cads->cad) + free(pm_cads->cad); + return -1; + } memcpy(es_cads->cad, tmp, es_cads->size); } @@ -700,9 +714,9 @@ print_pmt(&pmt_hdr); #endif //cleanup ... - if (pm_cads->size) + if (pm_cads->cad) free(pm_cads->cad); - if (es_cads->size) + if (es_cads->cad) free(es_cads->cad); *es_pid_num = 0; memset(pm_cads,0,sizeof(si_ca_pmt_t)); @@ -728,7 +742,7 @@ c.reserved_1 = (ptr[1] >> 4) & 3; c.section_length = ((ptr[1] << 8) | ptr[2]) & 0xfff; - if (c.section_length < 9 || c.section_length > 1021 || c.section_length > size) { + if (c.section_length < 9 || c.section_length > 1021 || (int)c.section_length > size) { info("CAT: Invalid section length!\n"); return -1; } @@ -795,7 +809,7 @@ p.reserved_1=(ptr[1] & 0x30) >> 4; p.section_length=((ptr[1] << 8) | ptr[2]) & 0x0fff; - if (p.section_length < 9 || p.section_length > 1021 || p.section_length > size) { + if (p.section_length < 9 || p.section_length > 1021 || (int)p.section_length > size) { info("PAT: Invalid section length !\n"); return -1; @@ -825,6 +839,10 @@ pmt_num=0; if (n > 0 && ((ptr + n) < (buf + size))) { pat_info=(pat_list_t *)malloc(sizeof(pat_list_t)*n/4); + if (!pat_info) { + info ("PAT: out of memory\n"); + return -1; + } for(i=0;i<n;i+=4) { pat_list_t *pat = pat_info + pmt_num; pat->program_number=(ptr[0] << 8) | (ptr[1]); @@ -840,6 +858,10 @@ p.crc32=(ptr[0] << 24) | (ptr[1] << 16) | (ptr[2] << 8) | ptr[3]; if (n != pmt_num) pat_info=(pat_list_t *)realloc(pat_info,sizeof(pat_list_t)*pmt_num); + if (!pat_info) { + info("parse_pat_sect():realloc error\n"); + return -1; + } } if (pmt) { pmt->p=p; @@ -913,7 +935,7 @@ } - if (pid_req != h.pid) { + if (pid_req != (int)h.pid) { #ifdef DBG info("%s:pids mismatch (pid req = %#x ts pid = %#x )!\n", __FUNCTION__,pid_req, h.pid); #endif @@ -972,21 +994,21 @@ if (!h.payload_unit_start_indicator && p->start) { //packet continuation //duplicate packet - if ((p->pid == h.pid) && (p->continuity == h.continuity_counter)){ + if ((p->pid == (int)h.pid) && (p->continuity == (int)h.continuity_counter)){ #ifdef DBG info("Packet duplicate ???\n"); #endif return -1; } //new packet - if (p->pid != h.pid) { + if (p->pid != (int)h.pid) { #ifdef DBG info("New pid buf start %d len %d bytes (pid in buf = %d pid in ts = %d) !\n", p->start,p->len, p->pid, h.pid); #endif return -1; } //discontinuity of packets - if (((++p->continuity)%16) != h.continuity_counter) { + if (((++p->continuity)%16) != (int)h.continuity_counter) { #ifdef DBG info("Discontinuity of ts stream !!!\n"); #endif
View file
vdr-mcli-plugin.tar.bz2/mcast/common/tools.c
Changed
@@ -236,7 +236,7 @@ fmul = 12.0 * (((double) fep->frequency) + 1041); Frequency = (unsigned int) (fmul / 25000.0); - switch (type) { + switch ((int)type) { case FE_QPSK: case FE_DVBS2: Frequency = (fep->frequency + 24) / 50; @@ -349,7 +349,7 @@ if (type) { *type = fetype; } - switch (fetype) { + switch ((int)fetype) { case FE_QPSK: case FE_DVBS2: {
View file
vdr-mcli-plugin.tar.bz2/mcast/common/win32/include/poll.h
Added
@@ -0,0 +1,20 @@ +#ifndef _POLL_H_H_ +#define _POLL_H_H_ + +struct pollfd { + int fd; + short events; + short revents; +}; + +#define POLLIN 001 +#define POLLPRI 002 +#define POLLOUT 004 +#define POLLNORM POLLIN +#define POLLERR 010 +#define POLLHUP 020 +#define POLLNVAL 040 + +DLL_SYMBOL int poll(struct pollfd *, int, int); + +#endif /* _POLL_H_H_ */
View file
vdr-mcli-plugin.tar.bz2/mcast/common/win32/poll.c
Added
@@ -0,0 +1,57 @@ +#include <defs.h> + +int poll(struct pollfd *p,int n,int tmo) +{ + struct timeval timeout, *tptr; + fd_set in, out, err, *pin, *pout; + int i, m; + + FD_ZERO(&err); + for (i = 0, m = -1, pout = pin = NULL; i < n; i++) { + p[i].revents = 0; + if (p[i].fd < 0) + continue; + if (p[i].fd > m) + m = p[i].fd; + if (p[i].events & (POLLIN|POLLPRI)) { + if (!pin) { + FD_ZERO(&in); + pin = ∈ + } + FD_SET(p[i].fd, pin); + } + if (p[i].events & POLLOUT) { + if (!pout) { + FD_ZERO(&out); + pout = &out; + } + FD_SET(p[i].fd, pout); + } + FD_SET(p[i].fd, &err); + } + if (tmo < 0) + tptr = NULL; + else { + tptr = &timeout; + timeout.tv_sec = tmo / 1000; + timeout.tv_usec = (tmo % 1000) * 1000; + } + + i = select(m+1, pin, pout, &err, tptr); + if (i <= 0) + return i; + + for (i = 0, m = 0; i < n; i++) { + if (p[i].fd < 0) + continue; + if ((p[i].events & (POLLIN|POLLPRI)) && FD_ISSET(p[i].fd, pin)) + p[i].revents |= POLLIN; + if ((p[i].events & POLLOUT) && FD_ISSET(p[i].fd, pout)) + p[i].revents |= POLLOUT; + if (FD_ISSET(p[i].fd, &err)) + p[i].revents |= POLLHUP; + if (p[i].revents) + m++; + } + return m; +}
View file
vdr-mcli-plugin.tar.bz2/mcast/dvbfuse/crc32.c
Changed
@@ -1,88 +0,0 @@ -/* - * (c) BayCom GmbH, http://www.baycom.de, info@baycom.de - * - * See the COPYING file for copyright information and - * how to reach the author. - * - */ - -/* -$Id: crc32.c,v 1.2 2006/01/02 18:24:04 rasc Exp $ - - - DVBSNOOP - - a dvb sniffer and mpeg2 stream analyzer tool - http://dvbsnoop.sourceforge.net/ - - (c) 2001-2006 Rainer.Scherg@gmx.de (rasc) - - - -- Code Module CRC32 taken von linuxtv.org -*/ - - - - -#include "defs.h" -#include "crc32.h" - - - -// CRC32 lookup table for polynomial 0x04c11db7 - -static u_long crc_table[256] = { - 0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b, - 0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, 0x2b4bcb61, - 0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd, 0x4c11db70, 0x48d0c6c7, - 0x4593e01e, 0x4152fda9, 0x5f15adac, 0x5bd4b01b, 0x569796c2, 0x52568b75, - 0x6a1936c8, 0x6ed82b7f, 0x639b0da6, 0x675a1011, 0x791d4014, 0x7ddc5da3, - 0x709f7b7a, 0x745e66cd, 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039, - 0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5, 0xbe2b5b58, 0xbaea46ef, - 0xb7a96036, 0xb3687d81, 0xad2f2d84, 0xa9ee3033, 0xa4ad16ea, 0xa06c0b5d, - 0xd4326d90, 0xd0f37027, 0xddb056fe, 0xd9714b49, 0xc7361b4c, 0xc3f706fb, - 0xceb42022, 0xca753d95, 0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1, - 0xe13ef6f4, 0xe5ffeb43, 0xe8bccd9a, 0xec7dd02d, 0x34867077, 0x30476dc0, - 0x3d044b19, 0x39c556ae, 0x278206ab, 0x23431b1c, 0x2e003dc5, 0x2ac12072, - 0x128e9dcf, 0x164f8078, 0x1b0ca6a1, 0x1fcdbb16, 0x018aeb13, 0x054bf6a4, - 0x0808d07d, 0x0cc9cdca, 0x7897ab07, 0x7c56b6b0, 0x71159069, 0x75d48dde, - 0x6b93dddb, 0x6f52c06c, 0x6211e6b5, 0x66d0fb02, 0x5e9f46bf, 0x5a5e5b08, - 0x571d7dd1, 0x53dc6066, 0x4d9b3063, 0x495a2dd4, 0x44190b0d, 0x40d816ba, - 0xaca5c697, 0xa864db20, 0xa527fdf9, 0xa1e6e04e, 0xbfa1b04b, 0xbb60adfc, - 0xb6238b25, 0xb2e29692, 0x8aad2b2f, 0x8e6c3698, 0x832f1041, 0x87ee0df6, - 0x99a95df3, 0x9d684044, 0x902b669d, 0x94ea7b2a, 0xe0b41de7, 0xe4750050, - 0xe9362689, 0xedf73b3e, 0xf3b06b3b, 0xf771768c, 0xfa325055, 0xfef34de2, - 0xc6bcf05f, 0xc27dede8, 0xcf3ecb31, 0xcbffd686, 0xd5b88683, 0xd1799b34, - 0xdc3abded, 0xd8fba05a, 0x690ce0ee, 0x6dcdfd59, 0x608edb80, 0x644fc637, - 0x7a089632, 0x7ec98b85, 0x738aad5c, 0x774bb0eb, 0x4f040d56, 0x4bc510e1, - 0x46863638, 0x42472b8f, 0x5c007b8a, 0x58c1663d, 0x558240e4, 0x51435d53, - 0x251d3b9e, 0x21dc2629, 0x2c9f00f0, 0x285e1d47, 0x36194d42, 0x32d850f5, - 0x3f9b762c, 0x3b5a6b9b, 0x0315d626, 0x07d4cb91, 0x0a97ed48, 0x0e56f0ff, - 0x1011a0fa, 0x14d0bd4d, 0x19939b94, 0x1d528623, 0xf12f560e, 0xf5ee4bb9, - 0xf8ad6d60, 0xfc6c70d7, 0xe22b20d2, 0xe6ea3d65, 0xeba91bbc, 0xef68060b, - 0xd727bbb6, 0xd3e6a601, 0xdea580d8, 0xda649d6f, 0xc423cd6a, 0xc0e2d0dd, - 0xcda1f604, 0xc960ebb3, 0xbd3e8d7e, 0xb9ff90c9, 0xb4bcb610, 0xb07daba7, - 0xae3afba2, 0xaafbe615, 0xa7b8c0cc, 0xa379dd7b, 0x9b3660c6, 0x9ff77d71, - 0x92b45ba8, 0x9675461f, 0x8832161a, 0x8cf30bad, 0x81b02d74, 0x857130c3, - 0x5d8a9099, 0x594b8d2e, 0x5408abf7, 0x50c9b640, 0x4e8ee645, 0x4a4ffbf2, - 0x470cdd2b, 0x43cdc09c, 0x7b827d21, 0x7f436096, 0x7200464f, 0x76c15bf8, - 0x68860bfd, 0x6c47164a, 0x61043093, 0x65c52d24, 0x119b4be9, 0x155a565e, - 0x18197087, 0x1cd86d30, 0x029f3d35, 0x065e2082, 0x0b1d065b, 0x0fdc1bec, - 0x3793a651, 0x3352bbe6, 0x3e119d3f, 0x3ad08088, 0x2497d08d, 0x2056cd3a, - 0x2d15ebe3, 0x29d4f654, 0xc5a92679, 0xc1683bce, 0xcc2b1d17, 0xc8ea00a0, - 0xd6ad50a5, 0xd26c4d12, 0xdf2f6bcb, 0xdbee767c, 0xe3a1cbc1, 0xe760d676, - 0xea23f0af, 0xeee2ed18, 0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4, - 0x89b8fd09, 0x8d79e0be, 0x803ac667, 0x84fbdbd0, 0x9abc8bd5, 0x9e7d9662, - 0x933eb0bb, 0x97ffad0c, 0xafb010b1, 0xab710d06, 0xa6322bdf, 0xa2f33668, - 0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4}; - -uint32_t dvb_crc32 (char *data, int len) -{ - register int i; - u_long crc = 0xffffffff; - - for (i=0; i<len; i++) - crc = (crc << 8) ^ crc_table[((crc >> 24) ^ *data++) & 0xff]; - - return crc; -} +(symlink to ../common/crc32.c)
View file
vdr-mcli-plugin.tar.bz2/mcast/dvbfuse/libmcli.so
Added
+(symlink to ../client/libmcli.so)
View file
vdr-mcli-plugin.tar.bz2/mcast/dvbfuse/siparser.c
Changed
@@ -1,1027 +0,0 @@ -#include "headers.h" - -//#define DBG 1 -#define CRC32_CHECK 1 - -enum ca_desc_type { EMM, ECM }; - -//----------------------------------------------------------------------------------- -void printhex_buf(char *msg,unsigned char *buf,int len) -{ - int i,j,k; - int width=8; - - i=k=0; - sys ("%s: %d bytes (0x%04x)\n",msg,len,len); - sys ("---------------------------------------------------------------\n"); - while(len) { - sys ("%04x ",k++*width*2); - j=i; - for(;i < j + width ; i++){ - if (i >= len) break; - sys ("%02x ",buf[i]); - } - if (i >= len) { - sys ("\n"); - break; - } - sys(" "); - j=i; - for(;i < j + width ; i++){ - if (i >= len) break; - sys("%02x ",buf[i]); - } - sys("\n"); - if (i >= len) break; - } - sys("---------------------------------------------------------------\n"); -} -//----------------------------------------------------------------------------------- -void writehex_buf(FILE *f, char *msg,unsigned char *buf,int len) -{ - int i,j,k; - int width=8; - - i=k=0; - fprintf(f,"%s: %d bytes (0x%04x)\n",msg,len,len); - fprintf(f,"---------------------------------------------------------------\n"); - while(len) { - fprintf(f,"%04x ",k++*width*2); - j=i; - for(;i < j + width ; i++){ - if (i >= len) break; - fprintf(f,"%02x ",buf[i]); - } - if (i >= len) { - fprintf(f,"\n"); - break; - } - fprintf(f," "); - j=i; - for(;i < j + width ; i++){ - if (i >= len) break; - fprintf(f,"%02x ",buf[i]); - } - fprintf(f,"\n"); - if (i >= len) break; - } - fprintf(f,"---------------------------------------------------------------\n"); - - -} -//----------------------------------------------------------------------------------- -void print_ts_header(ts_packet_hdr_t *p) -{ - info("--------------------------------------------------------------\n"); - info("TS header data:\n"); - info("Sync-byte : 0x%04x\n",p->sync_byte); - info("Transport error indicator : 0x%04x\n",p->transport_error_indicator); - info("Payload unit start indicator : 0x%04x\n",p->payload_unit_start_indicator); - info("Transport priority : 0x%04x\n",p->transport_priority); - info("PID : 0x%04x\n",p->pid); - info("Transport scrambling control : 0x%04x\n",p->transport_scrambling_control); - info("Adaptation field control : 0x%04x\n",p->adaptation_field_control); - info("Continuity_counter : 0x%04x\n",p->continuity_counter); - -} -//----------------------------------------------------------------------------------- -void print_pmt(pmt_t *p) -{ - info("--------------------------------------------------------------\n"); - info("PMT section:\n"); - info("Table ID : %-5d (0x%04x)\n",p->table_id,p->table_id); - info("(fixed): : %-5d (0x%04x)\n",0,0); - info("Section syntax indicator : %-5d (0x%04x)\n",p->section_syntax_indicator,p->section_syntax_indicator); - info("Reserved 1 : %-5d (0x%04x)\n",p->reserved_1,p->reserved_1); - info("Section length : %-5d (0x%04x)\n",p->section_length,p->section_length); - info("Program number : %-5d (0x%04x)\n",p->program_number,p->program_number); - info("Reserved 2 : %-5d (0x%04x)\n",p->reserved_2,p->reserved_2); - info("Version number : %-5d (0x%04x)\n",p->version_number,p->version_number); - info("Current next indicator : %-5d (0x%04x)\n",p->current_next_indicator,p->current_next_indicator); - info("Section number : %-5d (0x%04x)\n",p->section_number,p->section_number); - info("Last section number : %-5d (0x%04x)\n",p->last_section_number,p->last_section_number); - info("Reserved 3 : %-5d (0x%04x)\n",p->reserved_3,p->reserved_3); - info("PCR pid : %-5d (0x%04x)\n",p->pcr_pid,p->pcr_pid); - info("Reserved 4 : %-5d (0x%04x)\n",p->reserved_4,p->reserved_4); - info("Program info length : %-5d (0x%04x)\n",p->program_info_length,p->program_info_length); - - - - info("CRC32 : 0x%04x\n",p->crc32); -} -//----------------------------------------------------------------------------------- -void print_pat(pat_t *p, pat_list_t *pl, int pmt_num) -{ - info("--------------------------------------------------------------\n"); - info("PAT section:\n"); - info("Table_id : %-5d (0x%04x)\n",p->table_id,p->table_id); - info("(fixed): : %-5d (0x%04x)\n",0,0); - info("Section syntax indicator : %-5d (0x%04x)\n",p->section_syntax_indicator,p->section_syntax_indicator); - info("Reserved_1 : %-5d (0x%04x)\n",p->reserved_1,p->reserved_1); - info("Section length : %-5d (0x%04x)\n",p->section_length,p->section_length); - info("Transport stream id : %-5d (0x%04x)\n",p->transport_stream_id,p->transport_stream_id); - info("Reserved 2 : %-5d (0x%04x)\n",p->reserved_2,p->reserved_2); - info("Version number : %-5d (0x%04x)\n",p->version_number,p->version_number); - info("Current next indicator : %-5d (0x%04x)\n",p->current_next_indicator,p->current_next_indicator); - info("Section number : %-5d (0x%04x)\n",p->section_number,p->section_number); - info("Last section number : %-5d (0x%04x)\n",p->last_section_number,p->last_section_number); - - if (pl && pmt_num){ - int i; - info("Number of PMTs in PAT : %-5d \n", pmt_num); - for(i=0;i<pmt_num;i++) { - pat_list_t *pat = pl + i; - info("\nProgram number : %-5d (0x%04x)\n",pat->program_number,pat->program_number); - info("Reserved : %-5d (0x%04x)\n",pat->reserved,pat->reserved); - info("Network PMT PID : %-5d (0x%04x)\n",pat->network_pmt_pid,pat->network_pmt_pid); - } - } - - info("CRC32 : 0x%04x\n",p->crc32); - - -} -//----------------------------------------------------------------------------------- -char *si_caid_to_name(unsigned int caid) -{ - - str_table table[] = { - // -- updated from dvb.org 2003-10-16 - { 0x0000, 0x0000, "Reserved" }, - { 0x0001, 0x00FF, "Standardized Systems" }, - { 0x0100, 0x01FF, "Canal Plus (Seca/MediaGuard)" }, - { 0x0200, 0x02FF, "CCETT" }, - { 0x0300, 0x03FF, "MSG MediaServices GmbH" }, - { 0x0400, 0x04FF, "Eurodec" }, - { 0x0500, 0x05FF, "France Telecom (Viaccess)" }, - { 0x0600, 0x06FF, "Irdeto" }, - { 0x0700, 0x07FF, "Jerrold/GI/Motorola" }, - { 0x0800, 0x08FF, "Matra Communication" }, - { 0x0900, 0x09FF, "News Datacom (Videoguard)" }, - { 0x0A00, 0x0AFF, "Nokia" }, - { 0x0B00, 0x0BFF, "Norwegian Telekom (Conax)" }, - { 0x0C00, 0x0CFF, "NTL" }, - { 0x0D00, 0x0DFF, "Philips (Cryptoworks)" }, - { 0x0E00, 0x0EFF, "Scientific Atlanta (Power VU)" }, - { 0x0F00, 0x0FFF, "Sony" }, - { 0x1000, 0x10FF, "Tandberg Television" }, - { 0x1100, 0x11FF, "Thompson" }, - { 0x1200, 0x12FF, "TV/COM" }, - { 0x1300, 0x13FF, "HPT - Croatian Post and Telecommunications" }, - { 0x1400, 0x14FF, "HRT - Croatian Radio and Television" }, - { 0x1500, 0x15FF, "IBM" }, - { 0x1600, 0x16FF, "Nera" }, - { 0x1700, 0x17FF, "Beta Technik (Betacrypt)" }, - { 0x1800, 0x18FF, "Kudelski SA"}, - { 0x1900, 0x19FF, "Titan Information Systems"}, - { 0x2000, 0x20FF, "TelefXnica Servicios Audiovisuales"}, - { 0x2100, 0x21FF, "STENTOR (France Telecom, CNES and DGA)"}, - { 0x2200, 0x22FF, "Scopus Network Technologies"}, - { 0x2300, 0x23FF, "BARCO AS"}, - { 0x2400, 0x24FF, "StarGuide Digital Networks "}, - { 0x2500, 0x25FF, "Mentor Data System, Inc."}, - { 0x2600, 0x26FF, "European Broadcasting Union"}, - { 0x4700, 0x47FF, "General Instrument"}, - { 0x4800, 0x48FF, "Telemann"}, - { 0x4900, 0x49FF, "Digital TV Industry Alliance of China"}, - { 0x4A00, 0x4A0F, "Tsinghua TongFang"}, - { 0x4A10, 0x4A1F, "Easycas"}, - { 0x4A20, 0x4A2F, "AlphaCrypt"}, - { 0x4A30, 0x4A3F, "DVN Holdings"}, - { 0x4A40, 0x4A4F, "Shanghai Advanced Digital Technology Co. Ltd. (ADT)"}, - { 0x4A50, 0x4A5F, "Shenzhen Kingsky Company (China) Ltd"}, - { 0x4A60, 0x4A6F, "@SKY"}, - { 0x4A70, 0x4A7F, "DreamCrypt"}, - { 0x4A80, 0x4A8F, "THALESCrypt"}, - { 0x4A90, 0x4A9F, "Runcom Technologies"}, - { 0x4AA0, 0x4AAF, "SIDSA"}, - { 0x4AB0, 0x4ABF, "Beijing Comunicate Technology Inc."}, - { 0x4AC0, 0x4ACF, "Latens Systems Ltd"}, +(symlink to ../common/siparser.c)
View file
vdr-mcli-plugin.tar.bz2/mcast/netcv2dvbip/crc32.c
Changed
@@ -1,88 +0,0 @@ -/* - * (c) BayCom GmbH, http://www.baycom.de, info@baycom.de - * - * See the COPYING file for copyright information and - * how to reach the author. - * - */ - -/* -$Id: crc32.c,v 1.2 2006/01/02 18:24:04 rasc Exp $ - - - DVBSNOOP - - a dvb sniffer and mpeg2 stream analyzer tool - http://dvbsnoop.sourceforge.net/ - - (c) 2001-2006 Rainer.Scherg@gmx.de (rasc) - - - -- Code Module CRC32 taken von linuxtv.org -*/ - - - - -#include "defs.h" -#include "crc32.h" - - - -// CRC32 lookup table for polynomial 0x04c11db7 - -static u_long crc_table[256] = { - 0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b, - 0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, 0x2b4bcb61, - 0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd, 0x4c11db70, 0x48d0c6c7, - 0x4593e01e, 0x4152fda9, 0x5f15adac, 0x5bd4b01b, 0x569796c2, 0x52568b75, - 0x6a1936c8, 0x6ed82b7f, 0x639b0da6, 0x675a1011, 0x791d4014, 0x7ddc5da3, - 0x709f7b7a, 0x745e66cd, 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039, - 0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5, 0xbe2b5b58, 0xbaea46ef, - 0xb7a96036, 0xb3687d81, 0xad2f2d84, 0xa9ee3033, 0xa4ad16ea, 0xa06c0b5d, - 0xd4326d90, 0xd0f37027, 0xddb056fe, 0xd9714b49, 0xc7361b4c, 0xc3f706fb, - 0xceb42022, 0xca753d95, 0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1, - 0xe13ef6f4, 0xe5ffeb43, 0xe8bccd9a, 0xec7dd02d, 0x34867077, 0x30476dc0, - 0x3d044b19, 0x39c556ae, 0x278206ab, 0x23431b1c, 0x2e003dc5, 0x2ac12072, - 0x128e9dcf, 0x164f8078, 0x1b0ca6a1, 0x1fcdbb16, 0x018aeb13, 0x054bf6a4, - 0x0808d07d, 0x0cc9cdca, 0x7897ab07, 0x7c56b6b0, 0x71159069, 0x75d48dde, - 0x6b93dddb, 0x6f52c06c, 0x6211e6b5, 0x66d0fb02, 0x5e9f46bf, 0x5a5e5b08, - 0x571d7dd1, 0x53dc6066, 0x4d9b3063, 0x495a2dd4, 0x44190b0d, 0x40d816ba, - 0xaca5c697, 0xa864db20, 0xa527fdf9, 0xa1e6e04e, 0xbfa1b04b, 0xbb60adfc, - 0xb6238b25, 0xb2e29692, 0x8aad2b2f, 0x8e6c3698, 0x832f1041, 0x87ee0df6, - 0x99a95df3, 0x9d684044, 0x902b669d, 0x94ea7b2a, 0xe0b41de7, 0xe4750050, - 0xe9362689, 0xedf73b3e, 0xf3b06b3b, 0xf771768c, 0xfa325055, 0xfef34de2, - 0xc6bcf05f, 0xc27dede8, 0xcf3ecb31, 0xcbffd686, 0xd5b88683, 0xd1799b34, - 0xdc3abded, 0xd8fba05a, 0x690ce0ee, 0x6dcdfd59, 0x608edb80, 0x644fc637, - 0x7a089632, 0x7ec98b85, 0x738aad5c, 0x774bb0eb, 0x4f040d56, 0x4bc510e1, - 0x46863638, 0x42472b8f, 0x5c007b8a, 0x58c1663d, 0x558240e4, 0x51435d53, - 0x251d3b9e, 0x21dc2629, 0x2c9f00f0, 0x285e1d47, 0x36194d42, 0x32d850f5, - 0x3f9b762c, 0x3b5a6b9b, 0x0315d626, 0x07d4cb91, 0x0a97ed48, 0x0e56f0ff, - 0x1011a0fa, 0x14d0bd4d, 0x19939b94, 0x1d528623, 0xf12f560e, 0xf5ee4bb9, - 0xf8ad6d60, 0xfc6c70d7, 0xe22b20d2, 0xe6ea3d65, 0xeba91bbc, 0xef68060b, - 0xd727bbb6, 0xd3e6a601, 0xdea580d8, 0xda649d6f, 0xc423cd6a, 0xc0e2d0dd, - 0xcda1f604, 0xc960ebb3, 0xbd3e8d7e, 0xb9ff90c9, 0xb4bcb610, 0xb07daba7, - 0xae3afba2, 0xaafbe615, 0xa7b8c0cc, 0xa379dd7b, 0x9b3660c6, 0x9ff77d71, - 0x92b45ba8, 0x9675461f, 0x8832161a, 0x8cf30bad, 0x81b02d74, 0x857130c3, - 0x5d8a9099, 0x594b8d2e, 0x5408abf7, 0x50c9b640, 0x4e8ee645, 0x4a4ffbf2, - 0x470cdd2b, 0x43cdc09c, 0x7b827d21, 0x7f436096, 0x7200464f, 0x76c15bf8, - 0x68860bfd, 0x6c47164a, 0x61043093, 0x65c52d24, 0x119b4be9, 0x155a565e, - 0x18197087, 0x1cd86d30, 0x029f3d35, 0x065e2082, 0x0b1d065b, 0x0fdc1bec, - 0x3793a651, 0x3352bbe6, 0x3e119d3f, 0x3ad08088, 0x2497d08d, 0x2056cd3a, - 0x2d15ebe3, 0x29d4f654, 0xc5a92679, 0xc1683bce, 0xcc2b1d17, 0xc8ea00a0, - 0xd6ad50a5, 0xd26c4d12, 0xdf2f6bcb, 0xdbee767c, 0xe3a1cbc1, 0xe760d676, - 0xea23f0af, 0xeee2ed18, 0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4, - 0x89b8fd09, 0x8d79e0be, 0x803ac667, 0x84fbdbd0, 0x9abc8bd5, 0x9e7d9662, - 0x933eb0bb, 0x97ffad0c, 0xafb010b1, 0xab710d06, 0xa6322bdf, 0xa2f33668, - 0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4}; - -uint32_t dvb_crc32 (char *data, int len) -{ - register int i; - u_long crc = 0xffffffff; - - for (i=0; i<len; i++) - crc = (crc << 8) ^ crc_table[((crc >> 24) ^ *data++) & 0xff]; - - return crc; -} +(symlink to ../common/crc32.c)
View file
vdr-mcli-plugin.tar.bz2/mcast/netcv2dvbip/dvbipstream.h
Changed
@@ -4,10 +4,12 @@ #include "headers.h" #include "misc.h" -#define MAXAPIDS 4 +#define MAXAPIDS 32 #define MAXDPIDS 4 #define MAXCAIDS 2 +#define TS_PER_UDP 7 + typedef struct { int number; @@ -42,15 +44,26 @@ int NumDpids; int eitpids[1]; int NumEitpids; + int sdtpids[1]; + int NumSdtpids; } channel_t; +typedef struct _stream_buffer_t +{ + struct _stream_buffer_t *next; + char data[TS_PER_UDP*188]; +} stream_buffer_t; + typedef struct { recv_info_t *r; - char *buffer; - int rp, wp; - off_t offset; + stream_buffer_t *free; + stream_buffer_t *head; + stream_buffer_t *tail; + stream_buffer_t *wr; + stream_buffer_t *rd; + int fill; int si_state; psi_buf_t psi; channel_t *cdata; @@ -61,11 +74,10 @@ pthread_t t; int stop; int ts_cnt; - pthread_mutex_t lock_wr; - pthread_mutex_t lock_rd; + pthread_mutex_t lock_bf; + pthread_mutex_t lock_ts; } stream_info_t; - channel_t *read_channel_list (char *filename); int get_channel_num (void); @@ -75,7 +87,9 @@ // mcilink.c void mcli_startup (void); void* mcli_stream_setup (const int channum); -size_t mcli_stream_read (void* handle, char *buf, size_t maxlen, off_t offset); +size_t mcli_stream_access (void* handle, char **buf); +size_t mcli_stream_part_access (void* handle, char **buf); +void mcli_stream_skip (void* handle); int mcli_stream_stop (void* handle); // parse.c
View file
vdr-mcli-plugin.tar.bz2/mcast/netcv2dvbip/iface.c
Changed
@@ -94,7 +94,8 @@ nifaces = ifconf.ifc_len/sizeof(struct ifreq); - printf("Interfaces (count = %d):\n", nifaces); + if (!quiet) + printf("Interfaces (count = %d):\n", nifaces); for(i = 0; i < nifaces; i++) { @@ -104,7 +105,8 @@ if(get_iface_ipaddress(&ifreqs[i])<0) continue; addr = (u_char *) & (((struct sockaddr_in *)&(ifreqs[i]).ifr_addr)->sin_addr); - printf("\t%i - %-10s : addr %d.%d.%d.%d\n",(i+1),ifreqs[i].ifr_name,addr[0],addr[1],addr[2],addr[3]); + if (!quiet) + printf("\t%i - %-10s : addr %d.%d.%d.%d\n",(i+1),ifreqs[i].ifr_name,addr[0],addr[1],addr[2],addr[3]); iflist[i].ipaddr = ( (struct sockaddr_in *)&(ifreqs[i]).ifr_addr)->sin_addr.s_addr; } @@ -125,13 +127,12 @@ int discover_interfaces(iface_t iflist[]) { + if (!quiet) printf("Interfaces:\n"); /* Declare and initialize variables */ - DWORD dwSize = 0; DWORD dwRetVal = 0; - unsigned int i = 0; unsigned int anum = 0; // Set the flags to pass to GetAdaptersAddresses @@ -179,8 +180,10 @@ // If successful, output some information from the data we received pCurrAddresses = pAddresses; while (pCurrAddresses) { - printf("\tIfIndex (IPv4 interface): %u\n", pCurrAddresses->IfIndex); - printf("\tAdapter name: %s\n", pCurrAddresses->AdapterName); + if (!quiet) { + printf("\tIfIndex (IPv4 interface): %u\n", (unsigned int)pCurrAddresses->IfIndex); + printf("\tAdapter name: %s\n", pCurrAddresses->AdapterName); + } strncpy(iflist[anum].name, pCurrAddresses->AdapterName, IFNAMSIZ); pUnicast = pCurrAddresses->FirstUnicastAddress; @@ -188,17 +191,27 @@ if (pCurrAddresses->OperStatus == IfOperStatusUp) { if (pUnicast != NULL) { - printf("\tUnicast Address: %s\n", inet_ntoa(((struct sockaddr_in*)(pUnicast->Address.lpSockaddr))->sin_addr) ); + if (!quiet) + printf("\tUnicast Address: %s\n", inet_ntoa(((struct sockaddr_in*)(pUnicast->Address.lpSockaddr))->sin_addr) ); iflist[anum].ipaddr = ((struct sockaddr_in*)(pUnicast->Address.lpSockaddr))->sin_addr.S_un.S_addr; - } else + } else { + if (!quiet) printf("\tNo Unicast Addresses\n"); + } + + if (!quiet) { +#ifndef __MINGW32__ + printf("\tDescription: %wS\n", pCurrAddresses->Description); + printf("\tFriendly name: %wS\n", pCurrAddresses->FriendlyName); +#else + printf("\tDescription: %ls\n", pCurrAddresses->Description); + printf("\tFriendly name: %ls\n", pCurrAddresses->FriendlyName); +#endif - printf("\tDescription: %wS\n", pCurrAddresses->Description); - printf("\tFriendly name: %wS\n", pCurrAddresses->FriendlyName); - - printf("\tMtu: %lu\n", pCurrAddresses->Mtu); + printf("\tMtu: %lu\n", pCurrAddresses->Mtu); - printf("\n"); + printf("\n"); + } anum++; } @@ -206,7 +219,7 @@ } } else { printf("Call to GetAdaptersAddresses failed with error: %d\n", - dwRetVal); + (int)dwRetVal); if (dwRetVal == ERROR_NO_DATA) printf("\tNo addresses were found for the requested parameters\n"); else { @@ -216,7 +229,7 @@ NULL, dwRetVal, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language (LPTSTR) & lpMsgBuf, 0, NULL)) { - printf("\tError: %s", lpMsgBuf); + printf("\tError: %s", (char *)lpMsgBuf); LocalFree(lpMsgBuf); if (pAddresses) FREE(pAddresses);
View file
vdr-mcli-plugin.tar.bz2/mcast/netcv2dvbip/igmp.c
Changed
@@ -2,9 +2,13 @@ #ifdef WIN32 #define WIN32_LEAN_AND_MEAN -#include <ws2tcpip.h> +#include <winsock2.h> +#ifndef __MINGW32__ #include <mstcpip.h> #else +#define SIO_RCVALL_IGMPMCAST _WSAIOW(IOC_VENDOR,3) +#endif +#else #include <sys/socket.h> #include <unistd.h> #include <netinet/in.h> @@ -13,6 +17,7 @@ #ifdef APPLE #include <netinet/ip_mroute.h> #else +#define _LINUX_IN_H #include <linux/mroute.h> #endif #endif @@ -142,10 +147,12 @@ #endif } -bool cIgmpListener::Initialize(iface_t bindif) +bool cIgmpListener::Initialize(iface_t bindif, int table) { int rc = 0; +#ifndef WIN32 int val = 0; +#endif m_bindaddr = bindif.ipaddr; @@ -173,6 +180,17 @@ #ifndef WIN32 +#ifdef MRT_TABLE + if ( table ) + { + rc = ::setsockopt( m_socket, IPPROTO_IP, MRT_TABLE, (void*)&table, sizeof(table) ); + if ( rc < 0 ) + { + log_socket_error("IGMP setsockopt(MRT_TABLE)"); + printf("IGMPv2 policy routing won't work! Please enable multicast policy routing option in the kernel configuration!\n"); + } + } +#endif val = 1; rc = ::setsockopt( m_socket, IPPROTO_IP, MRT_INIT, (void*)&val, sizeof(val) ); if ( rc < 0 ) @@ -290,61 +308,51 @@ void cIgmpListener::Action() { int recvlen; - char recv_buf[8192]; - int MaxFD; - fd_set ReadFDS; - struct timeval tv; - int Rt; + struct pollfd p; + char recv_buf[8192]; + p.fd = m_socket; + p.events = POLLIN; + while (Running()) { - tv.tv_usec = 0; - tv.tv_sec = 1; - - MaxFD = m_socket; - FD_ZERO( &ReadFDS ); - FD_SET( m_socket, &ReadFDS ); - - // wait for input - Rt = ::select( MaxFD +1, &ReadFDS, NULL, NULL, &tv ); + switch (poll(&p,1,1000)) { + case -1: +#ifndef WIN32 + if ( (errno != EINTR) && (errno != EWOULDBLOCK) ) +#else + int Rt; + Rt = WSAGetLastError(); + if ( (Rt != WSAEINTR) && (Rt != WSAEWOULDBLOCK) ) +#endif + log_socket_error( "IGMP poll()" ); + case 0: + continue; - // log and ignore failures - if( Rt < 0 ) - { - log_socket_error( "IGMP select()" ); - continue; - } - else if( Rt > 0 ) - { + default: + if (!(p.revents&POLLIN)) + continue; - // Read IGMP request, and handle it... - if( FD_ISSET( m_socket, &ReadFDS ) ) + recvlen = recv(m_socket, (char*)&recv_buf, sizeof(recv_buf), 0); + if (recvlen < 0) { - recvlen = ::recv(m_socket, (char*)&recv_buf, sizeof(recv_buf), 0); - if (recvlen < 0) - { #ifndef WIN32 - if ( (errno == EINTR) || (errno == EWOULDBLOCK) ) - continue; + if ( (errno == EINTR) || (errno == EWOULDBLOCK) ) #else - Rt = WSAGetLastError(); - if ( (Rt == WSAEINTR) || (Rt == WSAEWOULDBLOCK) ) - continue; + int Rt; + Rt = WSAGetLastError(); + if ( (Rt == WSAEINTR) || (Rt == WSAEWOULDBLOCK) ) #endif - log_socket_error("IGMP recv()"); - break; - } - /* - printf("recvlen: %d\n", recvlen); - for(int i=0; i<recvlen; i++) - printf("%02x ", (unsigned char) recv_buf[i]); - printf("\n"); - */ - Parse(recv_buf, recvlen); + continue; + log_socket_error("IGMP recv()"); + goto out; } + Parse(recv_buf, recvlen); + break; } } +out:; } void cIgmpListener::Parse(char* buffer, int len) @@ -361,23 +369,25 @@ // Check that IP version is IPV4 and that payload is IGMP if ( (HI_BYTE(*buf) == 4) && ( *(buf+9) == IPPROTO_IGMP) ) { + if (!quiet) { printf("IGMP: SrcAddr: %d.%d.%d.%d -> ", (unsigned char) *(buf+12), (unsigned char) *(buf+13), (unsigned char) *(buf+14), (unsigned char) *(buf+15) ); printf("DstAddr: %d.%d.%d.%d\n", (unsigned char) *(buf+16), (unsigned char) *(buf+17), (unsigned char) *(buf+18), (unsigned char) *(buf+19) ); - memcpy(&senderaddr, buf+12, 4); + } + memcpy(&senderaddr, buf+12, 4); - // skip rest of ip header and move to next to next protocol header - len -= LO_BYTE(*buf) * 4; - buf += LO_BYTE(*buf) * 4; + // skip rest of ip header and move to next to next protocol header + len -= LO_BYTE(*buf) * 4; + buf += LO_BYTE(*buf) * 4; uint16_t chksum = ((*(buf+3)<<8)&0xFF00 ) | (*(buf+2) & 0x00FF); *(buf+2) = 0; *(buf+3) = 0; if (chksum != inetChecksum((uint16_t *)buf, len)) { - printf("IGMP: INVALID CHECKSUM 0x%04x 0x%04x - discarding packet.\n", - chksum, inetChecksum((uint16_t *)buf, len)); + printf("IGMP: INVALID CHECKSUM 0x%04x 0x%04x - discarding packet.\n", + chksum, inetChecksum((uint16_t *)buf, len)); return; } @@ -385,38 +395,43 @@ { if ( *buf == 0x11 ) { - printf("IGMP: Version: %s, Type: Membership Query\n", (*(buf+1) == 0 ) ? "1":"2"); - printf(" Group: %d.%d.%d.%d\n", (unsigned char) *(buf+4), (unsigned char) *(buf+5), - (unsigned char) *(buf+6), (unsigned char) *(buf+7) - ); + if (!quiet) { + printf("IGMP: Version: %s, Type: Membership Query\n", (*(buf+1) == 0 ) ? "1":"2"); + printf(" Group: %d.%d.%d.%d\n", (unsigned char) *(buf+4), (unsigned char) *(buf+5), + (unsigned char) *(buf+6), (unsigned char) *(buf+7)); + } memcpy(&groupaddr, buf+4, 4); m_IgmpMain->ProcessIgmpQueryMessage( groupaddr, senderaddr ); } else if ( *buf == 0x12 ) { - printf("IGMP: Version: 1, Type: Membership Report\n");
View file
vdr-mcli-plugin.tar.bz2/mcast/netcv2dvbip/igmp.h
Changed
@@ -3,8 +3,7 @@ #ifdef WIN32 #define WIN32_LEAN_AND_MEAN -#include <ws2tcpip.h> -#include <mstcpip.h> +#include <winsock2.h> #else #include <sys/socket.h> #include <netinet/in.h> @@ -49,7 +48,7 @@ public: cIgmpListener(cIgmpMain* igmpmain); - bool Initialize(iface_t bindif); + bool Initialize(iface_t bindif, int table); void Destruct(void); bool Membership(in_addr_t mcaddr, bool Add); void IGMPSendQuery(in_addr_t Group, int Timeout); @@ -71,7 +70,7 @@ class cIgmpMain : public cThread { public: - cIgmpMain(cStreamer* streamer, iface_t bindif); + cIgmpMain(cStreamer* streamer, iface_t bindif, int table); ~cIgmpMain(void); bool StartListener(void); void Destruct(void); @@ -86,6 +85,7 @@ cIgmpListener* m_IgmpListener; in_addr_t m_bindaddr; iface_t m_bindif; + int m_table; cList<cMulticastGroup> m_Groups; @@ -111,6 +111,7 @@ // Main thread virtual void Action(); cCondWait m_CondWait; + int m_stopping; // Helper cMulticastGroup* FindGroup(in_addr_t Group) const;
View file
vdr-mcli-plugin.tar.bz2/mcast/netcv2dvbip/main.c
Changed
@@ -15,6 +15,15 @@ #include <sys/socket.h> #include <sys/ioctl.h> #include <netinet/in.h> +#ifndef APPLE +#define _LINUX_IN_H +#include <linux/mroute.h> +#endif +#else +#include <direct.h> +#ifdef __MINGW32__ +#include <getopt.h> +#endif #endif #include "streamer.h" @@ -36,10 +45,13 @@ int channel_num=0; int channel_max_num=0; int channel_use_eit = 0; +int channel_use_sdt = 0; int portnum = 12345; +int table = 0; +int quiet = 0; /*-------------------------------------------------------------------------*/ -channel_t * read_channel_list(char *filename) +channel_t * read_channel_list(char *filename, char *dirname) { FILE *cf; FILE *pf; @@ -50,9 +62,27 @@ printf("Can't read %s: %s\n",filename,strerror(errno)); return NULL; } + + if (dirname) { +#ifdef WIN32 + if (((dirname[0]>='A'&&dirname[0]<='Z') || (dirname[0]>='a'&&dirname[0]<='z')) && dirname[1]==':') { + if (_chdrive((dirname[0]&0xdf)-'A'+1)) { + printf("Can't access %s: %s\n", dirname, strerror(errno)); + fclose(cf); + return NULL; + } + } +#endif + if (chdir(dirname)) { + printf("Can't access %s: %s\n", dirname, strerror(errno)); + fclose(cf); + return NULL; + } + } + pf =fopen("channels.m3u", "w"); if (!pf) { - printf("Can't read %s: %s\n", "channels.m3u", strerror(errno)); + printf("Can't create %s: %s\n", "channels.m3u", strerror(errno)); fclose(cf); return NULL; } @@ -62,13 +92,20 @@ if (channel_num==channel_max_num) { channel_max_num+=200; channels=(channel_t*)realloc(channels,channel_max_num*sizeof(channel_t)); + if (!channels) { + printf("out of memory\n"); + fclose(pf); + fclose(cf); + return NULL; + } } fgets(buf,512,cf); if ( !feof(cf) && ParseLine(buf,&channels[channel_num])) { int ip1 = (channel_num+1)/256; int ip2 = (channel_num) - (ip1*256) + 1; - printf("%i: udp://@239.255.%i.%i:%i - %s \n", - channel_num+1, ip1, ip2, 12345, channels[channel_num].name); + if (!quiet) + printf("%i: udp://@239.255.%i.%i:%i - %s \n", + channel_num+1, ip1, ip2, 12345, channels[channel_num].name); fprintf(pf, "#EXTINF: %i,%s\n", channel_num+1, channels[channel_num].name); fprintf(pf, "udp://@239.255.%i.%i:%i\n", ip1,ip2, portnum); if (channel_use_eit) @@ -76,6 +113,11 @@ channels[channel_num].NumEitpids = 1; channels[channel_num].eitpids[0] = 0x12; } + if (channel_use_sdt) + { + channels[channel_num].NumSdtpids = 1; + channels[channel_num].sdtpids[0] = 0x11; + } channel_num++; } } @@ -116,14 +158,26 @@ void usage (void) { - printf("Usage: netcv2dvbip [-b <multicast interface>] [-p <port>] [-i <netceiver interface>] [-c <channels.conf>] [-e activate EIT PID (EPG)\n"); - exit(0); + printf("Usage: netcv2dvbip " + "[-b <multicast interface>] " + "[-p <port>] " + "[-i <netceiver interface>] " + "[-c <channels.conf>] " + "[-e activate EIT PID (EPG)] " + "[-s activate SDT PID (may be required for EPG)] " +#ifdef MRT_TABLE + "[-t <routing table number> (requires CONFIG_IP_MROUTE_MULTIPLE_TABLES)] " +#endif + "[-q be more quiet on the screen] " + "[-o <output directory>]\n"); + exit(1); } /*-------------------------------------------------------------------------*/ int main(int argc, char *argv[]) { char c; + char *dirname = NULL; char channels[_POSIX_PATH_MAX]; strcpy(channels, "channels.conf"); char bindiface[IFNAMSIZ]; @@ -160,7 +214,11 @@ while(1) { - int ret = getopt(argc,argv, "i:hc:b:p:e"); + int ret = getopt(argc,argv, "i:hc:b:p:esqo:" +#ifdef MRT_TABLE + "t:" +#endif + ); if (ret==-1) break; @@ -182,12 +240,26 @@ case 'p': portnum = atoi(optarg); break; +#ifdef MRT_TABLE + case 't': + table = atoi(optarg); + break; +#endif case 'h': usage(); return(0); case 'e': channel_use_eit = 1; break; + case 's': + channel_use_sdt = 1; + break; + case 'q': + quiet = 1; + break; + case 'o': + dirname = optarg; + break; } } @@ -219,7 +291,7 @@ printf("Starting netcv2dvbip. Streams will be sent to port: %d\n", portnum); - if (!read_channel_list(channels)) + if (!read_channel_list(channels, dirname)) exit(-1); mcli_startup(); @@ -247,6 +319,7 @@ streamer.SetBindIf(iflist[ifindex]); streamer.SetStreamPort(portnum); + streamer.SetTable(table); streamer.SetNumGroups(get_channel_num()); streamer.Run();
View file
vdr-mcli-plugin.tar.bz2/mcast/netcv2dvbip/mclilink.c
Changed
@@ -1,6 +1,12 @@ #include "dvbipstream.h" -#define BUFFER_SIZE (10000*188) +#define BUFFER_SIZE (256*TS_PER_UDP*188) + +#ifdef WIN32 +#define CVT (char *) +#else +#define CVT +#endif int gen_pat(unsigned char *buf, unsigned int program_number, unsigned int pmt_pid, unsigned int ts_cnt) { @@ -51,19 +57,14 @@ return i; } -int lastwp = 0; /*-------------------------------------------------------------------------*/ int mcli_handle_ts (unsigned char *buffer, size_t len, void *p) { stream_info_t *si = (stream_info_t *) p; - if(si->stop) { + if(si->stop) return len; - } - pthread_mutex_lock(&si->lock_wr); - - int wp = si->wp; int olen = len; int ret; @@ -79,6 +80,7 @@ goto again; case 1: + ret = 0; for(i=0; i<len; i+=188) { ret = ts2psi_data (buffer+i, &si->psi, 188, 0); if(ret){ @@ -90,7 +92,8 @@ } if (ret == 1) { - printf ("Channel: %s - Got PAT\n", si->cdata->name); + if (!quiet) + printf ("Channel: %s - Got PAT\n", si->cdata->name); pmt_pid_list_t pat; ret = parse_pat_sect (si->psi.buf, si->psi.len, &pat); if (ret < 0) { @@ -101,7 +104,8 @@ for (n = 0; n < pat.pmt_pids; n++) { if (pat.pl[n].program_number == (unsigned int)si->cdata->sid) { si->pmt_pid = pat.pl[n].network_pmt_pid; - printf ("Channel: %s - SID %d has PMT Pid %d\n", si->cdata->name, si->cdata->sid, si->pmt_pid); + if (!quiet) + printf ("Channel: %s - SID %d has PMT Pid %d\n", si->cdata->name, si->cdata->sid, si->pmt_pid); break; } } @@ -113,6 +117,7 @@ } break; case 4: + ret = 0; for(i=0; i<len; i+=188) { ret = ts2psi_data (buffer+i, &si->psi, 188, si->pmt_pid); if(ret){ @@ -124,7 +129,8 @@ } if (ret == 1) { - printf ("Channel: %s - Got PMT\n", si->cdata->name); + if (!quiet) + printf ("Channel: %s - Got PMT\n", si->cdata->name); pmt_t hdr; si_ca_pmt_t pm, es; int es_pid_num; @@ -159,27 +165,94 @@ } } */ - if ((wp + len) >= BUFFER_SIZE) { - int l; - l = BUFFER_SIZE - wp; - memcpy (si->buffer + wp, buffer, l); - len -= l; - wp = 0; - buffer += l; + pthread_mutex_lock(&si->lock_ts); + + switch(len) { + case 1*188: + case 2*188: + case 3*188: + case 4*188: + case 5*188: + case 6*188: + case 7*188: + break; + default: + err(CVT "Channel: %s - bad data length %d, skipping\n", + si->cdata->name,(int)len); + goto out; } - memcpy (si->buffer + wp, buffer, len); - wp += len; - si->wp = wp % (BUFFER_SIZE); -#if 1 - if (abs (si->wp - lastwp) > 500 * 1000) { -// printf ("wp %i, rp %i\n", si->wp, si->rp); - lastwp = si->wp; + + if(!si->wr) { + pthread_mutex_lock(&si->lock_bf); + if(si->free) { + si->wr=si->free; + si->free=si->free->next; + pthread_mutex_unlock(&si->lock_bf); + } else { + pthread_mutex_unlock(&si->lock_bf); + si->wr=(stream_buffer_t *) + malloc(sizeof(stream_buffer_t)); + if(!si->wr) { + err(CVT "Channel: %s - out of memory\n", + si->cdata->name); + goto out; + } + } + si->wr->next=NULL; + si->fill=0; } -#endif + + i=TS_PER_UDP*188-si->fill; + + if(len>i) { + memcpy(si->wr->data+si->fill,buffer,i); + + pthread_mutex_lock(&si->lock_bf); + if(!si->head) + si->head=si->tail=si->wr; + else { + si->tail->next=si->wr; + si->tail=si->wr; + } + if(si->free) { + si->wr=si->free; + si->free=si->free->next; + pthread_mutex_unlock(&si->lock_bf); + } else { + pthread_mutex_unlock(&si->lock_bf); + si->wr=(stream_buffer_t *) + malloc(sizeof(stream_buffer_t)); + if(!si->wr) { + err(CVT "Channel: %s - out of memory\n", + si->cdata->name); + goto out; + } + } + si->wr->next=NULL; + si->fill=0; + buffer+=i; + len-=i; + } + + memcpy(si->wr->data+si->fill,buffer,len); + si->fill+=len; + + if(si->fill==TS_PER_UDP*188) { + pthread_mutex_lock(&si->lock_bf); + if(!si->head) + si->head=si->tail=si->wr; + else { + si->tail->next=si->wr; + si->tail=si->wr; + } + pthread_mutex_unlock(&si->lock_bf); + si->wr=NULL; + } + +out: pthread_mutex_unlock(&si->lock_ts); break; } - pthread_mutex_unlock(&si->lock_wr); return olen; } @@ -203,23 +276,28 @@ { unsigned char ts[188]; stream_info_t *si = (stream_info_t *) p; - printf("Channel: %s - stream watch thread started.\n", si->cdata->name); - while (!si->stop) { + if (!quiet) + printf("Channel: %s - stream watch thread started.\n", si->cdata->name);
View file
vdr-mcli-plugin.tar.bz2/mcast/netcv2dvbip/mingw
Added
+(directory)
View file
vdr-mcli-plugin.tar.bz2/mcast/netcv2dvbip/mingw/Makefile
Added
@@ -0,0 +1,19 @@ +OBJS=main.o parse.o mclilink.o siparser.o crc32.o clist.o stream.o thread.o misc.o streamer.o igmp.o iface.o +EXE=netcv2dvbip.exe +CC:=gcc +CXX=g++ +CFLAGS:= -O2 -DCLIENT -DSTATICLIB -Wall -I../../common/win32/include -I../../common -I../../client +LDFLAGS:= -s -L../../common/win32/lib +LDLIBS:= -lmingwex -lmcli -liphlpapi -lpthreadGC2 -lws2_32 -lxml2 -lz + +all: $(EXE) + +$(EXE): $(OBJS) + $(CXX) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS) + +%.o: ../%.c + $(CXX) -c $(CFLAGS) -o $@ $< + +clean: + @-del $(EXE) *.o *.la *~ +
View file
vdr-mcli-plugin.tar.bz2/mcast/netcv2dvbip/mingw/build.cmd
Added
@@ -0,0 +1,2 @@ +@set PATH=c:\MinGw\bin;%PATH% +@mingw32-make
View file
vdr-mcli-plugin.tar.bz2/mcast/netcv2dvbip/mingw/clean.cmd
Added
@@ -0,0 +1,2 @@ +@set PATH=c:\MinGw\bin;%PATH% +@mingw32-make clean
View file
vdr-mcli-plugin.tar.bz2/mcast/netcv2dvbip/misc.c
Changed
@@ -89,6 +89,13 @@ } #ifdef WIN32 + +#ifdef __MINGW32__ +#define __try if(1) +#define __leave goto out +#define __finally if(1) +#endif + bool IsUserAdmin( bool* pbAdmin ) { #if WINVER < 0x0500 @@ -98,7 +105,7 @@ PTOKEN_GROUPS ptgGroups = NULL; #endif PSID psidAdministrators = NULL; - SID_IDENTIFIER_AUTHORITY siaNtAuthority = SECURITY_NT_AUTHORITY; + SID_IDENTIFIER_AUTHORITY siaNtAuthority = {SECURITY_NT_AUTHORITY}; BOOL bResult = FALSE; __try @@ -150,6 +157,9 @@ __finally { +#ifdef __MINGW32__ +out: +#endif #if WINVER < 0x0500 if( hAccessToken ) CloseHandle( hAccessToken );
View file
vdr-mcli-plugin.tar.bz2/mcast/netcv2dvbip/misc.h
Changed
@@ -39,6 +39,10 @@ extern bool GetAbsTime(struct timespec *Abstime, int MillisecondsFromNow); #ifdef WIN32 +struct timezone { + int tz_minuteswest; /* minutes west of Greenwich */ + int tz_dsttime; /* type of DST correction */ +}; extern int gettimeofday(struct timeval * tp, struct timezone * tzp); bool IsUserAdmin( bool* pbAdmin ); bool IsVistaOrHigher(); @@ -58,5 +62,6 @@ uint64_t Elapsed(void); }; +extern int quiet; #endif
View file
vdr-mcli-plugin.tar.bz2/mcast/netcv2dvbip/parse.c
Changed
@@ -114,6 +114,43 @@ {-1} }; +#ifdef WIN32 +#define strtok_r mystrtok +char *strtok_r(char *s, const char *d, char **m) +{ + char *p; + char *q; + + if (s) + *m = s; + + p = *m; + if (!p) + return NULL; + + while (*p && strchr(d,*p)) + p++; + + if (*p == 0) { + *m = NULL; + return NULL; + } + + q = p; + while (*q && !strchr(d,*q)) + q++; + + if (!*q) + *m = NULL; + else { + *q++ = 0; + *m = q; + } + + return p; +} +#endif + char *strreplace (char *s, char c1, char c2) { if (s) { @@ -239,7 +276,7 @@ s = ParseParameter (s, &ch->hierarchy, HierarchyValues); break; default: - printf ("ERROR: unknown parameter key '%c' at pos %d\n", *s, s-start); + printf ("ERROR: unknown parameter key '%c' at pos %d\n", *s, (int)((long)(s-start))); return 0; } } @@ -356,7 +393,6 @@ while ((q = strtok_r (p, ",", &strtok_next)) != NULL) { if (ch->NumApids < MAXAPIDS) { - char *l = strchr (q, '='); ch->apids[ch->NumApids++] = strtol (q, NULL, 10); } else printf ("ERROR: too many APIDs!\n"); // no need to set ok to 'false' @@ -370,7 +406,6 @@ char *strtok_next; while ((q = strtok_r (p, ",", &strtok_next)) != NULL) { if (NumDpids < MAXDPIDS) { - char *l = strchr (q, '='); ch->dpids[ch->NumDpids++] = strtol (q, NULL, 10); } else printf ("ERROR: too many DPIDs!\n"); // no need to set ok to 'false' @@ -403,23 +438,37 @@ if (p) { *p++ = 0; ch->provider = strdup (p); + if (!ch->provider) { + printf ("ERROR: out of memory!\n"); + ok = 0; + } } p = strchr (namebuf, ','); if (p) { *p++ = 0; ch->shortName = strdup (p); + if (!ch->shortName) { + printf ("ERROR: out of memory!\n"); + ok = 0; + } } } ch->name = strdup (namebuf); + if (!ch->name) { + printf ("ERROR: out of memory!\n"); + ok = 0; + } - free (parambuf); - free (sourcebuf); - free (vpidbuf); - free (apidbuf); - free (caidbuf); - free (namebuf); } else - return 0; + ok = 0; +#if (defined WIN32 || defined APPLE) + free (parambuf); + free (sourcebuf); + free (vpidbuf); + free (apidbuf); + free (caidbuf); + free (namebuf); +#endif } return ok; }
View file
vdr-mcli-plugin.tar.bz2/mcast/netcv2dvbip/siparser.c
Changed
@@ -1,1027 +0,0 @@ -#include "headers.h" - -//#define DBG 1 -#define CRC32_CHECK 1 - -enum ca_desc_type { EMM, ECM }; - -//----------------------------------------------------------------------------------- -void printhex_buf(char *msg,unsigned char *buf,int len) -{ - int i,j,k; - int width=8; - - i=k=0; - sys ("%s: %d bytes (0x%04x)\n",msg,len,len); - sys ("---------------------------------------------------------------\n"); - while(len) { - sys ("%04x ",k++*width*2); - j=i; - for(;i < j + width ; i++){ - if (i >= len) break; - sys ("%02x ",buf[i]); - } - if (i >= len) { - sys ("\n"); - break; - } - sys(" "); - j=i; - for(;i < j + width ; i++){ - if (i >= len) break; - sys("%02x ",buf[i]); - } - sys("\n"); - if (i >= len) break; - } - sys("---------------------------------------------------------------\n"); -} -//----------------------------------------------------------------------------------- -void writehex_buf(FILE *f, char *msg,unsigned char *buf,int len) -{ - int i,j,k; - int width=8; - - i=k=0; - fprintf(f,"%s: %d bytes (0x%04x)\n",msg,len,len); - fprintf(f,"---------------------------------------------------------------\n"); - while(len) { - fprintf(f,"%04x ",k++*width*2); - j=i; - for(;i < j + width ; i++){ - if (i >= len) break; - fprintf(f,"%02x ",buf[i]); - } - if (i >= len) { - fprintf(f,"\n"); - break; - } - fprintf(f," "); - j=i; - for(;i < j + width ; i++){ - if (i >= len) break; - fprintf(f,"%02x ",buf[i]); - } - fprintf(f,"\n"); - if (i >= len) break; - } - fprintf(f,"---------------------------------------------------------------\n"); - - -} -//----------------------------------------------------------------------------------- -void print_ts_header(ts_packet_hdr_t *p) -{ - info("--------------------------------------------------------------\n"); - info("TS header data:\n"); - info("Sync-byte : 0x%04x\n",p->sync_byte); - info("Transport error indicator : 0x%04x\n",p->transport_error_indicator); - info("Payload unit start indicator : 0x%04x\n",p->payload_unit_start_indicator); - info("Transport priority : 0x%04x\n",p->transport_priority); - info("PID : 0x%04x\n",p->pid); - info("Transport scrambling control : 0x%04x\n",p->transport_scrambling_control); - info("Adaptation field control : 0x%04x\n",p->adaptation_field_control); - info("Continuity_counter : 0x%04x\n",p->continuity_counter); - -} -//----------------------------------------------------------------------------------- -void print_pmt(pmt_t *p) -{ - info("--------------------------------------------------------------\n"); - info("PMT section:\n"); - info("Table ID : %-5d (0x%04x)\n",p->table_id,p->table_id); - info("(fixed): : %-5d (0x%04x)\n",0,0); - info("Section syntax indicator : %-5d (0x%04x)\n",p->section_syntax_indicator,p->section_syntax_indicator); - info("Reserved 1 : %-5d (0x%04x)\n",p->reserved_1,p->reserved_1); - info("Section length : %-5d (0x%04x)\n",p->section_length,p->section_length); - info("Program number : %-5d (0x%04x)\n",p->program_number,p->program_number); - info("Reserved 2 : %-5d (0x%04x)\n",p->reserved_2,p->reserved_2); - info("Version number : %-5d (0x%04x)\n",p->version_number,p->version_number); - info("Current next indicator : %-5d (0x%04x)\n",p->current_next_indicator,p->current_next_indicator); - info("Section number : %-5d (0x%04x)\n",p->section_number,p->section_number); - info("Last section number : %-5d (0x%04x)\n",p->last_section_number,p->last_section_number); - info("Reserved 3 : %-5d (0x%04x)\n",p->reserved_3,p->reserved_3); - info("PCR pid : %-5d (0x%04x)\n",p->pcr_pid,p->pcr_pid); - info("Reserved 4 : %-5d (0x%04x)\n",p->reserved_4,p->reserved_4); - info("Program info length : %-5d (0x%04x)\n",p->program_info_length,p->program_info_length); - - - - info("CRC32 : 0x%04x\n",p->crc32); -} -//----------------------------------------------------------------------------------- -void print_pat(pat_t *p, pat_list_t *pl, int pmt_num) -{ - info("--------------------------------------------------------------\n"); - info("PAT section:\n"); - info("Table_id : %-5d (0x%04x)\n",p->table_id,p->table_id); - info("(fixed): : %-5d (0x%04x)\n",0,0); - info("Section syntax indicator : %-5d (0x%04x)\n",p->section_syntax_indicator,p->section_syntax_indicator); - info("Reserved_1 : %-5d (0x%04x)\n",p->reserved_1,p->reserved_1); - info("Section length : %-5d (0x%04x)\n",p->section_length,p->section_length); - info("Transport stream id : %-5d (0x%04x)\n",p->transport_stream_id,p->transport_stream_id); - info("Reserved 2 : %-5d (0x%04x)\n",p->reserved_2,p->reserved_2); - info("Version number : %-5d (0x%04x)\n",p->version_number,p->version_number); - info("Current next indicator : %-5d (0x%04x)\n",p->current_next_indicator,p->current_next_indicator); - info("Section number : %-5d (0x%04x)\n",p->section_number,p->section_number); - info("Last section number : %-5d (0x%04x)\n",p->last_section_number,p->last_section_number); - - if (pl && pmt_num){ - int i; - info("Number of PMTs in PAT : %-5d \n", pmt_num); - for(i=0;i<pmt_num;i++) { - pat_list_t *pat = pl + i; - info("\nProgram number : %-5d (0x%04x)\n",pat->program_number,pat->program_number); - info("Reserved : %-5d (0x%04x)\n",pat->reserved,pat->reserved); - info("Network PMT PID : %-5d (0x%04x)\n",pat->network_pmt_pid,pat->network_pmt_pid); - } - } - - info("CRC32 : 0x%04x\n",p->crc32); - - -} -//----------------------------------------------------------------------------------- -char *si_caid_to_name(unsigned int caid) -{ - - str_table table[] = { - // -- updated from dvb.org 2003-10-16 - { 0x0000, 0x0000, "Reserved" }, - { 0x0001, 0x00FF, "Standardized Systems" }, - { 0x0100, 0x01FF, "Canal Plus (Seca/MediaGuard)" }, - { 0x0200, 0x02FF, "CCETT" }, - { 0x0300, 0x03FF, "MSG MediaServices GmbH" }, - { 0x0400, 0x04FF, "Eurodec" }, - { 0x0500, 0x05FF, "France Telecom (Viaccess)" }, - { 0x0600, 0x06FF, "Irdeto" }, - { 0x0700, 0x07FF, "Jerrold/GI/Motorola" }, - { 0x0800, 0x08FF, "Matra Communication" }, - { 0x0900, 0x09FF, "News Datacom (Videoguard)" }, - { 0x0A00, 0x0AFF, "Nokia" }, - { 0x0B00, 0x0BFF, "Norwegian Telekom (Conax)" }, - { 0x0C00, 0x0CFF, "NTL" }, - { 0x0D00, 0x0DFF, "Philips (Cryptoworks)" }, - { 0x0E00, 0x0EFF, "Scientific Atlanta (Power VU)" }, - { 0x0F00, 0x0FFF, "Sony" }, - { 0x1000, 0x10FF, "Tandberg Television" }, - { 0x1100, 0x11FF, "Thompson" }, - { 0x1200, 0x12FF, "TV/COM" }, - { 0x1300, 0x13FF, "HPT - Croatian Post and Telecommunications" }, - { 0x1400, 0x14FF, "HRT - Croatian Radio and Television" }, - { 0x1500, 0x15FF, "IBM" }, - { 0x1600, 0x16FF, "Nera" }, - { 0x1700, 0x17FF, "Beta Technik (Betacrypt)" }, - { 0x1800, 0x18FF, "Kudelski SA"}, - { 0x1900, 0x19FF, "Titan Information Systems"}, - { 0x2000, 0x20FF, "TelefXnica Servicios Audiovisuales"}, - { 0x2100, 0x21FF, "STENTOR (France Telecom, CNES and DGA)"}, - { 0x2200, 0x22FF, "Scopus Network Technologies"}, - { 0x2300, 0x23FF, "BARCO AS"}, - { 0x2400, 0x24FF, "StarGuide Digital Networks "}, - { 0x2500, 0x25FF, "Mentor Data System, Inc."}, - { 0x2600, 0x26FF, "European Broadcasting Union"}, - { 0x4700, 0x47FF, "General Instrument"}, - { 0x4800, 0x48FF, "Telemann"}, - { 0x4900, 0x49FF, "Digital TV Industry Alliance of China"}, - { 0x4A00, 0x4A0F, "Tsinghua TongFang"}, - { 0x4A10, 0x4A1F, "Easycas"}, - { 0x4A20, 0x4A2F, "AlphaCrypt"}, - { 0x4A30, 0x4A3F, "DVN Holdings"}, - { 0x4A40, 0x4A4F, "Shanghai Advanced Digital Technology Co. Ltd. (ADT)"}, - { 0x4A50, 0x4A5F, "Shenzhen Kingsky Company (China) Ltd"}, - { 0x4A60, 0x4A6F, "@SKY"}, - { 0x4A70, 0x4A7F, "DreamCrypt"}, - { 0x4A80, 0x4A8F, "THALESCrypt"}, - { 0x4A90, 0x4A9F, "Runcom Technologies"}, - { 0x4AA0, 0x4AAF, "SIDSA"}, - { 0x4AB0, 0x4ABF, "Beijing Comunicate Technology Inc."}, - { 0x4AC0, 0x4ACF, "Latens Systems Ltd"}, +(symlink to ../common/siparser.c)
View file
vdr-mcli-plugin.tar.bz2/mcast/netcv2dvbip/stream.c
Changed
@@ -3,9 +3,6 @@ #ifdef WIN32 #define WIN32_LEAN_AND_MEAN #include <winsock2.h> -#include <mstcpip.h> -#include <Ws2ipdef.h> - #endif #include <pthread.h> @@ -15,30 +12,21 @@ #include "stream.h" #include "thread.h" +#define SLEEPTIME (20*1000) + static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; cStream::cStream(int Channum, in_addr_t Addr, int portnum) : cThread("udp streamer") { - size = 188*TS_PER_UDP; handle = 0; channum = Channum; addr = Addr; m_portnum = portnum; - - buf = new char[size]; - - if (buf == NULL) - { - printf("Channel: %d - Cannot allocate memory for buffer", channum); - } - } cStream::~cStream(void) { - if(buf) - delete(buf); } bool cStream::StartStream(in_addr_t bindaddr) @@ -109,84 +97,61 @@ void cStream::Action() { - int retries = 0; - size_t len = 0; - off_t offset = 0; - - int MaxFD; - fd_set WriteFDS; - struct timeval tv; + unsigned int retries; + size_t len; + char *ptr; + struct pollfd p; - stream_info_t *si = (stream_info_t *) handle; + p.fd = udp_socket; + p.events = POLLOUT; while (Running()) { - pthread_mutex_lock(&si->lock_rd); - - if (si->stop) { - pthread_mutex_unlock(&si->lock_rd); - break; - } - - retries = 0; - len = 0; - offset = 0; - - while (retries < 50) { -// printf("si->closed %d\n",si->closed); - len += mcli_stream_read (handle, buf + len, size - len, offset); - offset += len; - if (len == size) + for (retries=1;;retries++) { + if (retries&0xff) + len = mcli_stream_access (handle, &ptr); + else + len = mcli_stream_part_access (handle, &ptr); + if (len) break; - // Sleep 100ms - usleep (100 * 1000); - retries++; + if(!Running())goto out; + usleep (SLEEPTIME); } -// printf("read %s %i, offset %i\n",si->cdata->name,(int)len,(int)offset); - - int rc = 0; - - tv.tv_usec = 500000; - tv.tv_sec = 0; - - MaxFD = udp_socket; - FD_ZERO( &WriteFDS ); - FD_SET( udp_socket, &WriteFDS ); - - // wait for input - rc = ::select( MaxFD +1, NULL, &WriteFDS, NULL, &tv ); - - // log and ignore failures - if( rc < 0 ) - { - log_socket_error( "STREAM select()" ); - continue; - } - else if( rc > 0 ) - { - - // check if socket if writable - if( FD_ISSET( udp_socket, &WriteFDS ) ) - { - rc = ::sendto( udp_socket, buf, len, 0, (struct sockaddr *)&peer, sizeof(peer) ); - if (rc < 0) - { + + switch (poll(&p,1,100)) { + case -1: + log_socket_error( "STREAM poll()" ); + case 0: + usleep (SLEEPTIME); + continue; + default: + if (!(p.revents&POLLOUT)) { + usleep (SLEEPTIME); + continue; + } + if (sendto( udp_socket, ptr, len, 0, (struct sockaddr *)&peer, sizeof(peer) ) < 0) { #ifndef WIN32 - if ( (errno == EINTR) || (errno == EWOULDBLOCK) ) - continue; + if ( (errno == EINTR) || (errno == EWOULDBLOCK) ) { + usleep (SLEEPTIME); + continue; + } #else - rc = WSAGetLastError(); - if ( (rc == WSAEINTR) || (rc == WSAEWOULDBLOCK) ) - continue; -#endif - log_socket_error("STREAM: sendto()"); - pthread_mutex_unlock(&si->lock_rd); - break; + int rc; + rc = WSAGetLastError(); + if ( (rc == WSAEINTR) || (rc == WSAEWOULDBLOCK) ) { + usleep (SLEEPTIME); + continue; } +#endif + log_socket_error("STREAM: sendto()"); + goto out; } + break; } - pthread_mutex_unlock(&si->lock_rd); + + mcli_stream_skip (handle); } +out:; } void cStream::StopStream()
View file
vdr-mcli-plugin.tar.bz2/mcast/netcv2dvbip/stream.h
Changed
@@ -3,16 +3,12 @@ #ifdef WIN32 #include <winsock2.h> -#include <mstcpip.h> -#include <Ws2ipdef.h> #endif #include "clist.h" #include "thread.h" #include "misc.h" -#define TS_PER_UDP 7 - class cStream : public cListObject, public cThread { public: @@ -27,11 +23,9 @@ struct sockaddr_in peer; int channum; in_addr_t addr; - size_t size; - char* buf; int m_portnum; virtual void Action(); }; -#endif \ No newline at end of file +#endif
View file
vdr-mcli-plugin.tar.bz2/mcast/netcv2dvbip/streamer.c
Changed
@@ -15,6 +15,7 @@ m_IgmpMain = NULL; m_bindaddr = 0; m_portnum = 0; + m_table = 0; } void cStreamer::SetBindIf(iface_t bindif) @@ -28,11 +29,16 @@ m_portnum = portnum; } +void cStreamer::SetTable(int table) +{ + m_table = table; +} + void cStreamer::Run() { if ( m_IgmpMain == NULL ) { - m_IgmpMain = new cIgmpMain(this, m_bindif); + m_IgmpMain = new cIgmpMain(this, m_bindif, m_table); m_IgmpMain->StartListener(); } return; @@ -91,4 +97,3 @@ Group->stream = NULL; } } - \ No newline at end of file
View file
vdr-mcli-plugin.tar.bz2/mcast/netcv2dvbip/streamer.h
Changed
@@ -15,6 +15,7 @@ void Stop(); void SetBindIf(iface_t bindif); void SetStreamPort(int portnum); + void SetTable(int table); void SetNumGroups(int numgroups); bool IsGroupinRange(in_addr_t groupaddr); @@ -26,6 +27,7 @@ cIgmpMain* m_IgmpMain; in_addr_t m_bindaddr; iface_t m_bindif; + int m_table; int m_portnum; int m_numgroups; };
View file
vdr-mcli-plugin.tar.bz2/mcast/netcv2dvbip/thread.c
Changed
@@ -170,11 +170,11 @@ void *cThread::StartThread(cThread *Thread) { - if (Thread->description) + if (Thread->description && !quiet) printf("%s thread started.\n", Thread->description); Thread->Action(); - if (Thread->description) + if (Thread->description && !quiet) printf("%s thread ended.\n", Thread->description); Thread->running = false; Thread->active = false;
View file
vdr-mcli-plugin.tar.bz2/mcast/tool/mcast.c
Changed
@@ -1,657 +0,0 @@ -/* - * (c) BayCom GmbH, http://www.baycom.de, info@baycom.de - * - * See the COPYING file for copyright information and - * how to reach the author. - * - * modified by Reel Multimedia, http://www.reel-multimedia.com, info@reel-multimedia.com - * 01042010 DL: use a single thread for reading from network layer (uses less resources) - * - */ - -#include "headers.h" - -//---------------------------------------------------------------------------------------------------------------------------------- -STATIC int udp_ipv6_is_multicast_address (const struct sockaddr *addr) -{ -#ifdef IPV4 - if (addr->sa_family == AF_INET) - return IN_MULTICAST (ntohl (((struct sockaddr_in *) addr)->sin_addr.s_addr)); -#endif - if (addr->sa_family == AF_INET6) - return IN6_IS_ADDR_MULTICAST (&((struct sockaddr_in6 *) addr)->sin6_addr); - return -1; -} - -//--------------------------------------------------------------------------------------------------------------------------------- -STATIC int udp_ipv6_set_multicast_ttl (SOCKET sockfd, int mcastTTL, struct sockaddr *addr) -{ -#ifdef IPV4 - if (addr->sa_family == AF_INET) { - if (setsockopt (sockfd, IPPROTO_IP, IP_MULTICAST_TTL, &mcastTTL, sizeof (mcastTTL)) < 0) { - perror ("setsockopt(IP_MULTICAST_TTL)"); - return -1; - } - } -#endif - if (addr->sa_family == AF_INET6) { - if (setsockopt (sockfd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, (_SOTYPE)&mcastTTL, sizeof (mcastTTL)) < 0) { - perror ("setsockopt(IPV6_MULTICAST_HOPS)"); - return -1; - } - } - return 0; -} - -//--------------------------------------------------------------------------------------------------------------------------------- -int udp_ipv6_join_multicast_group (SOCKET sockfd, int iface, struct sockaddr *addr) -{ -#ifdef IPV4 - if (addr->sa_family == AF_INET) { - struct ip_mreq mreq; - mreq.imr_multiaddr.s_addr = ((struct sockaddr_in *) addr)->sin_addr.s_addr; - mreq.imr_interface.s_addr = INADDR_ANY; - if (setsockopt (sockfd, IPPROTO_IP, IP_ADD_MEMBERSHIP, (const void *) &mreq, sizeof (mreq)) < 0) { - perror ("setsockopt(IP_ADD_MEMBERSHIP)"); - return -1; - } - } -#endif - if (addr->sa_family == AF_INET6) { - struct ipv6_mreq mreq6; - memcpy (&mreq6.ipv6mr_multiaddr, &(((struct sockaddr_in6 *) addr)->sin6_addr), sizeof (struct in6_addr)); - mreq6.ipv6mr_interface = iface; - if (setsockopt (sockfd, IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP, (_SOTYPE)&mreq6, sizeof (mreq6)) < 0) { - perror ("setsockopt(IPV6_ADD_MEMBERSHIP)"); - return -1; - } - } - return 0; -} - -//--------------------------------------------------------------------------------------------------------------------------------- -int udp_ipv6_leave_multicast_group (SOCKET sockfd, int iface, struct sockaddr *addr) -{ -#ifdef IPV4 - if (addr->sa_family == AF_INET) { - struct ip_mreq mreq; - mreq.imr_multiaddr.s_addr = ((struct sockaddr_in *) addr)->sin_addr.s_addr; - mreq.imr_interface.s_addr = INADDR_ANY; - if (setsockopt (sockfd, IPPROTO_IP, IP_DROP_MEMBERSHIP, (const void *) &mreq, sizeof (mreq)) < 0) { - perror ("setsockopt(IP_DROP_MEMBERSHIP)"); - return -1; - } - } -#endif - if (addr->sa_family == AF_INET6) { - struct ipv6_mreq mreq6; - memcpy (&mreq6.ipv6mr_multiaddr, &(((struct sockaddr_in6 *) addr)->sin6_addr), sizeof (struct in6_addr)); - mreq6.ipv6mr_interface = iface; - if (setsockopt (sockfd, IPPROTO_IPV6, IPV6_DROP_MEMBERSHIP, (_SOTYPE)&mreq6, sizeof (mreq6)) < 0) { - perror ("setsockopt(IPV6_DROP_MEMBERSHIP)"); - return -1; - } - } - return 0; -} - -//----------------------------------------------------------------------------------------------------------------------------------- -STATIC int sockfd_to_family (SOCKET sockfd) -{ - struct sockaddr_storage ss; - socklen_t len; - - len = sizeof (ss); - if (getsockname (sockfd, (SA *) & ss, &len) < 0) - return (-1); - return (ss.ss_family); -} - -/* end sockfd_to_family */ -//---------------------------------------------------------------------------------------------------------------------------------- -int mcast_set_if (SOCKET sockfd, const char *ifname, u_int ifindex) -{ - switch (sockfd_to_family (sockfd)) { -#ifdef IPV4 - case AF_INET:{ - struct in_addr inaddr; - struct ifreq ifreq; - - if (ifindex > 0) { - if (if_indextoname (ifindex, ifreq.ifr_name) == NULL) { - errno = ENXIO; /* i/f index not found */ - return (-1); - } - goto doioctl; - } else if (ifname != NULL) { - memset(&ifreq, 0, sizeof(struct ifreq)); - strncpy (ifreq.ifr_name, ifname, IFNAMSIZ-1); - doioctl: - if (ioctl (sockfd, SIOCGIFADDR, &ifreq) < 0) - return (-1); - memcpy (&inaddr, &((struct sockaddr_in *) &ifreq.ifr_addr)->sin_addr, sizeof (struct in_addr)); - } else - inaddr.s_addr = htonl (INADDR_ANY); /* remove prev. set default */ - - return (setsockopt (sockfd, IPPROTO_IP, IP_MULTICAST_IF, &inaddr, sizeof (struct in_addr))); - } -#endif - case AF_INET6:{ - u_int idx; -// printf("Changing interface IPV6...\n"); - if ((idx = ifindex) == 0) { - if (ifname == NULL) { - errno = EINVAL; /* must supply either index or name */ - return (-1); - } - if ((idx = if_nametoindex (ifname)) == 0) { - errno = ENXIO; /* i/f name not found */ - return (-1); - } - } - return (setsockopt (sockfd, IPPROTO_IPV6, IPV6_MULTICAST_IF, (_SOTYPE)&idx, sizeof (idx))); - } - - default: -// errno = EAFNOSUPPORT; - return (-1); - } -} - -//-------------------------------------------------------------------------------------------------------------------------------------------- -UDPContext *server_udp_open (const struct in6_addr *mcg, int port, const char *ifname) -{ - UDPContext *s; - int sendfd; - int n; - - pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, NULL); - - s = (UDPContext *) calloc (1, sizeof (UDPContext)); - if (!s) { - err ("Cannot allocate memory !\n"); - goto error; - } - struct sockaddr_in6 *addr = (struct sockaddr_in6 *) &s->dest_addr; - - addr->sin6_addr=*mcg;; - addr->sin6_family = AF_INET6; - addr->sin6_port = htons (port); - s->dest_addr_len = sizeof (struct sockaddr_in6); - - sendfd = socket (PF_INET6, SOCK_DGRAM, IPPROTO_UDP); - if (sendfd < 0) { - err ("cannot get socket\n"); - } - - s->dest_addr_len = sizeof (struct sockaddr_in6); - - if ((udp_ipv6_is_multicast_address ((struct sockaddr *) &s->dest_addr))) { - if (ifname && strlen (ifname) && (mcast_set_if (sendfd, ifname, 0) < 0)) { - warn ("mcast_set_if error\n"); - goto error; - } - if (udp_ipv6_set_multicast_ttl (sendfd, MCAST_TTL, (struct sockaddr *) &s->dest_addr) < 0) { - warn ("udp_ipv6_set_multicast_ttl"); - } - } - - n = UDP_TX_BUF_SIZE; +(symlink to ../common/mcast.c)
View file
vdr-mcli-plugin.tar.bz2/mcast/tool/mingw
Added
+(directory)
View file
vdr-mcli-plugin.tar.bz2/mcast/tool/mingw/Makefile
Added
@@ -0,0 +1,26 @@ +NETCVDIAG = netcvdiag.exe +NETCVDIAG_OBJS = netcvdiag.o tools.o + +NETCVLOGVIEW = netcvlogview.exe +NETCVLOGVIEW_OBJS = netcvlogview.o mcast.o + +CC:=gcc +CFLAGS:= -O2 -DCLIENT -DSTATICLIB -Wall -I../../common/win32/include -I../../common -I../../client +LDFLAGS:= -s -L../../common/win32/lib +LDLIBS:=-lmingwex -lpthreadGC2 -lmcli -lxml2 -lz -liphlpapi -lws2_32 + +all: $(NETCVDIAG) $(NETCVLOGVIEW) + @echo Note: netcvupdate.exe can't be built without POSIX environment. + +$(NETCVDIAG): $(NETCVDIAG_OBJS) + $(CC) $(LDFLAGS) -o $@ $(NETCVDIAG_OBJS) $(LDLIBS) + +$(NETCVLOGVIEW): $(NETCVLOGVIEW_OBJS) + $(CC) $(LDFLAGS) -o $@ $(NETCVLOGVIEW_OBJS) $(LDLIBS) + +%.o: ../%.c + $(CC) -c $(CFLAGS) -o $@ $< + +clean: + @-del $(NETCVDIAG) $(NETCVLOGVIEW) *.o *.la *~ +
View file
vdr-mcli-plugin.tar.bz2/mcast/tool/mingw/build.cmd
Added
@@ -0,0 +1,2 @@ +@set PATH=c:\MinGw\bin;%PATH% +@mingw32-make
View file
vdr-mcli-plugin.tar.bz2/mcast/tool/mingw/clean.cmd
Added
@@ -0,0 +1,2 @@ +@set PATH=c:\MinGw\bin;%PATH% +@mingw32-make clean
View file
vdr-mcli-plugin.tar.bz2/mcast/tool/netcvdiag.c
Changed
@@ -5,6 +5,10 @@ #include "headers.h" +#ifdef __MINGW32__ +#include <getopt.h> +#endif + #ifdef API_SOCK /*------------------------------------------------------------------------*/
View file
vdr-mcli-plugin.tar.bz2/mcast/tool/netcvlogview.c
Changed
@@ -1,17 +1,31 @@ #include "headers.h" +#ifdef __MINGW32__ +#include <getopt.h> +extern void bzero(void *s, size_t n); +#endif + +#define HDR_CHK_PACKET_LENGTH 1424 +#define HDR_CHK_LENGTH 16 + +static int quit=0; + +void sighandler(int sig) { + quit=1; +} + int main (int argc, char **argv) { UDPContext *s; unsigned char buf[UDP_TX_BUF_SIZE]; memset (buf, 0x55, sizeof (buf)); - int ret, len, i, mode = 1, mcg_num = 1, port = 23000, c, needhelp = 0; + int ret, len, i, mode = 1, mcg_num = 1, port = 23000, c, needhelp = 0, wait = 0, file = 0, loop = 0, header = 0, lost = 0; char mcg[10][1024]; char *ifname = NULL; strcpy (mcg[0], "ff18:5100::"); do { - ret = getopt_long (argc, argv, "hrtp:g:xi:", NULL, NULL); + ret = getopt_long (argc, argv, "hrtp:g:xi:w:flH", NULL, NULL); if(ret<0) { break; } @@ -20,6 +34,9 @@ case 'i': ifname = optarg; break; + case 'f': + file = 1; + break; case 'r': mode = 1; break; @@ -29,9 +46,18 @@ case 'x': mode = 3; break; + case 'H': + header = 1; + break; + case 'l': + loop = 1; + break; case 'p': port = atoi (optarg); break; + case 'w': + wait = atoi (optarg); + break; case 'g': for (mcg_num = 0, optind--; optind < argc; optind++, mcg_num++) { if (argv[optind][0] != '-') { @@ -49,7 +75,7 @@ while (c >= 0); if (needhelp) { - fprintf (stderr, "usage: netcvlogview -i <network interface> <-r|-t> -g <multicast groups> -p <port>\n"); + fprintf (stderr, "usage: netcvlogview -i <network interface> <-r|-t> -g <multicast groups> -p <port> -w <seconds timeout> -H\n"); return -1; } @@ -59,6 +85,10 @@ } fprintf (stderr, "]\n"); +#ifdef __MINGW32__ + recv_init (ifname, port); +#endif + switch (mode) { case 1: @@ -76,12 +106,69 @@ } } - while (1) { - len = udp_read (s, buf, sizeof (buf), 50, NULL); - for (i = 0; i < len; i++) { - fputc (buf[i], stdout); + signal(SIGTERM, sighandler); + signal(SIGINT, sighandler); + + FILE *f; + time_t first; + time_t last; + int hc, i; + do { + first=last=hc=lost=0; + if(file) { + f=fopen("rawfile.temp", "wb"); + if(f==NULL) { + perror("Cannot open file for writing\n"); + return -1; + } + } else { + f=stdout; } - } + while (!quit &&(!wait || !last || ((time(NULL)-last) < wait))) { + len = udp_read (s, buf, sizeof (buf), 50, NULL); + if(len>0) { + if(header) { + if(len!=HDR_CHK_PACKET_LENGTH) { + fprintf(stderr, "Expected header length mismatch %d != %d!\n", len, HDR_CHK_PACKET_LENGTH); + } + uint32_t *cnt=(uint32_t *)buf; + int hv=ntohl(*cnt); + if(hv == hc) { + fwrite (buf+HDR_CHK_LENGTH, len-HDR_CHK_LENGTH, 1, f); + hc++; + } else { + bzero(buf, HDR_CHK_PACKET_LENGTH); + for(i=hc; i<hv; i++) { + fwrite(buf, HDR_CHK_PACKET_LENGTH-HDR_CHK_LENGTH, 1, f); + } + lost+=(hv-hc); + hc=i; + } + } else { + fwrite (buf, len, 1, f); + } + last=time(NULL); + if(!first) { + first=last; + } + } + } + fclose(f); + if(file) { + if(quit) { + unlink("rawfile.temp"); + } else { + struct tm *now=localtime(&first); + char fname[80]; + sprintf(fname, "%04d%02d%02d-%02d%02d%02d.raw", now->tm_year+1900, now->tm_mon+1, now->tm_mday, now->tm_hour, now->tm_min, now->tm_sec); + rename("rawfile.temp", fname); + fprintf(stderr, "[%s] New log file: %s (%u packets)\n",ifname, fname, hc); + if(lost) { + fprintf(stderr, "Warning: Lost %d frames of %d payload bytes, now filled with padding bytes (0)\n", lost, HDR_CHK_PACKET_LENGTH-HDR_CHK_LENGTH); + } + } + } + } while(loop && ! quit); udp_close (s); } break; @@ -90,7 +177,7 @@ s = server_udp_open_host (mcg[0], port, ifname); if (s) { while (1) { - if(fread (buf, 1316, 1, stdin)<0) { + if(!fread (buf, 1316, 1, stdin)) { break; } udp_write (s, buf, 1316);
View file
vdr-mcli-plugin.tar.bz2/mcast/tool/tools.c
Changed
@@ -1,777 +0,0 @@ -/* - * (c) BayCom GmbH, http://www.baycom.de, info@baycom.de - * - * See the COPYING file for copyright information and - * how to reach the author. - * - */ - -#define DEBUG 1 -#include "headers.h" - -#ifdef DEBUG -const Param inversion_list[] = { - {"INVERSION_OFF", INVERSION_OFF}, - {"INVERSION_ON", INVERSION_ON}, - {"INVERSION_AUTO", INVERSION_AUTO} -}; - -const Param bw_list[] = { - {"BANDWIDTH_6_MHZ", BANDWIDTH_6_MHZ}, - {"BANDWIDTH_7_MHZ", BANDWIDTH_7_MHZ}, - {"BANDWIDTH_8_MHZ", BANDWIDTH_8_MHZ} -}; - -const Param fec_list[] = { - {"FEC_1_2", FEC_1_2}, - {"FEC_2_3", FEC_2_3}, - {"FEC_3_4", FEC_3_4}, - {"FEC_4_5", FEC_4_5}, - {"FEC_5_6", FEC_5_6}, - {"FEC_6_7", FEC_6_7}, - {"FEC_7_8", FEC_7_8}, - {"FEC_8_9", FEC_8_9}, - {"FEC_AUTO", FEC_AUTO}, - {"FEC_NONE", FEC_NONE}, - {"FEC_1_4", FEC_1_4}, // RMM S2 Extension - {"FEC_1_3", FEC_1_3}, - {"FEC_2_5", FEC_2_5}, - {"FEC_9_10", FEC_9_10} -}; - -const Param guard_list[] = { - {"GUARD_INTERVAL_1_16", GUARD_INTERVAL_1_16}, - {"GUARD_INTERVAL_1_32", GUARD_INTERVAL_1_32}, - {"GUARD_INTERVAL_1_4", GUARD_INTERVAL_1_4}, - {"GUARD_INTERVAL_1_8", GUARD_INTERVAL_1_8} -}; - -const Param hierarchy_list[] = { - {"HIERARCHY_1", HIERARCHY_1}, - {"HIERARCHY_2", HIERARCHY_2}, - {"HIERARCHY_4", HIERARCHY_4}, - {"HIERARCHY_NONE", HIERARCHY_NONE} -}; - -const Param constellation_list[] = { - {"QPSK", QPSK}, - {"QAM_128", QAM_128}, - {"QAM_16", QAM_16}, - {"QAM_256", QAM_256}, - {"QAM_32", QAM_32}, - {"QAM_64", QAM_64}, - {"QPSK_S2", QPSK_S2}, // RMM S2 Extension - {"PSK8", PSK8} -}; - -const Param transmissionmode_list[] = { - {"TRANSMISSION_MODE_2K", TRANSMISSION_MODE_2K}, - {"TRANSMISSION_MODE_8K", TRANSMISSION_MODE_8K}, -}; - -const Param capabilities_list[] = { - {"Stupid: ", FE_IS_STUPID}, - {"FE_CAN_INVERSION_AUTO: ", FE_CAN_INVERSION_AUTO}, - {"CAN_FEC_1_2: ", FE_CAN_FEC_1_2}, - {"CAN_FEC_2_3: ", FE_CAN_FEC_2_3}, - {"CAN_FEC_3_4: ", FE_CAN_FEC_3_4}, - {"CAN_FEC_4_5: ", FE_CAN_FEC_4_5}, - {"CAN_FEC_6_7: ", FE_CAN_FEC_6_7}, - {"CAN_FEC_7_8: ", FE_CAN_FEC_7_8}, - {"CAN_FEC_8_9: ", FE_CAN_FEC_8_9}, - {"CAN_FEC_AUTO: ", FE_CAN_FEC_AUTO}, - {"FE_CAN_QPSK: ", FE_CAN_QPSK}, - {"FE_CAN_QAM_16: ", FE_CAN_QAM_16}, - {"FE_CAN_QAM_32: ", FE_CAN_QAM_32}, - {"FE_CAN_QAM_64: ", FE_CAN_QAM_64}, - {"FE_CAN_QAM_128: ", FE_CAN_QAM_128}, - {"FE_CAN_QAM_256: ", FE_CAN_QAM_256}, - {"FE_CAN_QAM_AUTO: ", FE_CAN_QAM_AUTO}, - {"FE_CAN_TRANSMISSION_MODE_AUTO: ", FE_CAN_TRANSMISSION_MODE_AUTO}, - {"FE_CAN_BANDWIDTH_AUTO: ", FE_CAN_BANDWIDTH_AUTO}, - {"FE_CAN_GUARD_INTERVAL_AUTO: ", FE_CAN_GUARD_INTERVAL_AUTO}, - {"FE_CAN_HIERARCHY_AUTO: ", FE_CAN_HIERARCHY_AUTO}, - {"FE_CAN_MUTE_TS: ", FE_CAN_MUTE_TS} -// {"FE_CAN_CLEAN_SETUP: ",FE_CAN_CLEAN_SETUP} -}; - -#define LIST_SIZE(x) sizeof(x)/sizeof(Param) - -//----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -void print_fe_info (struct dvb_frontend_info *fe_info) -{ - fprintf (stdout, "-------------------------------------------\n"); - fprintf (stdout, "Tuner name: %s\n", fe_info->name); - fprintf (stdout, "Tuner type: %u\n", (unsigned int) fe_info->type); - fprintf (stdout, "Frequency min.: %u\n", fe_info->frequency_min); - fprintf (stdout, "Frequency max.: %u\n", fe_info->frequency_max); - fprintf (stdout, "Frequency stepsize: %u\n", fe_info->frequency_stepsize); - fprintf (stdout, "Frequency tolerance: %u\n", fe_info->frequency_tolerance); - fprintf (stdout, "Symbol rate min: %u\n", fe_info->symbol_rate_min); - fprintf (stdout, "Symbol rate max: %u\n", fe_info->symbol_rate_max); - fprintf (stdout, "Symbol rate tolerance: %u\n", fe_info->symbol_rate_tolerance); - fprintf (stdout, "Notifier delay: %u\n", fe_info->notifier_delay); - fprintf (stdout, "Cpas: 0x%x\n", (unsigned int) fe_info->caps); - - fprintf (stdout, "-------------------------------------------\n"); - fprintf (stdout, "Frontend Capabilities:\n"); - int i; - - for (i = 0; i < LIST_SIZE (capabilities_list); i++) { - if (fe_info->caps & capabilities_list[i].value) - fprintf (stdout, "%syes\n", capabilities_list[i].name); - else - fprintf (stdout, "%sno\n", capabilities_list[i].name); - } - fprintf (stdout, "-------------------------------------------\n"); -} - -//----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -void print_frontend_settings (struct dvb_frontend_parameters *frontend_param) -{ - int i; - fprintf (stdout, "\n----- Front End Settings ----- "); - fprintf (stdout, "\nFrequency : %u \n", frontend_param->frequency); - for (i = 0; i < LIST_SIZE (inversion_list); i++) { - if (inversion_list[i].value == frontend_param->inversion) - fprintf (stdout, "Inversion : %s\n", inversion_list[i].name); - - } - // - for (i = 0; i < LIST_SIZE (bw_list); i++) { - if (frontend_param->u.ofdm.bandwidth == bw_list[i].value) - fprintf (stdout, "Bandwidth : %s\n", bw_list[i].name); - - } - for (i = 0; i < LIST_SIZE (fec_list); i++) { - if (fec_list[i].value == frontend_param->u.ofdm.code_rate_HP) - fprintf (stdout, "Code Rate HP : %s\n", fec_list[i].name); - - } - for (i = 0; i < LIST_SIZE (fec_list); i++) { - if (fec_list[i].value == frontend_param->u.ofdm.code_rate_LP) - fprintf (stdout, "Code Rate LP : %s\n", fec_list[i].name); - - } - - for (i = 0; i < LIST_SIZE (constellation_list); i++) { - if (constellation_list[i].value == frontend_param->u.ofdm.constellation) - fprintf (stdout, "Modulation : %s\n", constellation_list[i].name); - - } - - for (i = 0; i < LIST_SIZE (transmissionmode_list); i++) { - if (transmissionmode_list[i].value == frontend_param->u.ofdm.transmission_mode) - fprintf (stdout, "Transmission mode : %s\n", transmissionmode_list[i].name); - - } - - for (i = 0; i < LIST_SIZE (guard_list); i++) { - if (guard_list[i].value == frontend_param->u.ofdm.guard_interval) - fprintf (stdout, "Guard interval : %s\n", guard_list[i].name); - - } - - for (i = 0; i < LIST_SIZE (hierarchy_list); i++) { - if (hierarchy_list[i].value == frontend_param->u.ofdm.hierarchy_information) - fprintf (stdout, "Hierarchy Information : %s\n", hierarchy_list[i].name); - - } - -} - -//----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -void print_mcg (struct in6_addr *mcg) -{ - char host[80]; - unsigned int freq; - struct in6_addr mc; - int i; - - for (i = 0; i < 8; i++) { - mc.s6_addr16[i] = ntohs (mcg->s6_addr16[i]); - } - - freq = mc.s6_addr16[6] | (mc.s6_addr16[7] & NOPID_MASK) << 3; - - inet_ntop (AF_INET6, mcg->s6_addr, (char *) host, INET6_ADDRSTRLEN); - fprintf (stdout, "MCG: %s\n", host); - +(symlink to ../common/tools.c)
View file
vdr-mcli-plugin.tar.bz2/mcli.c
Changed
@@ -410,6 +410,7 @@ satellite_info_t *s=satlist->sat+i; switch(s->type){ case SAT_SRC_LNB: + case SAT_SRC_UNI: if(pos == s->SatPos) { // printf("satlist found\n"); return true; @@ -471,6 +472,17 @@ return NULL; } +bool cPluginMcli::Ready() +{ + tuner_pool_t *tp; + for(int i=0; i<TUNER_POOL_MAX; i++) { + tp=m_tuner_pool+i; + if(tp->type != -1) + return true; + } + return false; +} + int cPluginMcli::TunerCountByType (const fe_type_t type) { int ret=0;
View file
vdr-mcli-plugin.tar.bz2/mcli.h
Changed
@@ -161,6 +161,7 @@ bool TunerSatelitePositionLookup(tuner_pool_t *tp, int pos) const; tuner_pool_t *TunerFindByUUID (const char *uuid); + bool Ready(); int TunerCountByType (const fe_type_t type); bool TunerPoolAdd(tuner_info_t *t); bool TunerPoolDel(tuner_pool_t *tp);
View file
vdr-mcli-plugin.tar.bz2/po/de_DE.po
Changed
@@ -22,7 +22,7 @@ msgstr "Aktualisiere Konfiguration..." msgid "Configuration is up to date..." -msgstr "Konfuguration ist aktuell..." +msgstr "Konfiguration ist aktuell..." #, c-format msgid "Getting configuration from Netceiver %s" @@ -30,7 +30,7 @@ #, c-format msgid "Failed to get configuration from Netceiver %s" -msgstr "Fehler beim Holen der Konfiguration von Netceiver %s" +msgstr "Fehler beim Laden der Konfiguration von Netceiver %s" #, c-format msgid "Changing configuration for Netceiver %s"
View file
vdr-mcli-plugin.tar.bz2/po/nl_NL.po
Added
@@ -0,0 +1,87 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: vdr-mcli 1.0\n" +"Report-Msgid-Bugs-To: <see README>\n" +"POT-Creation-Date: 2010-06-29 16:08+0200\n" +"PO-Revision-Date: 2011-06-15 21:59+0100\n" +"Last-Translator: TechNL <technl@reelbox4all.com>\n" +"Language-Team: German <reelbox-devel@mailings.reelbox.org>\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "Multi-Transponder" +msgstr "Multi-Transponder" + +msgid "Updating configuration..." +msgstr "Konfiguratie updaten..." + +msgid "Configuration is up to date..." +msgstr "Konfuguratie is aktueel..." + +#, c-format +msgid "Getting configuration from Netceiver %s" +msgstr "Configuratiie van Netceiver %s ophalen" + +#, c-format +msgid "Failed to get configuration from Netceiver %s" +msgstr "Fout tijdens het ophalen van de configuratie van Netceiver %s" + +#, c-format +msgid "Changing configuration for Netceiver %s" +msgstr "Configuratie aktualiseren van Netceiver %s" + +#, c-format +msgid "Failed to parse configuration from Netceiver %s" +msgstr "Fout tijdens het parsen van de config van Netceiver %s" + +#, c-format +msgid "Failed to set configuration for Netceiver %s" +msgstr "Fout tijdens het instellen van de config van Netceiver %s" + +#, c-format +msgid "Failed to save configuration for Netceiver %s" +msgstr "Fout bij het opslaan van de config van Netceiver %s" + +#, c-format +msgid "Saving configuration for Netceiver %s" +msgstr "Opslaan van de configuratie van Netceiver %s" + +msgid "Multi-Transponder-Decryption is" +msgstr "Multi-Transponder decoderen is niet" + +msgid "impossible because of mixed CAMs" +msgstr "mogelijk omdat verschillende CAM's worden gebruikt" + +msgid "Save" +msgstr "Opslaan" + +#, c-format +msgid "Waiting for a free tuner (%s)" +msgstr "Wachten tot tuner voor (%s) beschikbaar komt" + +msgid "DVB-C" +msgstr "DVB-C" + +msgid "DVB-T" +msgstr "DVB-T" + +msgid "DVB-S" +msgstr "DVB-S" + +msgid "DVB-S2" +msgstr "DVB-S2" + +#, c-format +msgid "Module '%s' ready" +msgstr "Module '%s' gereed" + +#, c-format +msgid "Module '%s' removed" +msgstr "Module '%s' verwijderd" +
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.