Initial network support

This commit is contained in:
Keith Winstein
2011-08-02 12:49:02 -04:00
parent 507e791888
commit 6ea66b7aab
5 changed files with 127 additions and 3 deletions
+32
View File
@@ -0,0 +1,32 @@
#include <assert.h>
#include "network.hpp"
using namespace std;
using namespace Network;
template <class Payload>
Connection<Payload>::Packet::Packet( int64_t s_seq, int64_t s_ack, Packet *s_previous, Payload s_state )
: seq( s_seq ), ack( s_ack ), previous( s_previous ), state( s_state )
{
}
template <class Payload>
Connection<Payload>::Packet::Packet( string wire )
{
assert( wire.length() >= 32 );
seq = be64toh( (uint64_t) *wire_c );
reference_seq = be64toh( (uint64_t) *( wire_c + 8 ) );
tag = string( wire.begin() + 16, wire.begin() + 32 );
ack = be64toh( (uint64_t) *( wire_c + 16 ) );
}
template <class Payload>
Connection<Payload>::Connection( const char *ip, const char *port, bool server )
{
}