blob: 5b4e753457fb6694f19d307b66c42480912a1273 (
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
57
58
59
60
61
|
/**************************************************************************/
/* */
/* Copyright (c) 2015 Qindel Formacion y Servicios SL. */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License Version 2, as */
/* published by the Free Software Foundation. */
/* */
/* This program is distributed in the hope that it will be useful, but */
/* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTA- */
/* BILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General */
/* Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program; if not, you can request a copy to Qindel */
/* or write to the Free Software Foundation, Inc., 59 Temple Place, Suite */
/* 330, Boston, MA 02111-1307 USA */
/* */
/* All rights reserved. */
/* */
/**************************************************************************/
#ifndef ChannelEndPoint_H
#define ChannelEndPoint_H
#include <iostream>
#include <sys/un.h>
class ChannelEndPoint
{
private:
long defaultTCPPort_;
int defaultTCPInterface_; // 0=localhost, otherwise IP of public interface.
char *defaultUnixPath_;
char *spec_;
bool specIsPort(long *port = NULL) const;
public:
ChannelEndPoint(const char *spec = NULL);
ChannelEndPoint &operator=(const ChannelEndPoint &other);
bool enabled() const;
bool disabled() { return !enabled(); }
void disable();
void setSpec(const char *spec);
void setSpec(int port);
void setDefaultTCPPort(long port);
void setDefaultTCPInterface(int publicInterface);
void setDefaultUnixPath(char *path);
bool getUnixPath(char **path = NULL) const;
bool getTCPHostAndPort(char **hostname = NULL, long *port = NULL) const;
long getTCPPort() const;
bool validateSpec();
};
std::ostream& operator<<(std::ostream& os, const ChannelEndPoint& endPoint);
#endif
|