fix conflict for IPv6-diff

GetAddr(), GetPort() and SetPort() in cip.h now has no implementations,
they will be moved at cip.cpp.
pull/205/head
SASANO Takayoshi 4 years ago
parent 34c8128c15
commit 6ab8567a22

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

@ -58,9 +58,9 @@ public:
// settings // settings
void SetCallsign(const CCallsign &callsign) { m_Callsign = callsign; } void SetCallsign(const CCallsign &callsign) { m_Callsign = callsign; }
const CCallsign &GetCallsign(void) const { return m_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; } 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 uint8 *GetListenMac(void) const { return (const uint8 *)m_Mac; }
const CIp &GetTranscoderIp(void) const { return m_AmbedIp; } const CIp &GetTranscoderIp(void) const { return m_AmbedIp; }
@ -124,7 +124,7 @@ protected:
protected: protected:
// identity // identity
CCallsign m_Callsign; CCallsign m_Callsign;
CIp m_Ip; CIp m_Ip[UDP_SOCKET_MAX];
uint8 m_Mac[6]; uint8 m_Mac[6];
CIp m_AmbedIp; CIp m_AmbedIp;

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

Loading…
Cancel
Save

Powered by TurnKey Linux.