/* * Copyright (C) Tristan Franssen, . * * This software is licensed under the Apache License, Version 2.0 (the "License"); * You may not use this file except in compliance with the License. * You may obtain a copy of the License in the file LICENSE or at * http://www.apache.org/licenses/LICENSE-2.0 */ #ifndef QNET_NETWORK #define QNET_NETWORK #if defined(__linux__) #include #define QNET_INVALID_SOCKET -1 typedef int qnet_socket_type; #elif defined(_WIN32) #include #include #define QNET_INVALID_SOCKET INVALID_SOCKET typedef SOCKET qnet_socket_type; #endif typedef enum { QNET_NETWORK_ERROR_OK = 0, QNET_NETWORK_ERROR_INVALID_IP = -1 } QNetNetworkError; QNetNetworkError qnet_ip4_address(const char *ip, unsigned short port, struct sockaddr_in *address); QNetNetworkError qnet_ip6_address(const char *ip, unsigned short port, struct sockaddr_in6 *address); #endif /* QNET_NETWORK */