Initial commit
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
#ifndef BROADCASTCLIENT_H
|
||||
#define BROADCASTCLIENT_H
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace Network {
|
||||
|
||||
class BroadcastClientImpl;
|
||||
|
||||
class BroadcastClient
|
||||
{
|
||||
public:
|
||||
BroadcastClient(const std::string& listenAddress, int broadcastPort, std::function<void(const std::string&)> callback);
|
||||
~BroadcastClient();
|
||||
|
||||
public:
|
||||
void Receive();
|
||||
|
||||
std::string Send(const std::string& data, int sourcePort = 0);
|
||||
void Broadcast(const std::string& data, int sourcePort = 0);
|
||||
|
||||
private:
|
||||
std::unique_ptr<BroadcastClientImpl> m_pBroadcastClientImpl;
|
||||
};
|
||||
|
||||
} // namespace Network
|
||||
|
||||
#endif // BROADCASTCLIENT_H
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
#ifndef BROADCASTSERVER_H
|
||||
#define BROADCASTSERVER_H
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace Network {
|
||||
|
||||
class BroadcastServerImpl;
|
||||
|
||||
class BroadcastServer
|
||||
{
|
||||
public:
|
||||
BroadcastServer(const std::string& listenAddress, int broadcastPort, std::function<void(const std::string&)> callback);
|
||||
~BroadcastServer();
|
||||
|
||||
public:
|
||||
void Receive();
|
||||
|
||||
std::string Send(const std::string& data, int sourcePort = 0);
|
||||
void Broadcast(const std::string& data, int sourcePort = 0);
|
||||
|
||||
private:
|
||||
std::unique_ptr<BroadcastServerImpl> m_pBroadcastServerImpl;
|
||||
};
|
||||
|
||||
} // namespace Network
|
||||
|
||||
#endif // BROADCASTSERVER_H
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
#ifndef ICMPCLIENT_H
|
||||
#define ICMPCLIENT_H
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace Network {
|
||||
|
||||
class IcmpClientImpl;
|
||||
|
||||
class IcmpClient
|
||||
{
|
||||
public:
|
||||
IcmpClient();
|
||||
~IcmpClient();
|
||||
|
||||
public:
|
||||
bool Ping(const std::string& targetAddress);
|
||||
|
||||
private:
|
||||
std::unique_ptr<IcmpClientImpl> m_pIcmpClientImpl;
|
||||
};
|
||||
|
||||
} // namespace Network
|
||||
|
||||
#endif // ICMPCLIENT_H
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
#ifndef MULTICASTCLIENT_H
|
||||
#define MULTICASTCLIENT_H
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace Network {
|
||||
|
||||
class MulticastClientImpl;
|
||||
|
||||
class MulticastClient
|
||||
{
|
||||
public:
|
||||
MulticastClient(const std::string& listenAddress, const std::string& multicastAddress, int multicastPort, std::function<void(const std::string&)> callback);
|
||||
~MulticastClient();
|
||||
|
||||
public:
|
||||
void Receive();
|
||||
|
||||
std::string Send(const std::string& data, int sourcePort = 0);
|
||||
void Broadcast(const std::string& data, int sourcePort = 0);
|
||||
|
||||
private:
|
||||
std::unique_ptr<MulticastClientImpl> m_pMulticastClientImpl;
|
||||
};
|
||||
|
||||
} // namespace Network
|
||||
|
||||
#endif // MULTICASTCLIENT_H
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
#ifndef UDPCLIENT_H
|
||||
#define UDPCLIENT_H
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace Network {
|
||||
|
||||
class m_pUdpClientImpl;
|
||||
|
||||
class UdpClient
|
||||
{
|
||||
public:
|
||||
UdpClient(const std::string& listenAddress, const std::string& targetAddress, int targetPort, std::function<void(const std::string&)> callback);
|
||||
~UdpClient();
|
||||
|
||||
public:
|
||||
void Receive();
|
||||
|
||||
std::string Send(const std::string& data, int sourcePort = 0);
|
||||
void Broadcast(const std::string& data, int sourcePort = 0);
|
||||
|
||||
private:
|
||||
std::unique_ptr<UdpClientImpl> m_pUdpClientImpl;
|
||||
};
|
||||
|
||||
} // namespace Network
|
||||
|
||||
#endif // UDPCLIENT_H
|
||||
|
||||
Reference in New Issue
Block a user