mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-22 07:41:20 -04:00
First pass for windows compilation:
* brought over tou_net / tou_error => bdnet for windoze compatibility. * updated udplayer to inline with rs changes + win compatibility. * removed unix only networking #includes, replaced with "util/bdnet.h" * added subdirectory to #includes. * made udpbitdht_nettest use a random node id. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3302 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
d53a6c9d29
commit
d70337a642
30 changed files with 1209 additions and 635 deletions
|
@ -2,11 +2,11 @@
|
|||
#define BITDHT_UDP_LAYER_H
|
||||
|
||||
/*
|
||||
* bitdht/udplayer.h
|
||||
* udp/udplayer.h
|
||||
*
|
||||
* BitDHT: An Flexible DHT library.
|
||||
*
|
||||
* Copyright 2010 by Robert Fernie
|
||||
*
|
||||
* Copyright 2004-2010 by Robert Fernie
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
|
@ -27,21 +27,15 @@
|
|||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include "util/bdthreads.h"
|
||||
#include "util/bdnet.h"
|
||||
|
||||
#include <iosfwd>
|
||||
#include <list>
|
||||
#include <deque>
|
||||
|
||||
/****
|
||||
* #define UDP_LOOPBACK_TESTING 1
|
||||
***/
|
||||
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const struct sockaddr_in &addr);
|
||||
bool operator==(const struct sockaddr_in &addr, const struct sockaddr_in &addr2);
|
||||
bool operator<(const struct sockaddr_in &addr, const struct sockaddr_in &addr2);
|
||||
|
@ -125,4 +119,20 @@ virtual int sendUdpPacket(const void *data, int size, struct sockaddr_in &to);
|
|||
};
|
||||
|
||||
|
||||
/* For Testing - drops packets */
|
||||
class LossyUdpLayer: public UdpLayer
|
||||
{
|
||||
public:
|
||||
LossyUdpLayer(UdpReceiver *udpr, struct sockaddr_in &local, double frac);
|
||||
virtual ~LossyUdpLayer();
|
||||
|
||||
protected:
|
||||
|
||||
virtual int receiveUdpPacket(void *data, int *size, struct sockaddr_in &from);
|
||||
virtual int sendUdpPacket(const void *data, int size, struct sockaddr_in &to);
|
||||
|
||||
double lossFraction;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue