-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Dr. Brandon Wiley
committed
Nov 8, 2021
1 parent
93c3ffd
commit ad4778a
Showing
10 changed files
with
510 additions
and
370 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,28 @@ | ||
import Foundation | ||
import Socket | ||
import Net | ||
import Datable | ||
import Chord | ||
import Transport | ||
import Logging | ||
|
||
public protocol Connection | ||
{ | ||
// Reads exactly size bytes | ||
func read(size: Int) -> Data? | ||
|
||
// reads up to maxSize bytes | ||
func read(maxSize: Int) -> Data? | ||
|
||
func readWithLengthPrefix(prefixSizeInBits: Int) -> Data? | ||
|
||
func write(string: String) -> Bool | ||
|
||
func write(data: Data) -> Bool | ||
func identifier() -> Int | ||
|
||
func writeWithLengthPrefix(data: Data, prefixSizeInBits: Int) -> Bool | ||
} | ||
|
||
public enum ConnectionType | ||
{ | ||
case udp | ||
case tcp | ||
} |
Oops, something went wrong.