Rabbit Remote Control 0.0.30
Loading...
Searching...
No Matches
WakeOnLan.h
1// Author: Kang Lin <kl222@126.com>
2
3#ifndef __WAKE_ON_LAN_H_2024_09_25__
4#define __WAKE_ON_LAN_H_2024_09_25__
5
6#pragma once
7
8#include <stdint.h>
9#include <string>
10
12 public:
13 CWakeOnLan(const std::string& szBroadcastAddress = "255.255.255.255");
14
15 void SetBroadcastAddress(const std::string& szBroadcastAddress = "255.255.255.255");
16 std::string SetBroadcastAddress(const std::string& szIP, const std::string& szMask);
17
18 bool StringToArray(/*[out]*/uint8_t* mac, /*[in]*/const char* szMac);
19
27 bool SendMagicPacket(const std::string& szMac, uint16_t portNum = 9);
28
38 const std::string& szMac,
39 const std::string szPassword,
40 uint16_t portNum = 9);
41
42 bool SendMagicPacket(const char* pszMacAddress, uint16_t portNum = 9);
44 const char* pszMacAddress,
45 const char* pszPassword,
46 uint16_t portNum = 9);
47
48 bool SendMagicPacket(uint8_t* pMacAddress,
49 size_t sizeOfMacAddress,
50 uint16_t portNum = 9);
51 bool SendSecureMagicPacket(uint8_t* pMacAddress,
52 size_t sizeOfMacAddress,
53 uint8_t* pszPassword,
54 size_t nPasswordSize,
55 uint16_t portNum = 9);
56
57 void GenerateMagicPacket(uint8_t*& pMagicPacket, size_t& sizeOfMagicPacket,
58 uint8_t* pMacAddress, size_t sizeOfMacAddress);
59 void GenerateSecureMagicPacket(uint8_t*& pMagicPacket,
60 size_t& sizeOfMagicPacket,
61 uint8_t* pMacAddress,
62 size_t sizeOfMacAddress,
63 uint8_t* pSecureOn,
64 size_t sizeOfSecureOn);
65
66protected:
67 virtual int SendPacket(const char* data, int64_t size, std::string addr, uint16_t port) = 0;
68
69private:
70 std::string m_szBroadcastAddress;
71};
72
73#endif // __WAKE_ON_LAN_H_2024_09_25__
bool SendSecureMagicPacket(const std::string &szMac, const std::string szPassword, uint16_t portNum=9)
SendSecureMagicPacket.
Definition WakeOnLan.cpp:70
bool SendMagicPacket(const std::string &szMac, uint16_t portNum=9)
SendMagicPacket.
Definition WakeOnLan.cpp:66