Ejemplo n.º 1
0
int BindICMPSocket(int iSockfd, int iIfx)
{
    struct sockaddr_in6 stAddr;

    memset(&stAddr, 0, sizeof(stAddr));
    stAddr.sin6_family = AF_INET6;
    GetLinkAddress(&stAddr.sin6_addr, iIfx);
    stAddr.sin6_scope_id = iIfx;

    if (0 > bind(iSockfd, (struct sockaddr *)&stAddr, sizeof(stAddr)))
    {
        loginfo(FUNC, "Error: please check it.. [%s]\r\n\r\n\r\n\r\n", strerror(errno));
        return (-1);
    }

    return (0);
}
Ejemplo n.º 2
0
void SetupInstance()
{
	int n = 5;
	//for( n = 0; n < 100; n++ ) 
	{
		// Filling out application description:
		// sType is mandatory
		vl.applicationInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
		// pNext is mandatory
		vl.applicationInfo.pNext = NULL;
		// The name of our application
		vl.applicationInfo.pApplicationName = GetProgramName();
		// The name of the engine (e.g: Game engine name)
		vl.applicationInfo.pEngineName = "SACK Core";
		// The version of the engine
		vl.applicationInfo.engineVersion = 1;
		// The version of Vulkan we're using for this application
		vl.applicationInfo.apiVersion = VK_API_VERSION_1_0 | n;

		// Filling out instance description:
		// sType is mandatory
		vl.instanceInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
		// pNext is mandatory
		vl.instanceInfo.pNext = NULL;
		// flags is mandatory
		vl.instanceInfo.flags = 0;
		// The application info structure is then passed through the instance
		vl.instanceInfo.pApplicationInfo = &vl.applicationInfo;
		// Don't enable and layer
		vl.instanceInfo.enabledLayerCount = 0;
		vl.instanceInfo.ppEnabledLayerNames = NULL;
		// Don't enable any extensions
		vl.instanceInfo.enabledExtensionCount = 0;
		vl.instanceInfo.ppEnabledExtensionNames = NULL;

		// open an actual output device...
		{
			PLIST enabledExtensions = NULL;
			AddLink( &enabledExtensions, VK_KHR_SURFACE_EXTENSION_NAME );
#if defined(_WIN32)
			AddLink( &enabledExtensions, VK_KHR_WIN32_SURFACE_EXTENSION_NAME );
#else
			AddLink( &enabledExtensions, VK_KHR_XCB_SURFACE_EXTENSION_NAME );
#endif
			vl.instanceInfo.enabledExtensionCount = GetLinkCount( enabledExtensions );
			vl.instanceInfo.ppEnabledExtensionNames = (const char*const*)GetLinkAddress( &enabledExtensions, 0 );
		}
		{
			// Now create the desired instance
			VkResult result = vkCreateInstance( &vl.instanceInfo, NULL, &vl.instance );
			if( result != VK_SUCCESS ) {
				lprintf( "Failed to create instance: %d", result );
				//exit( 0 );
			}
			else
				lprintf( "Success!" );
		}
	}
	// To Come Later
	// ...
	// ...
}