-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathuxcom.hpp
71 lines (56 loc) · 2.03 KB
/
uxcom.hpp
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
62
63
64
65
66
67
68
69
70
71
/*
Socle - Socket Library Ecosystem
Copyright (c) 2014, Ales Stibal <astib@mag0.net>, All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3.0 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library.
*/
#ifndef UXCOM_HPP
# define UXCOM_HPP
#include <string>
#include <cstring>
#include <ctime>
#include <csignal>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/stat.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <fcntl.h>
#include <unistd.h>
#include <log/logger.hpp>
#include <basecom.hpp>
#include <display.hpp>
#include <tcpcom.hpp>
class UxCom : public TCPCom {
public:
UxCom(): TCPCom() {
l3_proto(AF_UNIX);
l4_proto(SOCK_STREAM);
// change socket properties
connect_sock_family = AF_UNIX;
connect_sock_type = SOCK_STREAM;
bind_sock_family = AF_UNIX;
bind_sock_type = SOCK_STREAM;
bind_sock_protocol = 0;
};
~UxCom() override;
baseCom* replicate() override { return new UxCom(); };
int connect(const char* host, const char* port) override;
int bind(unsigned short port) final; //this bind is deprecated, returning always -1. Use bind(const char*).
int bind(const char* name) override;
TYPENAME_OVERRIDE("UxCom")
std::string to_string([ [maybe_unused]] int verbosity) const override { return c_type(); };
std::string shortname() const override { return std::string("ux"); }
private:
logan_lite log {"com.unix"};
};
#endif