blob: 7e7da7040e9003f566eb1684c273a79c216cd70c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
/*
* extendes sockets
*/
#include <unistd.h>
#include <vdr/plugin.h>
#include <openssl/err.h>
#include "sock.h"
#include "helpers.h"
#include "compressor.h"
/*
* cVdrmonSocket
*/
cVdrmanagerSocket::cVdrmanagerSocket() {
sock = -1;
}
cVdrmanagerSocket::~cVdrmanagerSocket() {
Close();
}
void cVdrmanagerSocket::Close() {
if (sock >= 0) {
close(sock);
sock = -1;
}
}
int cVdrmanagerSocket::GetSocket() {
return sock;
}
bool cVdrmanagerSocket::MakeDontBlock() {
// make it non-blocking:
int oldflags = fcntl(sock, F_GETFL, 0);
if (oldflags < 0) {
LOG_ERROR;
return false;
}
oldflags |= O_NONBLOCK;
if (fcntl(sock, F_SETFL, oldflags) < 0) {
LOG_ERROR;
return false;
}
return true;
}
const char * cVdrmanagerSocket::GetPassword() {
return password;
}
bool cVdrmanagerSocket::IsPasswordSet(){
return strcmp(password, "");
}
|