-
-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
patterns: Add ARIA2 Control format (#179)
- Loading branch information
Showing
3 changed files
with
37 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#pragma author itsmeow | ||
#pragma description aria2 Control File | ||
|
||
#pragma endian big | ||
|
||
/* | ||
Format sourced from: | ||
https://aria2.github.io/manual/en/html/technical-notes.html#control-file-aria2-format | ||
Version 0 files are not supported by default | ||
However parsing one is as simple as changing to #pragma endian ittle | ||
and resolving any errors resulting from that by adding be prefixes to struct fields. | ||
*/ | ||
|
||
struct AriaInFlight { | ||
u32 index; | ||
u32 length; | ||
u32 bitfield_piece_length; | ||
u8 bitfield_p[bitfield_piece_length]; | ||
}; | ||
|
||
struct AriaHeader { | ||
u16 version; | ||
u32 extension; | ||
u32 infohash_length; | ||
u8 infohash[infohash_length]; | ||
u32 piece_length; | ||
u64 total_length; | ||
u64 upload_length; | ||
u32 bitfield_length; | ||
u8 bitfield_d[bitfield_length]; | ||
u32 inflight_count; | ||
AriaInFlight inflights[inflight_count]; | ||
}; | ||
|
||
AriaHeader aria_header @ 0x00; |
Binary file not shown.