Test/Code Refactor in preparation for merge

This commit is contained in:
Joseph Henry 2015-11-20 01:08:38 -08:00
parent 9a25a627bb
commit 1f27022fa7
50 changed files with 1170 additions and 350 deletions

View file

@ -1,4 +1,31 @@
/*
* ZeroTier One - Network Virtualization Everywhere
* Copyright (C) 2011-2015 ZeroTier, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* --
*
* ZeroTier may be used and distributed under the terms of the GPLv3, which
* are available at: http://www.gnu.org/licenses/gpl-3.0.html
*
* If you would like to embed ZeroTier into a commercial application or
* redistribute it in a modified binary form, please contact ZeroTier Networks
* LLC. Start here: http://www.zerotier.com/
*/
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
@ -17,10 +44,9 @@ ssize_t sock_fd_write(int sock, int fd)
char buf = '\0';
int buflen = 1;
union
{
struct cmsghdr cmsghdr;
char control[CMSG_SPACE(sizeof (int))];
union {
struct cmsghdr cmsghdr;
char control[CMSG_SPACE(sizeof (int))];
} cmsgu;
struct cmsghdr *cmsg;
@ -55,12 +81,10 @@ ssize_t sock_fd_write(int sock, int fd)
ssize_t sock_fd_read(int sock, void *buf, ssize_t bufsize, int *fd)
{
ssize_t size;
if (fd) {
struct msghdr msg;
struct iovec iov;
union
{
union {
struct cmsghdr cmsghdr;
char control[CMSG_SPACE(sizeof (int))];
} cmsgu;