-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathutils.h
More file actions
40 lines (29 loc) · 742 Bytes
/
Copy pathutils.h
File metadata and controls
40 lines (29 loc) · 742 Bytes
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
//
// Created by root on 11/21/19.
//
#ifndef PKTMINERG_UTILS_H
#define PKTMINERG_UTILS_H
#ifdef WIN32
#include <WinSock2.h>
#else
#include <arpa/inet.h>
#endif
class AddressV4V6 {
public:
AddressV4V6();
int buildAddr(const char* addr);
int buildAddr(const char* addr, uint16_t port);
struct sockaddr_in* getAddressV4() { return &svrAddr4_; }
struct sockaddr_in6* getAddressV6() { return &svrAddr6_; }
int getDomainAF_NET();
struct sockaddr* getSockAddr();
size_t getSockLen();
bool isIpV6() { return sinFamily_ == AF_INET6; }
private:
union {
struct sockaddr_in svrAddr4_;
struct sockaddr_in6 svrAddr6_;
};
uint16_t sinFamily_;
};
#endif //PKTMINERG_UTILS_H