Renamed logging to tracing.

This commit is contained in:
Rolf Ahrenberg 2014-12-21 16:11:05 +02:00
parent 1bc2dc01fd
commit f884b23f7c
6 changed files with 54 additions and 51 deletions

View File

@ -78,8 +78,8 @@ VDR Plugin 'satip' Revision History
- Added support for SAT>IP frontend selection via
Radio ID.
- Added command-line switches for manually defining
used SAT>IP servers and setting used logging mode.
- Added new STAT and LOGG commands into the SVDRP
used SAT>IP servers and setting used tracing mode.
- Added new STAT and TRAC commands into the SVDRP
interface.
- Refactored the tuner implementation.
- Updated against SAT>IP protocol specification

3
README
View File

@ -116,6 +116,9 @@ Notes:
direct access to any DVB card devices. The integrated CAM slot in
Octopus Net devices isn't supported.
- Tracing can be set on/off dynamically via command-line switch or
SVDRP command.
Acknowledgements:
- Big thanks to Digital Devices GmbH for providing the Octopus Net

View File

@ -13,7 +13,7 @@ cSatipConfig SatipConfig;
cSatipConfig::cSatipConfig(void)
: operatingModeM(eOperatingModeLow),
loggingModeM(eLoggingModeNormal),
traceModeM(eTraceModeNormal),
eitScanM(1),
useBytesM(1)
{

View File

@ -15,7 +15,7 @@ class cSatipConfig
{
private:
unsigned int operatingModeM;
unsigned int loggingModeM;
unsigned int traceModeM;
unsigned int eitScanM;
unsigned int useBytesM;
int disabledSourcesM[MAX_DISABLED_SOURCES_COUNT];
@ -30,25 +30,25 @@ public:
eOperatingModeHigh,
eOperatingModeCount
};
enum eLoggingMode {
eLoggingModeNormal = 0x0000,
eLoggingModeDebug1 = 0x0001,
eLoggingModeDebug2 = 0x0002,
eLoggingModeDebug3 = 0x0004,
eLoggingModeDebug4 = 0x0008,
eLoggingModeDebug5 = 0x0010,
eLoggingModeDebug6 = 0x0020,
eLoggingModeDebug7 = 0x0040,
eLoggingModeDebug8 = 0x0080,
eLoggingModeDebug9 = 0x0100,
eLoggingModeDebug10 = 0x0200,
eLoggingModeDebug11 = 0x0400,
eLoggingModeDebug12 = 0x0800,
eLoggingModeDebug13 = 0x1000,
eLoggingModeDebug14 = 0x2000,
eLoggingModeDebug15 = 0x4000,
eLoggingModeDebug16 = 0x8000,
eLoggingModeMask = 0xFFFF
enum eTraceMode {
eTraceModeNormal = 0x0000,
eTraceModeDebug1 = 0x0001,
eTraceModeDebug2 = 0x0002,
eTraceModeDebug3 = 0x0004,
eTraceModeDebug4 = 0x0008,
eTraceModeDebug5 = 0x0010,
eTraceModeDebug6 = 0x0020,
eTraceModeDebug7 = 0x0040,
eTraceModeDebug8 = 0x0080,
eTraceModeDebug9 = 0x0100,
eTraceModeDebug10 = 0x0200,
eTraceModeDebug11 = 0x0400,
eTraceModeDebug12 = 0x0800,
eTraceModeDebug13 = 0x1000,
eTraceModeDebug14 = 0x2000,
eTraceModeDebug15 = 0x4000,
eTraceModeDebug16 = 0x8000,
eTraceModeMask = 0xFFFF
};
cSatipConfig();
unsigned int GetOperatingMode(void) const { return operatingModeM; }
@ -57,8 +57,8 @@ public:
bool IsOperatingModeNormal(void) const { return (operatingModeM == eOperatingModeNormal); }
bool IsOperatingModeHigh(void) const { return (operatingModeM == eOperatingModeHigh); }
void ToggleOperatingMode(void) { operatingModeM = (operatingModeM + 1) % eOperatingModeCount; }
unsigned int GetLoggingMode(void) const { return loggingModeM; }
bool IsLoggingMode(eLoggingMode modeP) const { return (loggingModeM & modeP); }
unsigned int GetTraceMode(void) const { return traceModeM; }
bool IsTraceMode(eTraceMode modeP) const { return (traceModeM & modeP); }
unsigned int GetEITScan(void) const { return eitScanM; }
unsigned int GetUseBytes(void) const { return useBytesM; }
const char *GetConfigDirectory(void) const { return configDirectoryM; }
@ -68,7 +68,7 @@ public:
int GetDisabledFilters(unsigned int indexP) const;
void SetOperatingMode(unsigned int operatingModeP) { operatingModeM = operatingModeP; }
void SetLoggingMode(unsigned int modeP) { loggingModeM = (modeP & eLoggingModeMask); }
void SetTraceMode(unsigned int modeP) { traceModeM = (modeP & eTraceModeMask); }
void SetEITScan(unsigned int onOffP) { eitScanM = onOffP; }
void SetUseBytes(unsigned int onOffP) { useBytesM = onOffP; }
void SetConfigDirectory(const char *directoryP);

32
log.h
View File

@ -13,37 +13,37 @@
#define error(x...) esyslog("SATIP-ERROR: " x)
#define info(x...) isyslog("SATIP: " x)
// 0x0001: Generic call stack
#define debug1(x...) void( SatipConfig.IsLoggingMode(cSatipConfig::eLoggingModeDebug1) ? dsyslog("SATIP1: " x) : void() )
#define debug1(x...) void( SatipConfig.IsTraceMode(cSatipConfig::eTraceModeDebug1) ? dsyslog("SATIP1: " x) : void() )
// 0x0002: CURL data flow
#define debug2(x...) void( SatipConfig.IsLoggingMode(cSatipConfig::eLoggingModeDebug2) ? dsyslog("SATIP2: " x) : void() )
#define debug2(x...) void( SatipConfig.IsTraceMode(cSatipConfig::eTraceModeDebug2) ? dsyslog("SATIP2: " x) : void() )
// 0x0004: Data parsing
#define debug3(x...) void( SatipConfig.IsLoggingMode(cSatipConfig::eLoggingModeDebug3) ? dsyslog("SATIP3: " x) : void() )
#define debug3(x...) void( SatipConfig.IsTraceMode(cSatipConfig::eTraceModeDebug3) ? dsyslog("SATIP3: " x) : void() )
// 0x0008: Tuner state machine
#define debug4(x...) void( SatipConfig.IsLoggingMode(cSatipConfig::eLoggingModeDebug4) ? dsyslog("SATIP4: " x) : void() )
#define debug4(x...) void( SatipConfig.IsTraceMode(cSatipConfig::eTraceModeDebug4) ? dsyslog("SATIP4: " x) : void() )
// 0x0010: RTSP responses
#define debug5(x...) void( SatipConfig.IsLoggingMode(cSatipConfig::eLoggingModeDebug5) ? dsyslog("SATIP5: " x) : void() )
#define debug5(x...) void( SatipConfig.IsTraceMode(cSatipConfig::eTraceModeDebug5) ? dsyslog("SATIP5: " x) : void() )
// 0x0020: RTP throughput performance
#define debug6(x...) void( SatipConfig.IsLoggingMode(cSatipConfig::eLoggingModeDebug6) ? dsyslog("SATIP6: " x) : void() )
#define debug6(x...) void( SatipConfig.IsTraceMode(cSatipConfig::eTraceModeDebug6) ? dsyslog("SATIP6: " x) : void() )
// 0x0040: RTP packet internals
#define debug7(x...) void( SatipConfig.IsLoggingMode(cSatipConfig::eLoggingModeDebug7) ? dsyslog("SATIP7: " x) : void() )
#define debug7(x...) void( SatipConfig.IsTraceMode(cSatipConfig::eTraceModeDebug7) ? dsyslog("SATIP7: " x) : void() )
// 0x0080: Section filtering
#define debug8(x...) void( SatipConfig.IsLoggingMode(cSatipConfig::eLoggingModeDebug8) ? dsyslog("SATIP8: " x) : void() )
#define debug8(x...) void( SatipConfig.IsTraceMode(cSatipConfig::eTraceModeDebug8) ? dsyslog("SATIP8: " x) : void() )
// 0x0100: Channel switching
#define debug9(x...) void( SatipConfig.IsLoggingMode(cSatipConfig::eLoggingModeDebug9) ? dsyslog("SATIP9: " x) : void() )
#define debug9(x...) void( SatipConfig.IsTraceMode(cSatipConfig::eTraceModeDebug9) ? dsyslog("SATIP9: " x) : void() )
// 0x0200: RTCP packets
#define debug10(x...) void( SatipConfig.IsLoggingMode(cSatipConfig::eLoggingModeDebug10) ? dsyslog("SATIP10: " x) : void() )
#define debug10(x...) void( SatipConfig.IsTraceMode(cSatipConfig::eTraceModeDebug10) ? dsyslog("SATIP10: " x) : void() )
// 0x0400: TBD
#define debug11(x...) void( SatipConfig.IsLoggingMode(cSatipConfig::eLoggingModeDebug11) ? dsyslog("SATIP11: " x) : void() )
#define debug11(x...) void( SatipConfig.IsTraceMode(cSatipConfig::eTraceModeDebug11) ? dsyslog("SATIP11: " x) : void() )
// 0x0800: TBD
#define debug12(x...) void( SatipConfig.IsLoggingMode(cSatipConfig::eLoggingModeDebug12) ? dsyslog("SATIP12: " x) : void() )
#define debug12(x...) void( SatipConfig.IsTraceMode(cSatipConfig::eTraceModeDebug12) ? dsyslog("SATIP12: " x) : void() )
// 0x1000: TBD
#define debug13(x...) void( SatipConfig.IsLoggingMode(cSatipConfig::eLoggingModeDebug13) ? dsyslog("SATIP13: " x) : void() )
#define debug13(x...) void( SatipConfig.IsTraceMode(cSatipConfig::eTraceModeDebug13) ? dsyslog("SATIP13: " x) : void() )
// 0x2000: TBD
#define debug14(x...) void( SatipConfig.IsLoggingMode(cSatipConfig::eLoggingModeDebug14) ? dsyslog("SATIP14: " x) : void() )
#define debug14(x...) void( SatipConfig.IsTraceMode(cSatipConfig::eTraceModeDebug14) ? dsyslog("SATIP14: " x) : void() )
// 0x4000: TBD
#define debug15(x...) void( SatipConfig.IsLoggingMode(cSatipConfig::eLoggingModeDebug15) ? dsyslog("SATIP15: " x) : void() )
#define debug15(x...) void( SatipConfig.IsTraceMode(cSatipConfig::eTraceModeDebug15) ? dsyslog("SATIP15: " x) : void() )
// 0x8000; Extra call stack
#define debug16(x...) void( SatipConfig.IsLoggingMode(cSatipConfig::eLoggingModeDebug16) ? dsyslog("SATIP16: " x) : void() )
#define debug16(x...) void( SatipConfig.IsTraceMode(cSatipConfig::eTraceModeDebug16) ? dsyslog("SATIP16: " x) : void() )
#endif // __SATIP_LOG_H

18
satip.c
View File

@ -91,19 +91,19 @@ bool cPluginSatip::ProcessArgs(int argc, char *argv[])
// Implement command line argument processing here if applicable.
static const struct option long_options[] = {
{ "devices", required_argument, NULL, 'd' },
{ "logging", required_argument, NULL, 'l' },
{ "trace", required_argument, NULL, 't' },
{ "server", required_argument, NULL, 's' },
{ NULL, no_argument, NULL, 0 }
};
int c;
while ((c = getopt_long(argc, argv, "d:l:s:", long_options, NULL)) != -1) {
while ((c = getopt_long(argc, argv, "d:t:s:", long_options, NULL)) != -1) {
switch (c) {
case 'd':
deviceCountM = strtol(optarg, NULL, 0);
break;
case 'l':
SatipConfig.SetLoggingMode(strtol(optarg, NULL, 0));
case 't':
SatipConfig.SetTraceMode(strtol(optarg, NULL, 0));
break;
case 's':
ParseServer(optarg);
@ -323,8 +323,8 @@ const char **cPluginSatip::SVDRPHelpPages(void)
" Shows SAT>IP device count.\n",
"OPER\n"
" Toggles operating mode of SAT>IP devices.\n",
"LOGG [ <mode> ]\n"
" Gets and/or sets used logging mode.\n",
"TRAC [ <mode> ]\n"
" Gets and/or sets used tracing mode.\n",
NULL
};
return HelpPages;
@ -409,10 +409,10 @@ cString cPluginSatip::SVDRPCommand(const char *commandP, const char *optionP, in
}
return cString::sprintf("SATIP operating mode: %s\n", *mode);
}
else if (strcasecmp(commandP, "LOGG") == 0) {
else if (strcasecmp(commandP, "TRAC") == 0) {
if (optionP && *optionP)
SatipConfig.SetLoggingMode(strtol(optionP, NULL, 0));
return cString::sprintf("SATIP logging mode: 0x%04X\n", SatipConfig.GetLoggingMode());
SatipConfig.SetTraceMode(strtol(optionP, NULL, 0));
return cString::sprintf("SATIP tracing mode: 0x%04X\n", SatipConfig.GetTraceMode());
}
return NULL;