Skip to content

Commit

Permalink
support AF_PACKET/AF_NETLINK
Browse files Browse the repository at this point in the history
  • Loading branch information
lhoward committed Aug 27, 2024
1 parent 112302f commit 460e04d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
18 changes: 9 additions & 9 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"location" : "https://github.com/lhoward/AsyncExtensions",
"state" : {
"branch" : "linux",
"revision" : "0d96d3550ef94f83c2f300021f9985e4fb44f7af"
"revision" : "949c7160e0f8b45b141416f737eb0fa2e3bd05a7"
}
},
{
Expand All @@ -23,8 +23,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-async-algorithms",
"state" : {
"revision" : "da4e36f86544cdf733a40d59b3a2267e3a7bbf36",
"version" : "1.0.0"
"revision" : "6ae9a051f76b81cc668305ceed5b0e0a7fd93d20",
"version" : "1.0.1"
}
},
{
Expand All @@ -41,26 +41,26 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-collections.git",
"state" : {
"revision" : "94cf62b3ba8d4bed62680a282d4c25f9c63c2efb",
"version" : "1.1.0"
"revision" : "9bf03ff58ce34478e66aaee630e491823326fd06",
"version" : "1.1.3"
}
},
{
"identity" : "swift-log",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-log",
"state" : {
"revision" : "e97a6fcb1ab07462881ac165fdbb37f067e205d5",
"version" : "1.5.4"
"revision" : "9cb486020ebf03bfa5b5df985387a14a98744537",
"version" : "1.6.1"
}
},
{
"identity" : "swift-system",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-system",
"state" : {
"revision" : "f9266c85189c2751589a50ea5aec72799797e471",
"version" : "1.3.0"
"revision" : "d2ba781702a1d8285419c15ee62fd734a9437ff5",
"version" : "1.3.2"
}
}
],
Expand Down
4 changes: 4 additions & 0 deletions Sources/CIOURing/CIOURing.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,8 @@
#define _DEFAULT_SOURCE 1
#endif

#include <linux/if_ether.h>
#include <linux/if_packet.h>
#include <linux/netlink.h>

#include <liburing.h>
8 changes: 8 additions & 0 deletions Sources/IORing/Utils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ extension sockaddr {
return socklen_t(MemoryLayout<sockaddr_in6>.size)
case AF_LOCAL:
return socklen_t(MemoryLayout<sockaddr_un>.size)
case AF_PACKET:
return socklen_t(MemoryLayout<sockaddr_ll>.size)
case AF_NETLINK:
return socklen_t(MemoryLayout<sockaddr_nl>.size)
default:
throw Errno.addressFamilyNotSupported
}
Expand Down Expand Up @@ -116,6 +120,10 @@ extension sockaddr_storage {
bytesRequired = MemoryLayout<sockaddr_in6>.size
case AF_LOCAL:
bytesRequired = MemoryLayout<sockaddr_un>.size
case AF_PACKET:
bytesRequired = MemoryLayout<sockaddr_ll>.size
case AF_NETLINK:
bytesRequired = MemoryLayout<sockaddr_nl>.size
default:
throw Errno.addressFamilyNotSupported
}
Expand Down

0 comments on commit 460e04d

Please sign in to comment.