#define HTTP_STATUS_UUID "2ab8"
#define HTTP_SECURITY_UUID "2abb"
#define HTTP_STATUS_DESC_UUID "2902"
-
+#define IPSP_PORT 3344
static bt_unit_test_table_e current_tc_table;
static char remote_addr[18] = "F6:FB:8F:D8:C8:7C";
static char ipsp_iface_name[17] = "";
char client_ipv6[100] = {0, };
char *addr = NULL;
- printf("\n****** IPSP Application Server Started ******\n");
+ TC_PRT("\n****** IPSP Application Server Started ******\n");
getifaddrs(&ifap);
if (!memcmp(ifa->ifa_name, ipsp_iface_name, IFNAMSIZ)) {
getnameinfo(ifa->ifa_addr, sizeof(struct sockaddr_in6), host, NI_MAXHOST,
NULL, 0, NI_NUMERICHOST);
+ TC_PRT("[IPV6]Host : %s \n", host);
addr = strchr(host, '%');
if (addr != NULL) {
addr = g_strndup(host, (addr - host));
freeifaddrs(ifap);
+ if (addr != NULL) {
bzero((char *) &serverAddr, sizeof(serverAddr));
serverAddr.sin6_flowinfo = 0;
serverAddr.sin6_family = AF_INET6;
serverAddr.sin6_addr = in6addr_any;
- serverAddr.sin6_port = htons(3344);
+ serverAddr.sin6_port = htons(IPSP_PORT);
serverAddr.sin6_scope_id = if_nametoindex(ipsp_iface_name);
inet_pton(AF_INET6, addr, &(serverAddr.sin6_addr.s6_addr));
/* Create the IPSP APP server socket */
serverSocket = socket(AF_INET6, SOCK_STREAM, 0);
- if (serverSocket < 0)
+ if (serverSocket < 0) {
TC_PRT("\nIPSP server Error : In socket creation !");
+ break;
+ }
else
TC_PRT("\nIPSP Server : Socket created..");
/* Bind the address struct to the socket */
- if (bind(serverSocket, (struct sockaddr *) &serverAddr, sizeof(serverAddr)) < 0)
+ if (bind(serverSocket, (struct sockaddr *) &serverAddr, sizeof(serverAddr)) < 0) {
TC_PRT("\nIPSP server Error : In socket binding !");
+ close(serverSocket);
+ break;
+ }
else
TC_PRT("\nIPSP Server : Socket binding done..");
/* Listen on the socket, with 1 max connection requests queued */
- if (listen(serverSocket, 1) < 0)
+ if (listen(serverSocket, 1) < 0) {
TC_PRT("\nIPSP server Error : In socket listening !");
+ close(serverSocket);
+ break;
+ }
else
TC_PRT("\nIPSP server : Socket listening, waiting for connection...\n");
/* Accept call creates a new socket for the incoming connection */
clilen = sizeof(clientAddr);
ipsp_server_sock = accept(serverSocket, (struct sockaddr *) &clientAddr, &clilen);
- if (ipsp_server_sock < 0)
+ if (ipsp_server_sock < 0) {
TC_PRT("\nIPSP server Error : While accepting incoming connection !");
+ close(serverSocket);
+ break;
+ }
inet_ntop(AF_INET6, &(clientAddr.sin6_addr), client_ipv6, 100);
TC_PRT("\n****** IPSP server : Incoming connection from client... %s successful, ready to send/receive IPV6 data ******", client_ipv6);
close(serverSocket);
-
+ } else {
+ TC_PRT("Matching Address is Not Found , Wait till the Connected Event is recieved from STACK");
+ }
break;
}
case BT_UNIT_TEST_FUNCTION_IPSP_CONNECT_WITH_APP_SERVER_SOCKET: {
}
saddr = g_test_param.params[0];
- printf("\n****** IPSP Application Client Started ******\n");
+ TC_PRT("\n****** IPSP Application Client Started ******\n");
/* Create the IPSP APP Client socket */
ipsp_client_sock = socket(AF_INET6, SOCK_STREAM, 0);
if (server == NULL)
TC_PRT("\nIPSP Client Error : No such host !");
+ else {
- memset((char *) &serverAddr, 0, sizeof(serverAddr));
- serverAddr.sin6_flowinfo = 0;
- serverAddr.sin6_family = AF_INET6;
- serverAddr.sin6_addr = in6addr_any;
- serverAddr.sin6_port = htons(3344);
- serverAddr.sin6_scope_id = if_nametoindex(ipsp_iface_name);
+ TC_PRT("\nIPSP Client GetHostbyName Success!");
+ memset((char *) &serverAddr, 0, sizeof(serverAddr));
+ serverAddr.sin6_flowinfo = 0;
+ serverAddr.sin6_family = AF_INET6;
+ serverAddr.sin6_addr = in6addr_any;
+ serverAddr.sin6_port = htons(IPSP_PORT);
+ serverAddr.sin6_scope_id = if_nametoindex(ipsp_iface_name);
- memmove((char *) &serverAddr.sin6_addr.s6_addr, (char *) server->h_addr, server->h_length);
+ memmove((char *) &serverAddr.sin6_addr.s6_addr, (char *) server->h_addr, server->h_length);
- /* Connect with IPSP APP Server socket */
- if (connect(ipsp_client_sock, (struct sockaddr *) &serverAddr, sizeof(serverAddr)) < 0)
- TC_PRT("\nIPSP Client Error : %d while connecting with server !", errno);
- else
- TC_PRT("\n****** IPSP Client : Connection with : %s successful, ready to send/receive IPV6 data ******\n", saddr);
+ TC_PRT("\nIPSP Client Attempt To Connect to server %s!", serverAddr.sin6_addr.s6_addr);
+ /* Connect with IPSP APP Server socket */
+ if (connect(ipsp_client_sock, (struct sockaddr *) &serverAddr, sizeof(serverAddr)) < 0)
+ TC_PRT("\nIPSP Client Error : %d while connecting with server !", errno);
+ else
+ TC_PRT("\n****** IPSP Client : Connection with : %s successful, ready to send/receive IPV6 data ******\n", saddr);
- __bt_free_test_param(&g_test_param);
+ __bt_free_test_param(&g_test_param);
+ }
break;
}
case BT_UNIT_TEST_FUNCTION_IPSP_SEND_IPV6_APP_DATA: {