socket_test.c revision 0c27b3fe77ac1d5094ba3521e8142d9e7973133f
/*
* Copyright (C) 2011-2016 Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/*! \file */
#include <config.h>
#include <atf-c.h>
#include <unistd.h>
#include <time.h>
#include <isc/platform.h>
#include "../task_p.h"
#include "../unix/socket_p.h"
#include "isctest.h"
static isc_boolean_t recv_dscp;
static unsigned int recv_dscp_value;
/*
* Helper functions
*/
typedef struct {
} completion_t;
static void
}
static void
}
static void
} else
}
static isc_result_t
int i = 0;
#ifndef ISC_PLATFORM_USETHREADS
while (isc__taskmgr_ready(taskmgr))
#endif
isc_test_nap(1000);
}
if (completion->done)
return (ISC_R_SUCCESS);
return (ISC_R_FAILURE);
}
#if 0
static isc_result_t
int i = 0;
waitbody();
}
if (completion->done)
return (ISC_R_SUCCESS);
return (ISC_R_FAILURE);
}
#endif
static void
waitbody(void) {
#ifndef ISC_PLATFORM_USETHREADS
while (isc__taskmgr_ready(taskmgr))
} else
#endif
isc_test_nap(1000);
}
static isc_result_t
int i = 0;
waitbody();
}
return (ISC_R_SUCCESS);
return (ISC_R_FAILURE);
}
/*
* Individual unit tests
*/
}
isc_region_t r;
isc_test_end();
}
}
isc_region_t r;
isc_test_end();
}
}
isc_region_t r;
event_done, &completion);
if ((isc_net_probedscp() & ISC_NET_DSCPPKTV4) != 0) {
} else if ((isc_net_probedscp() & ISC_NET_DSCPSETV4) != 0) {
socketevent->dscp = 0;
}
recv_dscp_value = 0;
if ((isc_net_probedscp() & ISC_NET_DSCPRECVV4) != 0) {
} else
isc_test_end();
}
}
#if defined(ISC_PLATFORM_HAVEIPV6) && defined(WANT_IPV6)
isc_region_t r;
int n;
ATF_REQUIRE(n == 1);
&s1);
&s2);
event_done, &completion);
if ((isc_net_probedscp() & ISC_NET_DSCPPKTV6) != 0) {
} else if ((isc_net_probedscp() & ISC_NET_DSCPSETV6) != 0)
recv_dscp_value = 0;
if ((isc_net_probedscp() & ISC_NET_DSCPRECVV6) != 0) {
} else
isc_test_end();
#else
atf_tc_skip("IPv6 not available");
#endif
}
}
isc_region_t r;
recv_dscp_value = 0;
if ((isc_net_probedscp() & ISC_NET_DSCPRECVV4) != 0) {
if (recv_dscp)
} else
isc_test_end();
}
}
#ifdef ISC_PLATFORM_HAVEIPV6
isc_region_t r;
int n;
ATF_REQUIRE(n == 1);
&s1);
&s2);
recv_dscp_value = 0;
if ((isc_net_probedscp() & ISC_NET_DSCPRECVV6) != 0) {
/*
* IPV6_RECVTCLASS is undefined for TCP however
* if we do get it it should be the value we set.
*/
if (recv_dscp)
} else
isc_test_end();
#else
atf_tc_skip("IPv6 not available");
#endif
}
}
unsigned int n;
n = isc_net_probedscp();
ATF_CHECK((n & ~ISC_NET_DSCPALL) == 0);
/* ISC_NET_DSCPSETV4 MUST be set if any is set. */
ATF_CHECK_MSG((n & ISC_NET_DSCPSETV4) != 0,
"IPv4:%s%s%s\n",
/* ISC_NET_DSCPSETV6 MUST be set if any is set. */
ATF_CHECK_MSG((n & ISC_NET_DSCPSETV6) != 0,
"IPv6:%s%s%s\n",
#if 0
#endif
}
/*
* Main
*/
ATF_TP_ADD_TCS(tp) {
return (atf_no_error());
}