mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-24 00:31:32 -04:00
Massive commit - changing from sockaddr_in => sockaddr_storage.
In preparation for making RS support IPv6. NB: This breaks the build of retroshare-gui, as the sockaddr_storage_xxx fns are only defined as prototypes for now. All the aux libraries like udp / stun / tcponudp / dht have still to be converted. These changes will probably break various things and need to be tested thoroughly. git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.6-initdev@6735 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
fd071161bf
commit
6290d8fed9
66 changed files with 1182 additions and 1046 deletions
|
@ -33,9 +33,11 @@ const int pqipersonzone = 82371;
|
|||
#include "util/rsstring.h"
|
||||
|
||||
/****
|
||||
* #define PERSON_DEBUG
|
||||
* #define PERSON_DEBUG 1
|
||||
****/
|
||||
|
||||
#define PERSON_DEBUG 1
|
||||
|
||||
pqiperson::pqiperson(std::string id, pqipersongrp *pg)
|
||||
:PQInterface(id), active(false), activepqi(NULL),
|
||||
inConnectAttempt(false), waittimes(0),
|
||||
|
@ -217,7 +219,7 @@ int pqiperson::notifyEvent(NetInterface *ni, int newState)
|
|||
|
||||
/* notify */
|
||||
if (pqipg) {
|
||||
struct sockaddr_in remote_peer_address;
|
||||
struct sockaddr_storage remote_peer_address;
|
||||
pqi->getConnectAddress(remote_peer_address);
|
||||
pqipg->notifyConnect(PeerId(), type, true, remote_peer_address);
|
||||
}
|
||||
|
@ -287,8 +289,8 @@ int pqiperson::notifyEvent(NetInterface *ni, int newState)
|
|||
/* notify up */
|
||||
if (pqipg)
|
||||
{
|
||||
struct sockaddr_in raddr;
|
||||
sockaddr_clear(&raddr);
|
||||
struct sockaddr_storage raddr;
|
||||
sockaddr_storage_clear(raddr);
|
||||
pqipg->notifyConnect(PeerId(), type, false, raddr);
|
||||
}
|
||||
|
||||
|
@ -366,8 +368,8 @@ int pqiperson::stoplistening()
|
|||
return 1;
|
||||
}
|
||||
|
||||
int pqiperson::connect(uint32_t type, struct sockaddr_in raddr,
|
||||
struct sockaddr_in &proxyaddr, struct sockaddr_in &srcaddr,
|
||||
int pqiperson::connect(uint32_t type, const struct sockaddr_storage &raddr,
|
||||
const struct sockaddr_storage &proxyaddr, const struct sockaddr_storage &srcaddr,
|
||||
uint32_t delay, uint32_t period, uint32_t timeout, uint32_t flags, uint32_t bandwidth,
|
||||
const std::string &domain_addr, uint16_t domain_port)
|
||||
{
|
||||
|
@ -376,9 +378,12 @@ int pqiperson::connect(uint32_t type, struct sockaddr_in raddr,
|
|||
{
|
||||
std::string out = "pqiperson::connect() Id: " + PeerId();
|
||||
rs_sprintf_append(out, " type: %u", type);
|
||||
rs_sprintf_append(out, " addr: %s:%u", rs_inet_ntoa(raddr.sin_addr).c_str(), ntohs(raddr.sin_port));
|
||||
rs_sprintf_append(out, " proxyaddr: %s:%u", rs_inet_ntoa(proxyaddr.sin_addr).c_str(), ntohs(proxyaddr.sin_port));
|
||||
rs_sprintf_append(out, " srcaddr: %s:%u", rs_inet_ntoa(srcaddr.sin_addr).c_str(), ntohs(srcaddr.sin_port));
|
||||
out += " addr: ";
|
||||
out += sockaddr_storage_tostring(raddr);
|
||||
out += " proxyaddr: ";
|
||||
out += sockaddr_storage_tostring(proxyaddr);
|
||||
out += " srcaddr: ";
|
||||
out += sockaddr_storage_tostring(srcaddr);
|
||||
rs_sprintf_append(out, " delay: %u", delay);
|
||||
rs_sprintf_append(out, " period: %u", period);
|
||||
rs_sprintf_append(out, " timeout: %u", timeout);
|
||||
|
@ -428,8 +433,8 @@ int pqiperson::connect(uint32_t type, struct sockaddr_in raddr,
|
|||
(it->second)->connect_parameter(NET_PARAM_CONNECT_FLAGS, flags);
|
||||
(it->second)->connect_parameter(NET_PARAM_CONNECT_BANDWIDTH, bandwidth);
|
||||
|
||||
(it->second)->connect_additional_address(NET_PARAM_CONNECT_PROXY, &proxyaddr);
|
||||
(it->second)->connect_additional_address(NET_PARAM_CONNECT_SOURCE, &srcaddr);
|
||||
(it->second)->connect_additional_address(NET_PARAM_CONNECT_PROXY, proxyaddr);
|
||||
(it->second)->connect_additional_address(NET_PARAM_CONNECT_SOURCE, srcaddr);
|
||||
|
||||
// These are used by Proxy/Hidden
|
||||
(it->second)->connect_parameter(NET_PARAM_CONNECT_DOMAIN_ADDRESS, domain_addr);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue