Skip to content

Commit 78e3aca

Browse files
committed
Initial Commit
This is the initial commit with a working prototype for libudpard a C library for Cyphal/UDP based heavily on libcanard. This library currently: * Uses naming convention of ETH, etc. and will later be changed to UDP * Requires the user to provide and maintain sockets for IP/UDP * Relies on external sockets (UDP/IP fragmentation) for transfers larger than the MTU
0 parents  commit 78e3aca

28 files changed

Lines changed: 18071 additions & 0 deletions

.clang-format

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
---
2+
Language: Cpp
3+
# BasedOnStyle: LLVM
4+
AccessModifierOffset: -4
5+
AlignAfterOpenBracket: Align
6+
AlignConsecutiveAssignments: true
7+
AlignConsecutiveDeclarations: true
8+
AlignEscapedNewlines: Left
9+
AlignOperands: true
10+
AlignTrailingComments: true
11+
AllowAllParametersOfDeclarationOnNextLine: false
12+
AllowShortBlocksOnASingleLine: false
13+
AllowShortCaseLabelsOnASingleLine: false
14+
AllowShortFunctionsOnASingleLine: Inline
15+
AllowShortIfStatementsOnASingleLine: Never
16+
AllowShortLoopsOnASingleLine: false
17+
AlwaysBreakAfterDefinitionReturnType: None
18+
AlwaysBreakAfterReturnType: None
19+
AlwaysBreakBeforeMultilineStrings: false
20+
AlwaysBreakTemplateDeclarations: Yes
21+
BinPackArguments: false
22+
BinPackParameters: false
23+
BraceWrapping:
24+
AfterCaseLabel: true
25+
AfterClass: true
26+
AfterControlStatement: true
27+
AfterEnum: true
28+
AfterFunction: true
29+
AfterNamespace: true
30+
AfterStruct: true
31+
AfterUnion: true
32+
BeforeCatch: true
33+
BeforeElse: true
34+
IndentBraces: false
35+
SplitEmptyFunction: false
36+
SplitEmptyRecord: false
37+
SplitEmptyNamespace: false
38+
AfterExternBlock: false # Keeps the contents un-indented.
39+
BreakBeforeBinaryOperators: None
40+
BreakBeforeBraces: Custom
41+
BreakBeforeTernaryOperators: true
42+
BreakConstructorInitializers: AfterColon
43+
# BreakInheritanceList: AfterColon
44+
BreakStringLiterals: true
45+
ColumnLimit: 120
46+
CommentPragmas: '^ (coverity|pragma:)'
47+
CompactNamespaces: false
48+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
49+
ConstructorInitializerIndentWidth: 4
50+
ContinuationIndentWidth: 4
51+
Cpp11BracedListStyle: true
52+
DerivePointerAlignment: false
53+
DisableFormat: false
54+
ExperimentalAutoDetectBinPacking: false
55+
FixNamespaceComments: true
56+
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
57+
IncludeBlocks: Preserve
58+
IndentCaseLabels: false
59+
IndentPPDirectives: AfterHash
60+
IndentWidth: 4
61+
IndentWrappedFunctionNames: false
62+
KeepEmptyLinesAtTheStartOfBlocks: false
63+
MacroBlockBegin: ''
64+
MacroBlockEnd: ''
65+
MaxEmptyLinesToKeep: 1
66+
NamespaceIndentation: None
67+
PenaltyBreakAssignment: 2
68+
PenaltyBreakBeforeFirstCallParameter: 10000 # Raised intentionally; prefer breaking all
69+
PenaltyBreakComment: 300
70+
PenaltyBreakFirstLessLess: 120
71+
PenaltyBreakString: 1000
72+
PenaltyExcessCharacter: 1000000
73+
PenaltyReturnTypeOnItsOwnLine: 10000 # Raised intentionally because it hurts readability
74+
PointerAlignment: Left
75+
ReflowComments: true
76+
SortIncludes: false
77+
SortUsingDeclarations: false
78+
SpaceAfterCStyleCast: true
79+
SpaceAfterTemplateKeyword: true
80+
SpaceBeforeAssignmentOperators: true
81+
SpaceBeforeCpp11BracedList: false
82+
SpaceBeforeInheritanceColon: true
83+
SpaceBeforeParens: ControlStatements
84+
SpaceBeforeCtorInitializerColon: true
85+
SpaceBeforeRangeBasedForLoopColon: true
86+
SpaceInEmptyParentheses: false
87+
SpacesBeforeTrailingComments: 2
88+
SpacesInAngles: false
89+
SpacesInCStyleCastParentheses: false
90+
SpacesInContainerLiterals: false
91+
SpacesInParentheses: false
92+
SpacesInSquareBrackets: false
93+
Standard: Cpp11
94+
TabWidth: 8
95+
UseTab: Never
96+
...

.gitignore

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Object files
2+
*.o
3+
*.ko
4+
*.obj
5+
*.elf
6+
7+
# Precompiled Headers
8+
*.gch
9+
*.pch
10+
11+
# Libraries
12+
*.lib
13+
*.a
14+
*.la
15+
*.lo
16+
17+
# Shared objects (inc. Windows DLLs)
18+
*.dll
19+
*.so
20+
*.so.*
21+
*.dylib
22+
23+
# Executables
24+
*.exe
25+
*.out
26+
*.app
27+
*.i*86
28+
*.x86_64
29+
*.hex
30+
31+
# Debug files
32+
*.dSYM/
33+
34+
# CMake build directory
35+
build/
36+
cmake-build-*/
37+
build-avr/
38+
39+
# IDE and tools
40+
.metadata
41+
.settings
42+
.project
43+
.cproject
44+
.pydevproject
45+
.gdbinit
46+
.vscode/
47+
**/.idea/*
48+
!**/.idea/dictionaries
49+
!**/.idea/dictionaries/*
50+
51+
# Pycache
52+
__pycache__/

CONTRIBUTING.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# WORK IN PROGRESS, NOT READY FOR USE
2+
3+
While this is a work in progress, contribute via the forums at [https://forum.opencyphal.org/](https://forum.opencyphal.org/)

LICENSE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2016 OpenCyphal
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
22+

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Compact Cyphal/UDP v0 in C
2+
3+
Libethard is a compact implementation of the Cyphal/UDP protocol stack in C99/C11 for high-integrity real-time
4+
embedded systems.
5+
6+
[Cyphal](https://opencyphal.org) is an open lightweight data bus standard designed for reliable intravehicular
7+
communication in aerospace and robotic applications via CAN bus, Ethernet, and other robust transports.
8+
9+
## WORK IN PROGRESS, NOT READY FOR FORMAL USE
10+
11+
**Read the docs in [`libethard/ethard.h`](/libethard/ethard.h).**
12+
13+
Building
14+
```
15+
cmake -B ./build -DCMAKE_BUILD_TYPE=Debug -DNO_STATIC_ANALYSIS=1 -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_EXPORT_COMPILE_COMMANDS=1 tests
16+
```
17+
Testing
18+
```
19+
cd build
20+
make test
21+
```
22+
23+
## Features, Description, and Usage
24+
25+
To be added at a later date.
26+
27+
## Revisions
28+
### v0.0
29+
30+
Prototype commit

libethard/.clang-format

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
---
2+
Language: Cpp
3+
# BasedOnStyle: LLVM
4+
AccessModifierOffset: -4
5+
AlignAfterOpenBracket: Align
6+
AlignConsecutiveAssignments: true
7+
AlignConsecutiveDeclarations: true
8+
AlignEscapedNewlines: Left
9+
AlignOperands: true
10+
AlignTrailingComments: true
11+
AllowAllParametersOfDeclarationOnNextLine: false
12+
AllowShortBlocksOnASingleLine: false
13+
AllowShortCaseLabelsOnASingleLine: false
14+
AllowShortFunctionsOnASingleLine: Inline
15+
AllowShortIfStatementsOnASingleLine: Never
16+
AllowShortLoopsOnASingleLine: false
17+
AlwaysBreakAfterDefinitionReturnType: None
18+
AlwaysBreakAfterReturnType: None
19+
AlwaysBreakBeforeMultilineStrings: false
20+
AlwaysBreakTemplateDeclarations: Yes
21+
BinPackArguments: false
22+
BinPackParameters: false
23+
BraceWrapping:
24+
AfterCaseLabel: true
25+
AfterClass: true
26+
AfterControlStatement: true
27+
AfterEnum: true
28+
AfterFunction: true
29+
AfterNamespace: true
30+
AfterStruct: true
31+
AfterUnion: true
32+
BeforeCatch: true
33+
BeforeElse: true
34+
IndentBraces: false
35+
SplitEmptyFunction: false
36+
SplitEmptyRecord: false
37+
SplitEmptyNamespace: false
38+
AfterExternBlock: false # Keeps the contents un-indented.
39+
BreakBeforeBinaryOperators: None
40+
BreakBeforeBraces: Custom
41+
BreakBeforeTernaryOperators: true
42+
BreakConstructorInitializers: AfterColon
43+
# BreakInheritanceList: AfterColon
44+
BreakStringLiterals: true
45+
ColumnLimit: 120
46+
CommentPragmas: '^ (coverity|pragma:)'
47+
CompactNamespaces: false
48+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
49+
ConstructorInitializerIndentWidth: 4
50+
ContinuationIndentWidth: 4
51+
Cpp11BracedListStyle: true
52+
DerivePointerAlignment: false
53+
DisableFormat: false
54+
ExperimentalAutoDetectBinPacking: false
55+
FixNamespaceComments: true
56+
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
57+
IncludeBlocks: Preserve
58+
IndentCaseLabels: false
59+
IndentPPDirectives: AfterHash
60+
IndentWidth: 4
61+
IndentWrappedFunctionNames: false
62+
KeepEmptyLinesAtTheStartOfBlocks: false
63+
MacroBlockBegin: ''
64+
MacroBlockEnd: ''
65+
MaxEmptyLinesToKeep: 1
66+
NamespaceIndentation: None
67+
PenaltyBreakAssignment: 2
68+
PenaltyBreakBeforeFirstCallParameter: 10000 # Raised intentionally; prefer breaking all
69+
PenaltyBreakComment: 300
70+
PenaltyBreakFirstLessLess: 120
71+
PenaltyBreakString: 1000
72+
PenaltyExcessCharacter: 1000000
73+
PenaltyReturnTypeOnItsOwnLine: 10000 # Raised intentionally because it hurts readability
74+
PointerAlignment: Left
75+
ReflowComments: true
76+
SortIncludes: false
77+
SortUsingDeclarations: false
78+
SpaceAfterCStyleCast: true
79+
SpaceAfterTemplateKeyword: true
80+
SpaceBeforeAssignmentOperators: true
81+
SpaceBeforeCpp11BracedList: false
82+
SpaceBeforeInheritanceColon: true
83+
SpaceBeforeParens: ControlStatements
84+
SpaceBeforeCtorInitializerColon: true
85+
SpaceBeforeRangeBasedForLoopColon: true
86+
SpaceInEmptyParentheses: false
87+
SpacesBeforeTrailingComments: 2
88+
SpacesInAngles: false
89+
SpacesInCStyleCastParentheses: false
90+
SpacesInContainerLiterals: false
91+
SpacesInParentheses: false
92+
SpacesInSquareBrackets: false
93+
Standard: Cpp11
94+
TabWidth: 8
95+
UseTab: Never
96+
...

libethard/.clang-tidy

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
Checks: >-
3+
boost-*,
4+
bugprone-*,
5+
cert-*,
6+
clang-analyzer-*,
7+
cppcoreguidelines-*,
8+
google-*,
9+
hicpp-*,
10+
llvm-*,
11+
misc-*,
12+
modernize-*,
13+
performance-*,
14+
portability-*,
15+
readability-*,
16+
-google-readability-todo,
17+
-readability-avoid-const-params-in-decls,
18+
-readability-identifier-length,
19+
-bugprone-easily-swappable-parameters,
20+
-llvm-header-guard,
21+
-cert-dcl03-c,
22+
-hicpp-static-assert,
23+
-misc-static-assert,
24+
CheckOptions:
25+
- key: readability-function-cognitive-complexity.Threshold
26+
value: '99'
27+
WarningsAsErrors: '*'
28+
HeaderFilterRegex: '.*'
29+
AnalyzeTemporaryDtors: false
30+
FormatStyle: file
31+
...

0 commit comments

Comments
 (0)