fix conflict for IPv6-diff

GetAddr(), GetPort() and SetPort() in cip.h now has no implementations,
they will be moved at cip.cpp.
This commit is contained in:
SASANO Takayoshi 2021-11-03 05:07:21 +09:00
parent 34c8128c15
commit 6ab8567a22
3 changed files with 14 additions and 10 deletions

View file

@ -33,25 +33,26 @@ class CIp
{
public:
// constructors
CIp();
CIp(const int af = AF_INET);
//CIp(uint8, uint8, uint8, uint8);
CIp(const struct sockaddr_in *);
CIp(const struct sockaddr_storage *, socklen_t);
CIp(const char *);
CIp(const CIp &);
CIp(const CIp &, uint16);
// destructor
virtual ~CIp() {};
// sockaddr
void SetSockAddr(struct sockaddr_in *);
struct sockaddr_in *GetSockAddr(void) { return &m_Addr; }
void SetSockAddr(struct sockaddr_storage *, socklen_t);
struct sockaddr_storage *GetSockAddr(socklen_t &);
// get
uint32 GetAddr(void) const { return m_Addr.sin_addr.s_addr; }
uint16 GetPort(void) const { return m_Addr.sin_port; }
uint32 GetAddr(void) const;
uint16 GetPort(void) const;
// set
void SetPort(uint16 port) { m_Addr.sin_port = port; }
void SetPort(uint16 port);
// operator
bool operator ==(const CIp &) const;

View file

@ -58,9 +58,9 @@ public:
// settings
void SetCallsign(const CCallsign &callsign) { m_Callsign = callsign; }
const CCallsign &GetCallsign(void) const { return m_Callsign; }
void SetListenIp(const CIp &ip) { m_Ip = ip; UpdateListenMac(); }
void SetListenIp(int i, const CIp &ip) { m_Ip[i] = ip; UpdateListenMac(); }
void SetTranscoderIp(const CIp &ip) { m_AmbedIp = ip; }
const CIp &GetListenIp(void) const { return m_Ip; }
const CIp &GetListenIp(int i = 0) const { return m_Ip[i]; }
const uint8 *GetListenMac(void) const { return (const uint8 *)m_Mac; }
const CIp &GetTranscoderIp(void) const { return m_AmbedIp; }
@ -124,7 +124,7 @@ protected:
protected:
// identity
CCallsign m_Callsign;
CIp m_Ip;
CIp m_Ip[UDP_SOCKET_MAX];
uint8 m_Mac[6];
CIp m_AmbedIp;

View file

@ -39,8 +39,11 @@
#include <iostream>
#include <iomanip>
#include <fstream>
#include <random>
#include <algorithm>
#include <arpa/inet.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <ifaddrs.h>
////////////////////////////////////////////////////////////////////////////////////////