Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@
system:
import nixpkgs {
inherit system;
overlays = with self.overlays; [ default ];
overlays = with self.overlays; [
default
patches
];
};

# Initialize development nixpkgs for the specified `system`
Expand All @@ -50,6 +53,7 @@
inherit system;
overlays = with self.overlays; [
default
patches
debug
];
};
Expand Down Expand Up @@ -111,10 +115,14 @@
# Standard flake attribute allowing you to add the villas packages to your nixpkgs
overlays = {
default = final: prev: packagesWith final;

patches = import ./packaging/nix/patches.nix;

debug = final: prev: {
jansson = addSeparateDebugInfo prev.jansson;
libmodbus = addSeparateDebugInfo prev.libmodbus;
};

minimal = final: prev: {
mosquitto = prev.mosquitto.override { systemd = final.systemdMinimal; };
rdma-core = prev.rdma-core.override { udev = final.systemdMinimal; };
Expand Down Expand Up @@ -193,7 +201,7 @@

villas = {
imports = [ (nixDir + "/module.nix") ];
nixpkgs.overlays = [ self.overlays.default ];
nixpkgs.overlays = [ self.overlays.default self.overlays.patches ];
};
};
};
Expand Down
31 changes: 25 additions & 6 deletions include/villas/nodes/iec61850_goose.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <libiec61850/goose_publisher.h>
#include <libiec61850/goose_receiver.h>
#include <libiec61850/goose_subscriber.h>
#include <libiec61850/r_session.h>

#include <villas/node.hpp>
#include <villas/node/config.hpp>
Expand Down Expand Up @@ -129,6 +130,13 @@ class GooseNode : public Node {
ALWAYS,
};

struct SessionKey {
int id;
RSecurityAlgorithm security;
RSignatureAlgorithm signature;
std::vector<uint8_t> data;
};

struct InputMapping {
std::string subscriber;
unsigned int index;
Expand All @@ -151,14 +159,17 @@ class GooseNode : public Node {
};

struct Input {
enum { NONE, STOPPED, READY } state;
GooseReceiver receiver;
RSession session = nullptr;
GooseReceiver receiver = nullptr;
CQueueSignalled queue;
Pool pool;

std::map<std::string, InputEventContext> contexts;
std::vector<InputMapping> mappings;
std::string interface_id;
std::string local_address;
uint16_t local_port;
std::vector<std::string> multicast_groups;
bool with_timestamp;
unsigned int queue_length;
} input;
Expand All @@ -184,29 +195,36 @@ class GooseNode : public Node {
PublisherConfig config;
std::vector<GooseSignal> values;

GoosePublisher publisher;
GoosePublisher publisher = nullptr;
};

struct Output {
enum { NONE, STOPPED, READY } state;
std::vector<OutputContext> contexts;
std::string interface_id;
std::string local_address;
uint16_t local_port;
std::string remote_address;
uint16_t remote_port;
int key_id;
double resend_interval;

std::mutex send_mutex;
bool changed;
bool resend_thread_stop;
std::optional<std::thread> resend_thread;
std::condition_variable resend_thread_cv;
RSession session = nullptr;
} output;

void createReceiver() noexcept;
std::vector<SessionKey> keys;

void createReceiver() noexcept(false);
void destroyReceiver() noexcept;

void startReceiver() noexcept(false);
void stopReceiver() noexcept;

void createPublishers() noexcept;
void createPublishers() noexcept(false);
void destroyPublishers() noexcept;

void startPublishers() noexcept(false);
Expand All @@ -224,6 +242,7 @@ class GooseNode : public Node {
static void resend_thread(GooseNode::Output *output) noexcept;

void parseInput(json_t *json);
void parseSessionKey(json_t *json);
void parseSubscriber(json_t *json, SubscriberConfig &sc);
void parseSubscribers(json_t *json,
std::map<std::string, InputEventContext> &ctx);
Expand Down
Loading