summaryrefslogtreecommitdiffstats
path: root/src/dabOutput
diff options
context:
space:
mode:
Diffstat (limited to 'src/dabOutput')
-rw-r--r--src/dabOutput/dabOutput.cpp6
-rw-r--r--src/dabOutput/dabOutputFifo.cpp2
-rw-r--r--src/dabOutput/dabOutputFile.cpp6
-rw-r--r--src/dabOutput/dabOutputRaw.cpp60
-rw-r--r--src/dabOutput/dabOutputTcp.cpp18
-rw-r--r--src/dabOutput/dabOutputUdp.cpp10
6 files changed, 51 insertions, 51 deletions
diff --git a/src/dabOutput/dabOutput.cpp b/src/dabOutput/dabOutput.cpp
index 18da57e..7144e20 100644
--- a/src/dabOutput/dabOutput.cpp
+++ b/src/dabOutput/dabOutput.cpp
@@ -36,13 +36,13 @@ DabOutputFifo::open(const char* name)
this->type = ETI_FILE_TYPE_STREAMED;
break;
} else {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"File type '%s' is not supported.\n", value);
return -1;
}
}
else {
- etiLog.printHeader(TcpLog::WARNING, "Parameter '%s' unknown\n", key);
+ etiLog.log(warn, "Parameter '%s' unknown\n", key);
}
}
} while (nextPair != NULL);
@@ -86,7 +86,7 @@ int DabOutputFifo::write(void* buffer, int size)
goto FIFO_WRITE_ERROR;
break;
default:
- etiLog.printHeader(TcpLog::ERR, "File type is not supported.\n");
+ etiLog.log(error, "File type is not supported.\n");
return -1;
}
diff --git a/src/dabOutput/dabOutputFifo.cpp b/src/dabOutput/dabOutputFifo.cpp
index 1674cd8..ea0f538 100644
--- a/src/dabOutput/dabOutputFifo.cpp
+++ b/src/dabOutput/dabOutputFifo.cpp
@@ -60,7 +60,7 @@ int DabOutputFifo::Write(void* buffer, int size)
goto FIFO_WRITE_ERROR;
break;
default:
- etiLog.printHeader(TcpLog::ERR, "File type is not supported.\n");
+ etiLog.log(error, "File type is not supported.\n");
return -1;
}
diff --git a/src/dabOutput/dabOutputFile.cpp b/src/dabOutput/dabOutputFile.cpp
index 6512c5a..79dbeee 100644
--- a/src/dabOutput/dabOutputFile.cpp
+++ b/src/dabOutput/dabOutputFile.cpp
@@ -59,13 +59,13 @@ int DabOutputFile::Open(const char* filename)
this->type_ = ETI_FILE_TYPE_STREAMED;
break;
} else {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"File type '%s' is not supported.\n", value);
return -1;
}
}
else {
- etiLog.printHeader(TcpLog::WARNING, "Parameter '%s' unknown\n", key);
+ etiLog.log(warn, "Parameter '%s' unknown\n", key);
}
}
} while (nextPair != NULL);
@@ -113,7 +113,7 @@ int DabOutputFile::Write(void* buffer, int size)
if (write(this->file_, padding, 6144 - size) == -1) goto FILE_WRITE_ERROR;
break;
default:
- etiLog.printHeader(TcpLog::ERR, "File type is not supported.\n");
+ etiLog.log(error, "File type is not supported.\n");
return -1;
}
diff --git a/src/dabOutput/dabOutputRaw.cpp b/src/dabOutput/dabOutputRaw.cpp
index a9cd2a9..eb70712 100644
--- a/src/dabOutput/dabOutputRaw.cpp
+++ b/src/dabOutput/dabOutputRaw.cpp
@@ -78,7 +78,7 @@ const unsigned char revTable[] = {
int DabOutputRaw::Open(const char* filename)
{
if (filename == NULL) {
- etiLog.printHeader(TcpLog::ERR, "Socket name must be provided!\n");
+ etiLog.log(error, "Socket name must be provided!\n");
return -1;
}
@@ -87,7 +87,7 @@ int DabOutputRaw::Open(const char* filename)
this->socket_ = CreateFile(filename, GENERIC_WRITE, 0, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, NULL);
if (this->socket_ == INVALID_HANDLE_VALUE) {
- etiLog.printHeader(TcpLog::ERR, "Can't open raw device '%s': %i\n",
+ etiLog.log(error, "Can't open raw device '%s': %i\n",
filename, GetLastError());
return -1;
}
@@ -97,7 +97,7 @@ int DabOutputRaw::Open(const char* filename)
FS_TE1_CONFIG config;
if (!DeviceIoControl(this->socket_, IoctlCodeFarSyncGetTE1Config, NULL, 0,
&config, sizeof(config), &result, NULL)) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Can't get raw device '%s' config: %i\n",
filename, GetLastError());
return -1;
@@ -121,7 +121,7 @@ int DabOutputRaw::Open(const char* filename)
config.idleCode = 0xff;
if (!DeviceIoControl(this->socket_, IoctlCodeFarSyncSetTE1Config,
&config, sizeof(config), NULL, 0, &result, NULL)) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Can't set raw device '%s' config: %i\n",
filename, GetLastError());
return -1;
@@ -130,14 +130,14 @@ int DabOutputRaw::Open(const char* filename)
// Starting device
if (!DeviceIoControl(this->socket_, IoctlCodeFarSyncQuickStart, NULL, 0,
NULL, 0, &result, NULL)) {
- etiLog.printHeader(TcpLog::ERR, "Can't start raw device '%s': %i\n",
+ etiLog.log(error, "Can't start raw device '%s': %i\n",
filename, GetLastError());
return -1;
}
#else
this->socket_ = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP);
if (this->socket_ == -1) {
- etiLog.printHeader(TcpLog::ERR, "Are you logged as root?\n");
+ etiLog.log(error, "Are you logged as root?\n");
perror(filename);
return -1;
}
@@ -152,19 +152,19 @@ int DabOutputRaw::Open(const char* filename)
memset(&info, 0, sizeof(info));
ifr.ifr_data = (char*)&info;
if (ioctl(this->socket_, FSTGETCONF, &ifr) == -1) {
- etiLog.printHeader(TcpLog::DBG, "Cyclades card identified.\n");
+ etiLog.log(debug, "Cyclades card identified.\n");
this->isCyclades_ = true;
// Set the interface MTU if needed
if (ioctl(this->socket_, SIOCGIFMTU, &ifr) == -1) {
- etiLog.printHeader(TcpLog::ERR, "Can't get raw device MTU!\n");
+ etiLog.log(error, "Can't get raw device MTU!\n");
perror(filename);
return -1;
} else {
if (ifr.ifr_mtu != 6143) {
ifr.ifr_mtu = 6143;
if (ioctl(this->socket_, SIOCSIFMTU, &ifr) == -1) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Can't Cyclades device MTU!\n");
perror(filename);
return -1;
@@ -172,7 +172,7 @@ int DabOutputRaw::Open(const char* filename)
}
}
} else {
- etiLog.printHeader(TcpLog::DBG, "Farsync card identified.\n");
+ etiLog.log(debug, "Farsync card identified.\n");
this->isCyclades_ = false;
info.lineInterface = E1;
@@ -196,38 +196,38 @@ int DabOutputRaw::Open(const char* filename)
info.valid = FSTVAL_ALL;
// Setting configuration
- etiLog.printHeader(TcpLog::DBG, "Set configuration.\n");
+ etiLog.log(debug, "Set configuration.\n");
ifr.ifr_data = (char*)&info;
if (ioctl(this->socket_, FSTSETCONF, &ifr) == -1) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Can't set Farsync configurationi!\n");
perror(filename);
return -1;
}
// Disabling notify
- etiLog.printHeader(TcpLog::DBG, "Disable notify.\n");
+ etiLog.log(debug, "Disable notify.\n");
int notify = 0;
ifr.ifr_data = (char*)&notify;
if (ioctl(this->socket_, FSTSNOTIFY, &ifr) == -1) {
- etiLog.printHeader(TcpLog::ERR, "Can't disable Farsync notify!\n");
+ etiLog.log(error, "Can't disable Farsync notify!\n");
perror(filename);
return -1;
}
// Apply the new configuration
// Set the interface down if needed
- etiLog.printHeader(TcpLog::DBG, "Get flags.\n");
+ etiLog.log(debug, "Get flags.\n");
if (ioctl(this->socket_, SIOCGIFFLAGS, &ifr) == -1) {
- etiLog.printHeader(TcpLog::ERR, "Can't get Farsync flags!\n");
+ etiLog.log(error, "Can't get Farsync flags!\n");
perror(filename);
return -1;
} else {
if (ifr.ifr_flags & IFF_UP) {
- etiLog.printHeader(TcpLog::DBG, "Set flags.\n");
+ etiLog.log(debug, "Set flags.\n");
ifr.ifr_flags &= ~IFF_UP;
if (ioctl(this->socket_, SIOCSIFFLAGS, &ifr) == -1) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Can't turn down Farsync device!\n");
perror(filename);
return -1;
@@ -236,17 +236,17 @@ int DabOutputRaw::Open(const char* filename)
}
// Set the interface MTU if needed
- etiLog.printHeader(TcpLog::DBG, "Get MTU.\n");
+ etiLog.log(debug, "Get MTU.\n");
if (ioctl(this->socket_, SIOCGIFMTU, &ifr) == -1) {
- etiLog.printHeader(TcpLog::ERR, "Can't get Farsync MTU!\n");
+ etiLog.log(error, "Can't get Farsync MTU!\n");
perror(filename);
return -1;
} else {
if (ifr.ifr_mtu != 6144) {
- etiLog.printHeader(TcpLog::DBG, "Set MTU.\n");
+ etiLog.log(debug, "Set MTU.\n");
ifr.ifr_mtu = 6144;
if (ioctl(this->socket_, SIOCSIFMTU, &ifr) == -1) {
- etiLog.printHeader(TcpLog::ERR, "Can't set Farsync MTU!\n");
+ etiLog.log(error, "Can't set Farsync MTU!\n");
perror(filename);
return -1;
}
@@ -255,17 +255,17 @@ int DabOutputRaw::Open(const char* filename)
}
// Set the interface up if needed
- etiLog.printHeader(TcpLog::DBG, "Get flags.\n");
+ etiLog.log(debug, "Get flags.\n");
if (ioctl(this->socket_, SIOCGIFFLAGS, &ifr) == -1) {
- etiLog.printHeader(TcpLog::ERR, "Can't get raw device flags!\n");
+ etiLog.log(error, "Can't get raw device flags!\n");
perror(filename);
return -1;
} else {
if (!(ifr.ifr_flags & IFF_UP)) {
ifr.ifr_flags |= IFF_UP;
- etiLog.printHeader(TcpLog::DBG, "Set flags.\n");
+ etiLog.log(debug, "Set flags.\n");
if (ioctl(this->socket_, SIOCSIFFLAGS, &ifr) == -1) {
- etiLog.printHeader(TcpLog::ERR, "Can't turn up raw device!\n");
+ etiLog.log(error, "Can't turn up raw device!\n");
perror(filename);
return -1;
}
@@ -279,13 +279,13 @@ int DabOutputRaw::Open(const char* filename)
////////////////////
if ((this->socket_ = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_CUST))) == -1) {
- etiLog.printHeader(TcpLog::ERR, "Are you logged as root?\n");
+ etiLog.log(error, "Are you logged as root?\n");
perror(filename);
return -1;
}
// ioctl to read the interface number
- etiLog.printHeader(TcpLog::DBG, "Get index.\n");
+ etiLog.log(debug, "Get index.\n");
memset(&ifr, 0, sizeof(struct ifreq));
strncpy(ifr.ifr_name, filename, sizeof(ifr.ifr_name));
if (ioctl(this->socket_, SIOCGIFINDEX, (char *) &ifr) == -1) {
@@ -294,13 +294,13 @@ int DabOutputRaw::Open(const char* filename)
}
// Bind to the interface name
- etiLog.printHeader(TcpLog::DBG, "Bind interface.\n");
+ etiLog.log(debug, "Bind interface.\n");
memset(&saddr, 0, sizeof(struct sockaddr_ll));
saddr.sll_family = AF_PACKET;
saddr.sll_protocol = ARPHRD_RAWHDLC;
saddr.sll_ifindex = ifr.ifr_ifindex;
if (bind(this->socket_, (struct sockaddr *) &saddr, sizeof(saddr)) == -1) {
- etiLog.printHeader(TcpLog::ERR, "Can't bind raw device!\n");
+ etiLog.log(error, "Can't bind raw device!\n");
perror(filename);
return -1;
}
diff --git a/src/dabOutput/dabOutputTcp.cpp b/src/dabOutput/dabOutputTcp.cpp
index c59eacb..427018e 100644
--- a/src/dabOutput/dabOutputTcp.cpp
+++ b/src/dabOutput/dabOutputTcp.cpp
@@ -52,13 +52,13 @@ void* tcpThread(void* param)
DabOutputTcp* tcp = (DabOutputTcp*)param;
while ((client = tcp->server->accept()) != NULL) {
- etiLog.print(TcpLog::INFO, "TCP server got a new client.\n");
+ etiLog.log(info, "TCP server got a new client.\n");
if (tcp->client != NULL) {
delete tcp->client;
}
tcp->client = client;
}
- etiLog.print(TcpLog::ERR, "TCP thread can't accept new client (%s)\n",
+ etiLog.log(error, "TCP thread can't accept new client (%s)\n",
inetErrDesc, inetErrMsg);
return NULL;
@@ -72,7 +72,7 @@ int DabOutputTcp::Open(const char* name)
long port;
address = strchr((char*)hostport, ':');
if (address == NULL) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"\"%s\" is an invalid format for tcp address: "
"should be [address]:port - > aborting\n",
hostport);
@@ -84,26 +84,26 @@ int DabOutputTcp::Open(const char* name)
port = strtol(address, (char **)NULL, 10);
if ((port == LONG_MIN) || (port == LONG_MAX)) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"can't convert port number in tcp address %s\n", address);
goto tcp_open_fail;
}
if (port == 0) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"can't use port number 0 in tcp address\n");
goto tcp_open_fail;
}
address = hostport;
if (strlen(address) > 0) {
if (this->server->create(port, address) == -1) {
- etiLog.printHeader(TcpLog::ERR, "Can't create Tcp server on %s:%i "
+ etiLog.log(error, "Can't create Tcp server on %s:%i "
"(%s: %s) -> aborting\n",
address, port, inetErrDesc, inetErrMsg);
goto tcp_open_fail;
}
} else {
if (this->server->create(port) == -1) {
- etiLog.printHeader(TcpLog::ERR, "Can't create Tcp server on :%i "
+ etiLog.log(error, "Can't create Tcp server on :%i "
"(%s: %s) -> aborting\n",
port, inetErrDesc, inetErrMsg);
goto tcp_open_fail;
@@ -114,7 +114,7 @@ int DabOutputTcp::Open(const char* name)
// this->packet_->getAddress().getPort());
if (this->server->listen() == -1) {
- etiLog.printHeader(TcpLog::ERR, "Can't listen on Tcp socket (%s: %s)\n",
+ etiLog.log(error, "Can't listen on Tcp socket (%s: %s)\n",
inetErrDesc, inetErrMsg);
goto tcp_open_fail;
}
@@ -149,7 +149,7 @@ int DabOutputTcp::Write(void* buffer, int size)
}
}
else {
- etiLog.print(TcpLog::INFO, "TCP server client disconnected.\n");
+ etiLog.log(info, "TCP server client disconnected.\n");
delete this->client;
this->client = NULL;
}
diff --git a/src/dabOutput/dabOutputUdp.cpp b/src/dabOutput/dabOutputUdp.cpp
index 684cd50..459120f 100644
--- a/src/dabOutput/dabOutputUdp.cpp
+++ b/src/dabOutput/dabOutputUdp.cpp
@@ -52,7 +52,7 @@ int DabOutputUdp::Open(const char* name)
long port;
address = strchr(hostport, ':');
if (address == NULL) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"\"%s\" is an invalid format for UDP address: "
"should be [address]:port - > aborting\n",
hostport);
@@ -64,19 +64,19 @@ int DabOutputUdp::Open(const char* name)
port = strtol(address, (char **)NULL, 10);
if ((port == LONG_MIN) || (port == LONG_MAX)) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"can't convert port number in UDP address %s\n", address);
goto udp_open_fail;
}
if (port == 0) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"can't use port number 0 in UDP address\n");
goto udp_open_fail;
}
address = hostport;
if (strlen(address) > 0) {
if (this->packet_->getAddress().setAddress(address) == -1) {
- etiLog.printHeader(TcpLog::ERR, "can't set address %s (%s: %s) "
+ etiLog.log(error, "can't set address %s (%s: %s) "
"-> aborting\n", address, inetErrDesc, inetErrMsg);
goto udp_open_fail;
}
@@ -84,7 +84,7 @@ int DabOutputUdp::Open(const char* name)
this->packet_->getAddress().setPort(port);
if (this->socket_->create() == -1) {
- etiLog.printHeader(TcpLog::ERR, "can't create UDP socket (%s: %s) "
+ etiLog.log(error, "can't create UDP socket (%s: %s) "
"-> aborting\n)", inetErrDesc, inetErrMsg);
goto udp_open_fail;
}