diff --git a/go/cmd/example.go b/go/cmd/example.go index fa242f436..10c6dfbd0 100644 --- a/go/cmd/example.go +++ b/go/cmd/example.go @@ -1,10 +1,29 @@ -package main - /** Example of using libvillas node-types in Go code * * This example demonstrate how you can use VILLASnode's * node-types from a Go application. - */ + * + * @author Steffen Vogel + * @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC + * @license GNU General Public License (version 3) + * + * VILLASnode + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *********************************************************************************/ + +package main import ( "log" diff --git a/go/lib/bridge.c b/go/lib/bridge.c index fab6e9458..2c2566d56 100644 --- a/go/lib/bridge.c +++ b/go/lib/bridge.c @@ -1,3 +1,25 @@ +/** Bridge code for call C-function pointers from Go code + * + * @author Steffen Vogel + * @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC + * @license GNU General Public License (version 3) + * + * VILLASnode + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *********************************************************************************/ + #include #include diff --git a/go/lib/lib.go b/go/lib/lib.go index 6141e31c8..1ccbac0ce 100644 --- a/go/lib/lib.go +++ b/go/lib/lib.go @@ -1,3 +1,25 @@ +/** CGo interface for writing node-types in Go + * + * @author Steffen Vogel + * @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC + * @license GNU General Public License (version 3) + * + * VILLASnode + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *********************************************************************************/ + package main // #include diff --git a/go/lib/logger.go b/go/lib/logger.go index 2108b20d9..ef9ef6cf1 100644 --- a/go/lib/logger.go +++ b/go/lib/logger.go @@ -1,3 +1,25 @@ +/** CGo interface for VILLASnode logger + * + * @author Steffen Vogel + * @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC + * @license GNU General Public License (version 3) + * + * VILLASnode + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *********************************************************************************/ + package main // #include diff --git a/go/pkg/config/hook.go b/go/pkg/config/hook.go index 477a25002..73d0f20de 100644 --- a/go/pkg/config/hook.go +++ b/go/pkg/config/hook.go @@ -1,3 +1,25 @@ +/** Go types for hook configuration. + * + * @author Steffen Vogel + * @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC + * @license GNU General Public License (version 3) + * + * VILLASnode + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *********************************************************************************/ + package config type Hook struct { diff --git a/go/pkg/config/node.go b/go/pkg/config/node.go index f61b1c9ef..e6de224ef 100644 --- a/go/pkg/config/node.go +++ b/go/pkg/config/node.go @@ -1,3 +1,25 @@ +/** Go types for node configuration. + * + * @author Steffen Vogel + * @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC + * @license GNU General Public License (version 3) + * + * VILLASnode + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *********************************************************************************/ + package config type Node struct { diff --git a/go/pkg/config/signal.go b/go/pkg/config/signal.go index 2282e500d..1f3368f97 100644 --- a/go/pkg/config/signal.go +++ b/go/pkg/config/signal.go @@ -1,3 +1,25 @@ +/** Go types for signal configuration. + * + * @author Steffen Vogel + * @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC + * @license GNU General Public License (version 3) + * + * VILLASnode + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *********************************************************************************/ + package config const ( diff --git a/go/pkg/errors/errors.go b/go/pkg/errors/errors.go new file mode 100644 index 000000000..38c6481f8 --- /dev/null +++ b/go/pkg/errors/errors.go @@ -0,0 +1,48 @@ +/** Common error types + * + * @author Steffen Vogel + * @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC + * @license GNU General Public License (version 3) + * + * VILLASnode + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *********************************************************************************/ + +package errors + +import ( + "C" +) +import "fmt" + +var ( + ErrEndOfFile = fmt.Errorf("end-of-file") +) + +func ErrorToInt(e error) int { + if e == nil { + return 0 + } else { + return -1 + } +} + +func IntToError(ret int) error { + if ret == 0 { + return nil + } else { + return fmt.Errorf("ret=%d", ret) + } +} diff --git a/go/pkg/errors/helper.go b/go/pkg/errors/helper.go deleted file mode 100644 index 85cece5b1..000000000 --- a/go/pkg/errors/helper.go +++ /dev/null @@ -1,26 +0,0 @@ -package errors - -import ( - "C" -) -import "fmt" - -var ( - ErrEndOfFile = fmt.Errorf("end-of-file") -) - -func ErrorToInt(e error) int { - if e == nil { - return 0 - } else { - return -1 - } -} - -func IntToError(ret int) error { - if ret == 0 { - return nil - } else { - return fmt.Errorf("ret=%d", ret) - } -} diff --git a/go/pkg/node/node.go b/go/pkg/node/node.go index f7b7c806a..4753cf3c8 100644 --- a/go/pkg/node/node.go +++ b/go/pkg/node/node.go @@ -1,3 +1,25 @@ +/** Wrapper for using libvillas in Go applications. + * + * @author Steffen Vogel + * @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC + * @license GNU General Public License (version 3) + * + * VILLASnode + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *********************************************************************************/ + package node // #cgo LDFLAGS: -lvillas diff --git a/go/pkg/node/node_test.go b/go/pkg/node/node_test.go index 166098397..bec932b67 100644 --- a/go/pkg/node/node_test.go +++ b/go/pkg/node/node_test.go @@ -1,3 +1,25 @@ +/** Unit tests for using libvillas in Go code. + * + * @author Steffen Vogel + * @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC + * @license GNU General Public License (version 3) + * + * VILLASnode + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *********************************************************************************/ + package node_test import ( diff --git a/go/pkg/nodes/base.go b/go/pkg/nodes/base.go index fbd642304..af169e8fc 100644 --- a/go/pkg/nodes/base.go +++ b/go/pkg/nodes/base.go @@ -1,3 +1,25 @@ +/** Common code for implementing node-types in Go code. + * + * @author Steffen Vogel + * @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC + * @license GNU General Public License (version 3) + * + * VILLASnode + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *********************************************************************************/ + package nodes type BaseNode struct { diff --git a/go/pkg/nodes/example/node.go b/go/pkg/nodes/example/node.go index 8fe04caf0..7ac25c471 100644 --- a/go/pkg/nodes/example/node.go +++ b/go/pkg/nodes/example/node.go @@ -1,3 +1,25 @@ +/** Little example node-type written in Go code. + * + * @author Steffen Vogel + * @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC + * @license GNU General Public License (version 3) + * + * VILLASnode + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *********************************************************************************/ + package nodes import ( diff --git a/go/pkg/nodes/logger.go b/go/pkg/nodes/logger.go index ee3243b2a..6e5d8ccb5 100644 --- a/go/pkg/nodes/logger.go +++ b/go/pkg/nodes/logger.go @@ -1,3 +1,25 @@ +/** Logger interface. + * + * @author Steffen Vogel + * @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC + * @license GNU General Public License (version 3) + * + * VILLASnode + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *********************************************************************************/ + package nodes type Logger interface { diff --git a/go/pkg/nodes/loopback/node.go b/go/pkg/nodes/loopback/node.go index b9a315d86..4ae18d039 100644 --- a/go/pkg/nodes/loopback/node.go +++ b/go/pkg/nodes/loopback/node.go @@ -1,3 +1,25 @@ +/** Simple loopback node-type written in Go code. + * + * @author Steffen Vogel + * @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC + * @license GNU General Public License (version 3) + * + * VILLASnode + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *********************************************************************************/ + package nodes import ( diff --git a/go/pkg/nodes/node.go b/go/pkg/nodes/node.go index a3cc78f23..d80888589 100644 --- a/go/pkg/nodes/node.go +++ b/go/pkg/nodes/node.go @@ -1,3 +1,25 @@ +/** Node interface. + * + * @author Steffen Vogel + * @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC + * @license GNU General Public License (version 3) + * + * VILLASnode + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *********************************************************************************/ + package nodes const ( diff --git a/go/pkg/nodes/registry.go b/go/pkg/nodes/registry.go index 2a25041bb..fe6b4bd61 100644 --- a/go/pkg/nodes/registry.go +++ b/go/pkg/nodes/registry.go @@ -1,3 +1,25 @@ +/** Node-type registry. + * + * @author Steffen Vogel + * @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC + * @license GNU General Public License (version 3) + * + * VILLASnode + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *********************************************************************************/ + package nodes var ( diff --git a/go/pkg/nodes/webrtc/backoff.go b/go/pkg/nodes/webrtc/backoff.go index 8aeb7a09f..4f32eb079 100644 --- a/go/pkg/nodes/webrtc/backoff.go +++ b/go/pkg/nodes/webrtc/backoff.go @@ -1,3 +1,25 @@ +/** Exponential backoffs for reconnect timing. + * + * @author Steffen Vogel + * @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC + * @license GNU General Public License (version 3) + * + * VILLASnode + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *********************************************************************************/ + package webrtc import "time" diff --git a/go/pkg/nodes/webrtc/client.go b/go/pkg/nodes/webrtc/client.go index 1624ef615..12f50b862 100644 --- a/go/pkg/nodes/webrtc/client.go +++ b/go/pkg/nodes/webrtc/client.go @@ -1,3 +1,25 @@ +/** Websocket signaling channel for WebRTC. + * + * @author Steffen Vogel + * @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC + * @license GNU General Public License (version 3) + * + * VILLASnode + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *********************************************************************************/ + package webrtc import ( diff --git a/go/pkg/nodes/webrtc/node.go b/go/pkg/nodes/webrtc/node.go index 41b7ada02..6bdf8aa2a 100644 --- a/go/pkg/nodes/webrtc/node.go +++ b/go/pkg/nodes/webrtc/node.go @@ -1,3 +1,25 @@ +/** WebRTC node-type. + * + * @author Steffen Vogel + * @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC + * @license GNU General Public License (version 3) + * + * VILLASnode + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *********************************************************************************/ + package webrtc import ( diff --git a/go/pkg/nodes/webrtc/types.go b/go/pkg/nodes/webrtc/types.go index fa77a4856..806efb0a3 100644 --- a/go/pkg/nodes/webrtc/types.go +++ b/go/pkg/nodes/webrtc/types.go @@ -1,3 +1,25 @@ +/** Types for WebRTC node-type. + * + * @author Steffen Vogel + * @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC + * @license GNU General Public License (version 3) + * + * VILLASnode + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *********************************************************************************/ + package webrtc import ( diff --git a/go/pkg/nodes/webrtc/webrtc.go b/go/pkg/nodes/webrtc/webrtc.go index 4f58d9278..b814a7a89 100644 --- a/go/pkg/nodes/webrtc/webrtc.go +++ b/go/pkg/nodes/webrtc/webrtc.go @@ -1,3 +1,25 @@ +/** WebRTC peer connection handling. + * + * @author Steffen Vogel + * @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC + * @license GNU General Public License (version 3) + * + * VILLASnode + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *********************************************************************************/ + package webrtc import ( diff --git a/go/pkg/sample.go b/go/pkg/sample.go index e3fa60b6d..ace7e7d1f 100644 --- a/go/pkg/sample.go +++ b/go/pkg/sample.go @@ -1,3 +1,25 @@ +/** Sample datastructure. + * + * @author Steffen Vogel + * @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC + * @license GNU General Public License (version 3) + * + * VILLASnode + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *********************************************************************************/ + package pkg import ( diff --git a/include/villas/nodes/go.h b/include/villas/nodes/go.h index e4e7390bd..fc052c4ee 100644 --- a/include/villas/nodes/go.h +++ b/include/villas/nodes/go.h @@ -1,3 +1,26 @@ +/** Node-type implemeted in Go language + * + * @file + * @author Steffen Vogel + * @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC + * @license GNU General Public License (version 3) + * + * VILLASnode + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + *********************************************************************************/ + #pragma once typedef void *_go_plugin; diff --git a/lib/nodes/go.cpp b/lib/nodes/go.cpp index 7380d5b81..b039eef64 100644 --- a/lib/nodes/go.cpp +++ b/lib/nodes/go.cpp @@ -1,4 +1,3 @@ - /** Node-type implemeted in Go language * * @file