Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stirlinglabs/libsa
Portable, cross-platform socket address wrapper in C
https://github.com/stirlinglabs/libsa
c c11 cross-platform networking sockaddr
Last synced: about 12 hours ago
JSON representation
Portable, cross-platform socket address wrapper in C
- Host: GitHub
- URL: https://github.com/stirlinglabs/libsa
- Owner: StirlingLabs
- License: mit
- Created: 2022-02-21T21:09:31.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-10T04:49:38.000Z (4 months ago)
- Last Synced: 2024-07-10T07:03:15.678Z (4 months ago)
- Topics: c, c11, cross-platform, networking, sockaddr
- Language: C++
- Homepage: https://stirlinglabs.github.io/libsa
- Size: 1.41 MB
- Stars: 3
- Watchers: 4
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![libsa](docs/libsa.jpg)
`libsa` provides cross-platform socket address bindings in C11, designed to be very portable and easy to use. This allows higher-level network code to use a single format but still communicate effectively with low-level native platform code.
Users are guaranteed big endian (network) byte order of address bytes, so you do not have to worry about byte order for ports and scope indexes regardless of the underlying platform. `libsa` abstracts away address family values, the location of the address family field, provides sizing information and takes care of allocation and freeing of sockaddr structures on the heap.
### Why reinvent the wheel?
Historically, binding authors have had to work around platform inconsistency in sockaddr or rely on native libraries to manipulate sockaddr via helper functions (e.g. `libuv` has a lot of sockaddr code). The concept provided by `libsa` is to separate the helper functions from the target library, so it doesn't have to be rewritten every time, yet lets those bindings cooperate effectively.
### Portable
Currently wrapped for:
- C#/.Net by [sockaddr.Net](https://github.com/StirlingLabs/sockaddr.Net)
If you wrap libsa for another language, please create a PR to update this list.
### Future
We intend to expand this to any platform or shape of sockaddr without changing the API, all that should be required is by simply recompiling to the target platform with no special treatment.
### Support
Development of this project is supported by [Stirling Labs](https://stirlinglabs.github.io).