https://github.com/dannys42/swiftpacketprocessor
A type-safe packet processor framework in Swift
https://github.com/dannys42/swiftpacketprocessor
file json packet packetprocessor socket swift tcp
Last synced: 3 months ago
JSON representation
A type-safe packet processor framework in Swift
- Host: GitHub
- URL: https://github.com/dannys42/swiftpacketprocessor
- Owner: dannys42
- License: apache-2.0
- Created: 2022-04-13T05:20:52.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-05-28T18:30:42.000Z (over 3 years ago)
- Last Synced: 2025-10-21T09:52:45.294Z (3 months ago)
- Topics: file, json, packet, packetprocessor, socket, swift, tcp
- Language: Swift
- Homepage: https://dannys42.github.io/SwiftPacketProcessor/documentation/packetprocessor/
- Size: 328 KB
- Stars: 11
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PacketProcessor
The Swift `PacketProcessor` provides a simple, type-safe way of handling structured packets given a data stream.
`PacketProcessor` handles the details of buffer management when reading a data stream. Callers need only push newly received data to the `PacketProcessor`. The correct handlers for the appropriately typed packet will be called when appropriate.
Packet definitions must include rules for validating the packet and returning the number of data elements consumed by the packet. See `DataPacket` and `StringPacket`.
Streams can have a base collection type of `String` or `Data` by initializing as `PacketProcessor` or `PacketProcessor`.
## Installation
### Swift Package Manager
Add the `PacketProcessor ` package to the dependencies within your application's `Package.swift` file. Substitute "x.y.z" with the [latest PacketProcessor release](https://github.com/dannys42/SwiftPacketProcessor/releases).
```swift
.package(url: "https://github.com/dannys42/SwiftPacketProcessor", from: "x.y.z")
```
Add `PacketProcessor` to your target's dependencies:
```swift
.target(name: "example", dependencies: ["PacketProcessor"]),
```