socket_test.c revision 45b727f651aba2cbd2f9db51ccfb4b541520a5de
/*
* Copyright (C) 2011-2013 Internet Systems Consortium, Inc. ("ISC")
*
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id$ */
/*! \file */
#include <config.h>
#include <atf-c.h>
#include <unistd.h>
#include <time.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() {
#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;
/*
* Create two sockets: 127.0.0.1/5444 and 127.0.0.1/5445, talking to
* each other.
*/
isc_test_end();
}
}
isc_region_t r;
/*
* Create two sockets: 127.0.0.1/5444 and 127.0.0.1/5445, talking to
* each other.
*/
isc_test_end();
}
}
isc_region_t r;
/*
* Create two sockets: 127.0.0.1/5444 and 127.0.0.1/5445, talking to
* each other.
*/
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();
}
}
isc_region_t r;
int n;
/*
* Create two sockets: ::1/5444 and ::1/5445, talking to
* each other.
*/
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();
}
}
isc_region_t r;
/*
* Create two sockets: 127.0.0.1/5444, talking to each other.
*/
recv_dscp_value = 0;
if ((isc_net_probedscp() & ISC_NET_DSCPRECVV4) != 0) {
if (recv_dscp)
} else
isc_test_end();
}
}
isc_region_t r;
int n;
/*
* Create two sockets: ::1/5444, talking to each other.
*/
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 should be the the value we set.
*/
if (recv_dscp)
} else
isc_test_end();
}
}
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());
}