Commit Graph

7 Commits

Author SHA1 Message Date
Cory Benfield acf5465b5e
Avoid including non-modular headers. (#1605)
Motivation:

We included netinet/ip.h in CNIODarwin, which unfortunately is not
modularised. This causes issues when using SwiftPM to create xcodeproj
files. There's no real reason to do it this way, when we can just as
easily abstract the issue.

Modifications:

- Moved netinet/ip.h to the .c file instead of the .h.
- Defined some exported namespaced integers to correspond to the macros.
- Performed platform abstraction in Posix instead of everywhere.

Result:

- Creating xcodeproj files should be fine.
2020-07-31 09:57:25 +01:00
Peter Adams f12803dbf1
Add methods to create and parse cmsghdr structured data. (#1590)
Motivation:

cmsghdrs can be used to send an receive extra data on UDP packets.
For example ECN data.

Modifications:

Map in Linux and Darwin versions of cmsghdr macros as functions.
Create strctures for holding a received collection; parsing ecn
data from a received collection and building a collection suitable
for sending.

Result:

Functions to manipulate cmsghdr and data exist.
2020-07-14 12:29:31 +01:00
Johannes Weiss 9bae007a15 use umbrella headers for C modules (#636)
Motivation:

SwiftPM only generates fully usable clang modules for C modules if they
have umbrella headers. Therefore, adding a generated NIO.xcodeproj to
another Xcode project as a sub-project never worked.
To make a header an umbrella header you need to name them _exactly_ like
the module.

Modifications:

give each C module an umbrella header

Result:

generated NIO Xcode projects can be used as sub-projects.
2018-10-19 14:49:43 +01:00
Cory Benfield 131f378d95
Avoid implicit conversion. (#566)
Motivation:

We were inadvertently doing an implicit integer conversion from
ssize_t to unsigned int in our sendmmsg shim. This can sometimes
generate warnings. The conversion itself is safe.

Modifications:

Make the conversion explicit.

Result:

No warnings.
2018-08-10 13:09:51 +01:00
Cory Benfield 9e0eb8347a
Correctly account for writes of all datagrams. (#431)
Motivation:

The Darwin gathering datagram writes shim incorrectly placed the
"bytes written" amount into the first slot in the array for every write.
This had the effect of incorrectly accounting for the amount of bytes
written for literally every element of a vector write. Not good.

Modifications:

Correctly account for each vector write element.

Result:

Lower risk of preconditions in incorrect situations, better accounting
of written bytes.
2018-05-23 17:48:10 +01:00
Cory Benfield ab9427bdd4 Initial UDP support 2018-01-16 17:00:09 +00:00
Cory Benfield 67bb71e44b Add a pending datagram writes manager
This change adds support for doing datagram-style writes. It's not currently
hooked up to anything, but it will be sometime soon.
2018-02-14 15:32:31 +00:00