Whisper Library
|
Sends packets over a raw Socket. More...
Public Member Functions | |
void | sendTcp (string source_ip, string destination_ip, TcpPacket packet) |
sends a tcp packet to destination ip address More... | |
void | sendUdp (string destination_ip, UdpPacket packet) |
sends a udp packet to destination ip address More... | |
Private Member Functions | |
std::string | packetToString (vector< bool > packetData) |
converts packet data to string More... | |
ulong | ipToUlong (string ip) |
converts a ip from string to ulong representation More... | |
Sends packets over a raw Socket.
This class can be used to send packets to a destination ip address. It uses raw sockets to do so. On unix tcp and udp packets can be send, on windows, since XP SP3, the use of raw sockets is restricted, only udp packets can be send.
|
private |
converts a ip from string to ulong representation
ip | the IPv4 as text |
|
private |
converts packet data to string
The packet data gets converted from vector<bool> to std::string, so it can be processed easily.
packetData | the data to convert |
void whisper_library::SocketSender::sendTcp | ( | string | source_ip, |
string | destination_ip, | ||
TcpPacket | packet | ||
) |
sends a tcp packet to destination ip address
The checksum for the packet is calculated based on the given ip addresses and than the packet is send over a raw socket.
source_ip | the senders ip address |
destination_ip | the receivers ip address |
packet | the packet that gets send |
void whisper_library::SocketSender::sendUdp | ( | string | destination_ip, |
UdpPacket | packet | ||
) |
sends a udp packet to destination ip address
destination_ip | the receivers ip address |
packet | the packet that gets send |