aboutsummaryrefslogtreecommitdiff
path: root/core/net/interface_windows.odin
diff options
context:
space:
mode:
authorJeroen van Rijn <Kelimion@users.noreply.github.com>2023-03-03 14:15:15 +0100
committerJeroen van Rijn <Kelimion@users.noreply.github.com>2023-03-03 14:15:15 +0100
commit5267a864db5717d61465d6bb73ee8005f3568c9f (patch)
treee41d3f0be186ed050da102f064ed545e73dc2047 /core/net/interface_windows.odin
parentf02334237a055f8da5bb795032c872e555abaec7 (diff)
Coalesce more.
Diffstat (limited to 'core/net/interface_windows.odin')
-rw-r--r--core/net/interface_windows.odin26
1 files changed, 11 insertions, 15 deletions
diff --git a/core/net/interface_windows.odin b/core/net/interface_windows.odin
index c4c0ad1bc..f8bac253a 100644
--- a/core/net/interface_windows.odin
+++ b/core/net/interface_windows.odin
@@ -1,4 +1,11 @@
+package net
//+build windows
+
+/*
+ Package net implements cross-platform Berkeley Sockets, DNS resolution and associated procedures.
+ For other protocols and their features, see subdirectories of this package.
+*/
+
/*
Copyright 2022 Tetralux <tetraluxonpc@gmail.com>
Copyright 2022 Colin Davidson <colrdavidson@gmail.com>
@@ -11,28 +18,17 @@
Jeroen van Rijn: Cross platform unification, code style, documentation
*/
-/*
- Package net implements cross-platform Berkeley Sockets, DNS resolution and associated procedures.
- For other protocols and their features, see subdirectories of this package.
-*/
-package net
-
import sys "core:sys/windows"
import strings "core:strings"
-MAX_INTERFACE_ENUMERATION_TRIES :: 3
-
-/*
- `enumerate_interfaces` retrieves a list of network interfaces with their associated properties.
-*/
-enumerate_interfaces :: proc(allocator := context.allocator) -> (interfaces: []Network_Interface, err: Network_Error) {
+_enumerate_interfaces :: proc(allocator := context.allocator) -> (interfaces: []Network_Interface, err: Network_Error) {
context.allocator = allocator
buf: []u8
defer delete(buf)
- buf_size: u32
- res: u32
+ buf_size: u32
+ res: u32
gaa: for _ in 1..=MAX_INTERFACE_ENUMERATION_TRIES {
res = sys.get_adapters_addresses(
@@ -178,4 +174,4 @@ parse_socket_address :: proc(addr_in: sys.SOCKET_ADDRESS) -> (addr: Endpoint) {
case: return // Empty or invalid address type
}
unreachable()
-}
+} \ No newline at end of file