Skip to content

Commit

Permalink
Field ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
R. Kaleta committed May 13, 2020
1 parent c02a63b commit 230186d
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 17 deletions.
9 changes: 4 additions & 5 deletions include/ICMPController.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@

class ICMPController
{
private:
const RawSocket & socket;
SocketSender sender;
SocketReceiver receiver;

public:
explicit ICMPController(RawSocket & s)
: socket{s}, sender{SocketSender(s)}, receiver{SocketReceiver(s)}
Expand All @@ -25,6 +20,10 @@ class ICMPController

private:
IPAddress recv_echo(uint16_t id, uint16_t ttl);

const RawSocket & socket;
SocketSender sender;
SocketReceiver receiver;
};

#endif
3 changes: 1 addition & 2 deletions include/IPAddress.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@

class IPAddress
{
private:
public:
using addr_t = uint32_t;

public:
explicit IPAddress(addr_t a) : address{a}
{
}
Expand Down
3 changes: 1 addition & 2 deletions include/RawSocket.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@
#include <stdexcept>
#include <unistd.h>

class SocketException : public std::logic_error
struct SocketException : public std::logic_error
{
public:
explicit SocketException(const char * s) : std::logic_error(s)
{
}
Expand Down
8 changes: 4 additions & 4 deletions include/SocketReceiver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@

class SocketReceiver
{
private:
const RawSocket & socket;
sockaddr_in sender_address;

public:
explicit SocketReceiver(RawSocket & s) : socket{s}, sender_address{}
{
}

std::vector<uint8_t> receive();
IPAddress take_address();

private:
const RawSocket & socket;
sockaddr_in sender_address;
};

#endif
8 changes: 4 additions & 4 deletions include/SocketSender.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@

class SocketSender
{
private:
const RawSocket & socket;
sockaddr_in receiver_address;

public:
explicit SocketSender(RawSocket & s) : socket{s}, receiver_address{}
{
}

void send(const void * msg_buf, int msg_size, uint16_t ttl);
void set_receiver(const IPAddress & addr);

private:
const RawSocket & socket;
sockaddr_in receiver_address;
};

#endif

0 comments on commit 230186d

Please sign in to comment.