Added comment syntax for doxygen, fixed build flag which produced unnecessarily-large binaries, removed trailing whitespace

This commit is contained in:
Joseph Henry
2017-09-27 13:42:27 -07:00
parent 5f1e9fe795
commit 1afb2308b6
22 changed files with 562 additions and 711 deletions

View File

@@ -65,4 +65,4 @@ inline unsigned int gettid()
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -163,4 +163,4 @@ inline void in6_to_ip6(ip6_addr_t *ba, struct sockaddr_in6 *in6)
(((ip[14] & 0xffff) << 8) | ((ip[15]) & 0xffff))
);
}
*/
*/

View File

@@ -27,7 +27,7 @@
/**
* @file
*
*
*
*/
/*
@@ -48,4 +48,4 @@ struct VirtualBindingPair
#ifdef __cplusplus
}
#endif
*/
*/

View File

@@ -41,7 +41,7 @@
#include "RingBuffer.hpp"
#define VS_STATE_INACTIVE 0x000000u // Default value for newly created VirtualSocket
#define VS_STATE_ACTIVE 0x000001u // VirtualSocket is RX'ing or TX'ing without issue
#define VS_STATE_ACTIVE 0x000001u // VirtualSocket is RX'ing or TX'ing without issue
#define VS_STATE_SHOULD_SHUTDOWN 0x000002u // Application, stack driver, or stack marked this VirtualSocket for death
#define VS_STATE_SHUTDOWN 0x000004u // VirtualSocket and underlying protocol control structures will not RX/TX
#define VS_STATE_CLOSED 0x000008u // VirtualSocket and underlying protocol control structures are closed
@@ -52,10 +52,10 @@
#define VS_OPT_TCP_NODELAY 0x000000u // Nagle's algorithm
#define VS_OPT_SO_LINGER 0x000001u // VirtualSocket waits for data transmission before closure
/*
#define VS_RESERVED 0x000002u //
#define VS_RESERVED 0x000002u //
#define VS_RESERVED 0x000004u //
#define VS_RESERVED 0x000008u //
#define VS_RESERVED 0x000010u //
#define VS_RESERVED 0x000008u //
#define VS_RESERVED 0x000010u //
#define VS_RESERVED 0x000020u //
#define VS_RESERVED 0x000040u //
*/
@@ -75,8 +75,8 @@
#define VS_RESERVED 0x080000u //
#define VS_RESERVED 0x100000u //
#define VS_RESERVED 0x200000u //
#define VS_RESERVED 0x400000u //
#define VS_RESERVED 0x800000u //
#define VS_RESERVED 0x400000u //
#define VS_RESERVED 0x800000u //
*/
#define vs_is_nonblocking(vs) (((vs)->optflags & VS_OPT_FD_NONBLOCKING) != 0)
@@ -95,19 +95,19 @@ namespace ZeroTier {
* Sets the VirtualSocket's state value
*/
void apply_state(int state) {
_state &= state;
_state &= state;
}
/**
* Sets the VirtualSocket's state value
*/
void set_state(int state) {
_state = state;
_state = state;
}
/**
* Gets the VirtualSocket's state value
*/
int get_state() {
return _state;
return _state;
}
VirtualSocket() {

View File

@@ -190,7 +190,7 @@ namespace ZeroTier {
std::string VirtualTap::nodeId() const
{
if (zt1ServiceRef) {
char id[ZT_ID_LEN];
char id[ZTO_ID_LEN];
memset(id, 0, sizeof(id));
sprintf(id, "%lx",((ZeroTier::OneService *)zt1ServiceRef)->getNode()->address());
return std::string(id);
@@ -302,41 +302,41 @@ namespace ZeroTier {
/****************************************************************************/
// Connect
int VirtualTap::Connect(const struct sockaddr *addr, socklen_t addrlen)
int VirtualTap::Connect(const struct sockaddr *addr, socklen_t addrlen)
{
DEBUG_EXTRA();
return -1;
}
// Bind VirtualSocket to a network stack's interface
int VirtualTap::Bind(const struct sockaddr *addr, socklen_t addrlen)
int VirtualTap::Bind(const struct sockaddr *addr, socklen_t addrlen)
{
DEBUG_EXTRA();
return -1;
}
// Listen for an incoming VirtualSocket
int VirtualTap::Listen(int backlog)
int VirtualTap::Listen(int backlog)
{
DEBUG_EXTRA();
return -1;
}
// Accept a VirtualSocket
void VirtualTap::Accept()
void VirtualTap::Accept()
{
DEBUG_EXTRA();
}
// Read from stack/buffers into the app's socket
int VirtualTap::Read(PhySocket *sock,void **uptr,bool stack_invoked)
int VirtualTap::Read(PhySocket *sock,void **uptr,bool stack_invoked)
{
DEBUG_EXTRA();
return -1;
}
// Write data from app socket to the virtual wire, either raw over VL2, or via network stack
int VirtualTap::Write(void *data, ssize_t len)
int VirtualTap::Write(void *data, ssize_t len)
{
DEBUG_EXTRA("data=%p, len=%d", data, len);
return -1;
@@ -351,7 +351,7 @@ namespace ZeroTier {
// Remove VritualSocket from VirtualTap, and instruct network stacks to dismantle their
// respective protocol control structures
int VirtualTap::Close()
int VirtualTap::Close()
{
DEBUG_EXTRA();
return -1;
@@ -441,4 +441,4 @@ namespace ZeroTier {
void VirtualTap::phyOnTcpData(PhySocket *sock,void **uptr,void *data,unsigned long len) {}
void VirtualTap::phyOnTcpWritable(PhySocket *sock,void **uptr) {}
} // namespace ZeroTier
} // namespace ZeroTier

View File

@@ -286,4 +286,4 @@ namespace ZeroTier {
} // namespace ZeroTier
#endif
#endif // _H

View File

@@ -172,7 +172,7 @@ int zts_get_device_id_from_file(const char *filepath, char *devID) {
}
// Starts a ZeroTier service in the background
void *zts_start_service(void *thread_id)
void *zts_start_service(void *thread_id)
{
DEBUG_INFO("homeDir=%s", ZeroTier::homeDir.c_str());
// Where network .conf files will be stored
@@ -439,16 +439,6 @@ void zts_get_homepath(char *homePath, int len) {
}
}
void zts_core_version(char *ver) {
int major, minor, revision;
ZT_version(&major, &minor, &revision);
sprintf(ver, "%d.%d.%d", major, minor, revision);
}
void zts_lib_version(char *ver) {
//sprintf(ver, "%d.%d.%d", ZT_LIB_VERSION_MAJOR, ZT_LIB_VERSION_MINOR, ZT_LIB_VERSION_REVISION);
}
int zts_get_device_id(char *devID) {
if (ZeroTier::zt1Service) {
char id[ZTO_ID_LEN];
@@ -493,16 +483,11 @@ int zts_get_peer_address(char *peer, const char *devID) {
return -1;
}
void zts_enable_http_control_plane()
{
// TODO
}
void zts_disable_http_control_plane()
void zts_allow_http_control(bool allowed)
{
// TODO
}
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -43,7 +43,7 @@ extern "C" {
#endif
void sys2lwip(int fd, const struct sockaddr *orig, struct sockaddr *modified) {
/* Inelegant fix for lwIP 'sequential' API address error check (in sockets.c). For some reason
lwIP seems to lose track of the sa_family for the socket internally, when lwip_connect()
is called, it thus receives an AF_UNSPEC socket which fails. Here we use lwIP's own facilities
@@ -59,7 +59,7 @@ void sys2lwip(int fd, const struct sockaddr *orig, struct sockaddr *modified) {
}
if (ss.ss_family == AF_INET) {
#if defined(__linux__)
#if defined(__linux__)
struct sockaddr_in *modified_ptr = (struct sockaddr_in *)modified;
struct sockaddr_in *addr4 = (struct sockaddr_in*)orig;
modified_ptr->sin_len = sizeof(struct sockaddr_in);
@@ -71,19 +71,19 @@ void sys2lwip(int fd, const struct sockaddr *orig, struct sockaddr *modified) {
#endif
}
if (ss.ss_family == AF_INET) {
#if defined(__linux__)
#if defined(__linux__)
#else
#endif
}
}
int zts_socket(int socket_family, int socket_type, int protocol)
int zts_socket(int socket_family, int socket_type, int protocol)
{
DEBUG_EXTRA("family=%d, type=%d, proto=%d", socket_family, socket_type, protocol);
return lwip_socket(socket_family, socket_type, protocol);
}
int zts_connect(int fd, const struct sockaddr *addr, socklen_t addrlen)
int zts_connect(int fd, const struct sockaddr *addr, socklen_t addrlen)
{
DEBUG_EXTRA("fd=%d",fd);
struct sockaddr_storage ss;
@@ -91,21 +91,21 @@ int zts_connect(int fd, const struct sockaddr *addr, socklen_t addrlen)
return lwip_connect(fd, (struct sockaddr*)&ss, addrlen);
}
int zts_bind(int fd, const struct sockaddr *addr, socklen_t addrlen)
int zts_bind(int fd, const struct sockaddr *addr, socklen_t addrlen)
{
DEBUG_EXTRA("fd=%d", fd);
DEBUG_EXTRA("fd=%d", fd);
struct sockaddr_storage ss;
sys2lwip(fd, addr, (struct sockaddr*)&ss);
return lwip_bind(fd, (struct sockaddr*)&ss, addrlen);
}
int zts_listen(int fd, int backlog)
int zts_listen(int fd, int backlog)
{
DEBUG_EXTRA("fd=%d", fd);
return lwip_listen(fd, backlog);
}
int zts_accept(int fd, struct sockaddr *addr, socklen_t *addrlen)
int zts_accept(int fd, struct sockaddr *addr, socklen_t *addrlen)
{
DEBUG_EXTRA("fd=%d", fd);
return lwip_accept(fd, addr, addrlen);
@@ -257,4 +257,4 @@ int zts_del_dns_nameserver(struct sockaddr *addr)
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -68,9 +68,9 @@ static void tcp_timeout(void *data)
{
DEBUG_EXTRA();
LWIP_UNUSED_ARG(data);
#if TCP_DEBUG && LWIP_TCP
#if TCP_DEBUG && LWIP_TCP
// tcp_debug_print_pcbs();
#endif
#endif
sys_timeout(5000, tcp_timeout, NULL);
}
*/
@@ -113,7 +113,7 @@ void lwip_driver_init()
else {
return;
}
sys_thread_new("main_network_stack_thread", main_network_stack_thread,
sys_thread_new("main_network_stack_thread", main_network_stack_thread,
NULL, DEFAULT_THREAD_STACKSIZE, DEFAULT_THREAD_PRIO);
}
@@ -147,7 +147,7 @@ err_t lwip_eth_tx(struct netif *netif, struct pbuf *p)
if (ZT_MSG_TRANSFER == true) {
char flagbuf[32];
memset(&flagbuf, 0, 32);
char macBuf[ZT_MAC_ADDRSTRLEN], nodeBuf[ZT_ID_LEN];
char macBuf[ZT_MAC_ADDRSTRLEN], nodeBuf[ZTO_ID_LEN];
mac2str(macBuf, ZT_MAC_ADDRSTRLEN, ethhdr->dest.addr);
ZeroTier::MAC mac;
mac.setTo(ethhdr->dest.addr, 6);
@@ -225,7 +225,7 @@ void lwip_eth_rx(ZeroTier::VirtualTap *tap, const ZeroTier::MAC &from, const Zer
if (ZT_MSG_TRANSFER == true) {
char flagbuf[32];
memset(&flagbuf, 0, 32);
char macBuf[ZT_MAC_ADDRSTRLEN], nodeBuf[ZT_ID_LEN];
char macBuf[ZT_MAC_ADDRSTRLEN], nodeBuf[ZTO_ID_LEN];
mac2str(macBuf, ZT_MAC_ADDRSTRLEN, ethhdr.dest.addr);
ZeroTier::MAC mac;
mac.setTo(ethhdr.src.addr, 6);