X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=greprotocol.cpp;h=4a634156789f0aa3848d8ac1aaf5172a65d0bd4d;hb=66d3e5110affbc70766211aeff46c4f41e532ed1;hp=b826a521d7828c4e18421250f07c8a3ee8d09d9d;hpb=7c67b21504e7758f4148386befc8cd80455a1a85;p=greproxy diff --git a/greprotocol.cpp b/greprotocol.cpp index b826a52..4a63415 100644 --- a/greprotocol.cpp +++ b/greprotocol.cpp @@ -44,7 +44,7 @@ GREProtocol::GREProtocol(const in6_addr &src, const in6_addr &dst) } } -void GREProtocol::send_packet(uint16_t proto, const string &data) +void GREProtocol::send_packet(uint16_t proto, const string &data, int incoming_seq) { char buf[4096]; gre_header *gre = (gre_header *)buf; @@ -55,7 +55,7 @@ void GREProtocol::send_packet(uint16_t proto, const string &data) gre->protocol_type = htons(proto); char *ptr = buf + sizeof(*gre); - int seq_be = htonl(seq++); + int seq_be = htonl(seq++); // Ignore incoming_seq. memcpy(ptr, &seq_be, sizeof(seq_be)); ptr += sizeof(seq_be); @@ -72,7 +72,7 @@ int GREProtocol::fd() const return sock; } -void GREProtocol::read_packet(Reorderer *sender) +void GREProtocol::read_packet(Protocol *sender) { struct sockaddr_storage addr; socklen_t addrlen = sizeof(addr); @@ -107,6 +107,6 @@ void GREProtocol::read_packet(Reorderer *sender) //printf("gre packet: proto=%x\n", ntohs(gre->protocol_type)); - sender->handle_packet(ntohs(gre->protocol_type), string(ptr, buf + ret), seq); + sender->send_packet(ntohs(gre->protocol_type), string(ptr, buf + ret), seq); }