1 /*
2  * Copyright (c) 2013 Derelict Developers
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  *   notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  *   notice, this list of conditions and the following disclaimer in the
14  *   documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the names 'Derelict', 'DerelictILUT', nor the names of its contributors
17  *   may be used to endorse or promote products derived from this software
18  *   without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 module derelict.enet.statfun;
33 
34 public import derelict.enet.types;
35 
36 extern(C) @nogc nothrow
37 {
38 	// enet.h
39 	int enet_initialize();
40 	int enet_initialize_with_callbacks(ENetVersion version_, const ENetCallbacks * inits);
41 	void enet_deinitialize();
42 	ENetVersion enet_linked_version();
43 	enet_uint32 enet_time_get();
44 	void enet_time_set(enet_uint32);
45 	ENetSocket enet_socket_create(ENetSocketType);
46 	int enet_socket_bind(ENetSocket, const ENetAddress *);
47 	int enet_socket_get_address(ENetSocket, ENetAddress *);
48 	int enet_socket_listen(ENetSocket, int);
49 	ENetSocket enet_socket_accept(ENetSocket, ENetAddress *);
50 	int enet_socket_connect(ENetSocket, const ENetAddress *);
51 	int enet_socket_send(ENetSocket, const ENetAddress *, const ENetBuffer *, size_t);
52 	int enet_socket_receive(ENetSocket, ENetAddress *, ENetBuffer *, size_t);
53 	int enet_socket_wait(ENetSocket, enet_uint32 *, enet_uint32);
54 	int enet_socket_set_option(ENetSocket, ENetSocketOption, int);
55 	int enet_socket_get_option(ENetSocket, ENetSocketOption, int *);
56 	int enet_socket_shutdown(ENetSocket, ENetSocketShutdown);
57 	void enet_socket_destroy(ENetSocket);
58 	int enet_socketset_select(ENetSocket, ENetSocketSet *, ENetSocketSet *, enet_uint32);
59 	int enet_address_set_host(ENetAddress * address, const char * hostName);
60 	int enet_address_get_host_ip(const ENetAddress * address, char * hostName, size_t nameLength);
61 	int enet_address_get_host(const ENetAddress * address, char * hostName, size_t nameLength);
62 	ENetPacket * enet_packet_create(const void *, size_t, enet_uint32);
63 	void enet_packet_destroy(ENetPacket *);
64 	int enet_packet_resize (ENetPacket *, size_t);
65 	enet_uint32  enet_crc32(const ENetBuffer *, size_t);
66 	ENetHost * enet_host_create(const ENetAddress *, size_t, size_t, enet_uint32, enet_uint32);
67 	void enet_host_destroy(ENetHost *);
68 	ENetPeer * enet_host_connect(ENetHost *, const ENetAddress *, size_t, enet_uint32);
69 	int enet_host_check_events(ENetHost *, ENetEvent *);
70 	int enet_host_service(ENetHost *, ENetEvent *, enet_uint32);
71 	void enet_host_flush(ENetHost *);
72 	void enet_host_broadcast(ENetHost *, enet_uint8, ENetPacket *);
73 	void enet_host_compress(ENetHost *, const ENetCompressor *);
74 	int enet_host_compress_with_range_coder(ENetHost * host);
75 	void enet_host_channel_limit(ENetHost *, size_t);
76 	void enet_host_bandwidth_limit(ENetHost *, enet_uint32, enet_uint32);
77 	int enet_peer_send(ENetPeer *, enet_uint8, ENetPacket *);
78 	ENetPacket * enet_peer_receive(ENetPeer *, enet_uint8 * channelID);
79 	void enet_peer_ping(ENetPeer *);
80 	void enet_peer_ping_interval(ENetPeer *, enet_uint32);
81 	void enet_peer_timeout(ENetPeer *, enet_uint32, enet_uint32, enet_uint32);
82 	void enet_peer_reset(ENetPeer *);
83 	void enet_peer_disconnect(ENetPeer *, enet_uint32);
84 	void enet_peer_disconnect_now(ENetPeer *, enet_uint32);
85 	void enet_peer_disconnect_later(ENetPeer *, enet_uint32);
86 	void enet_peer_throttle_configure(ENetPeer *, enet_uint32, enet_uint32, enet_uint32);
87 	void * enet_range_coder_create();
88 	void   enet_range_coder_destroy(void *);
89 	size_t enet_range_coder_compress(void *, const ENetBuffer *, size_t, size_t, enet_uint8 *, size_t);
90 	size_t enet_range_coder_decompress(void *, const enet_uint8 *, size_t, enet_uint8 *, size_t);
91 }