mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-30 00:00:11 +01:00
simplified code: removed type from nodes
git-svn-id: https://zerberus.eonerc.rwth-aachen.de:8443/svn/s2ss/trunk@132 8ec27952-4edc-4aab-86aa-e87bb2611832
This commit is contained in:
parent
616fe828a4
commit
dda247ab53
3 changed files with 0 additions and 53 deletions
|
@ -21,20 +21,6 @@
|
||||||
#include "msg.h"
|
#include "msg.h"
|
||||||
#include "tc.h"
|
#include "tc.h"
|
||||||
|
|
||||||
/** The type of a node.
|
|
||||||
*
|
|
||||||
* This type is used to determine the message format of the remote node
|
|
||||||
*/
|
|
||||||
enum node_type
|
|
||||||
{
|
|
||||||
NODE_UNKNOWN,
|
|
||||||
NODE_SERVER,
|
|
||||||
NODE_WORKSTATION,
|
|
||||||
NODE_SIM_OPAL,
|
|
||||||
NODE_SIM_RTDS,
|
|
||||||
NODE_SIM_DSP
|
|
||||||
};
|
|
||||||
|
|
||||||
/** The datastructure for a node.
|
/** The datastructure for a node.
|
||||||
*
|
*
|
||||||
* Every entity which exchanges messages is represented by a node.
|
* Every entity which exchanges messages is represented by a node.
|
||||||
|
@ -47,9 +33,6 @@ struct node
|
||||||
/** A short identifier of the node, only used for configuration and logging */
|
/** A short identifier of the node, only used for configuration and logging */
|
||||||
const char *name;
|
const char *name;
|
||||||
|
|
||||||
/** The type of this node */
|
|
||||||
enum node_type type;
|
|
||||||
|
|
||||||
/** Local address of the socket */
|
/** Local address of the socket */
|
||||||
struct sockaddr_in local;
|
struct sockaddr_in local;
|
||||||
/** Remote address of the socket */
|
/** Remote address of the socket */
|
||||||
|
@ -89,13 +72,6 @@ int node_connect(struct node *n);
|
||||||
*/
|
*/
|
||||||
int node_disconnect(struct node *n);
|
int node_disconnect(struct node *n);
|
||||||
|
|
||||||
/** Lookup node type from string.
|
|
||||||
*
|
|
||||||
* @param str The string containing the node type
|
|
||||||
* @return The node type enumeration value
|
|
||||||
*/
|
|
||||||
enum node_type node_lookup_type(const char *str);
|
|
||||||
|
|
||||||
/** Search list of nodes for a name.
|
/** Search list of nodes for a name.
|
||||||
*
|
*
|
||||||
* @param str The name of the wanted node
|
* @param str The name of the wanted node
|
||||||
|
|
|
@ -134,7 +134,6 @@ int config_parse_path(config_setting_t *cfg,
|
||||||
int config_parse_node(config_setting_t *cfg,
|
int config_parse_node(config_setting_t *cfg,
|
||||||
struct node **nodes, struct interface **interfaces)
|
struct node **nodes, struct interface **interfaces)
|
||||||
{
|
{
|
||||||
const char *type_str = NULL;
|
|
||||||
const char *remote_str = NULL;
|
const char *remote_str = NULL;
|
||||||
const char *local_str = NULL;
|
const char *local_str = NULL;
|
||||||
|
|
||||||
|
@ -165,12 +164,6 @@ int config_parse_node(config_setting_t *cfg,
|
||||||
if (resolve_addr(remote_str, &node->remote, 0))
|
if (resolve_addr(remote_str, &node->remote, 0))
|
||||||
cerror(cfg, "Failed to resolve remote address '%s' of node '%s'", remote_str, node->name);
|
cerror(cfg, "Failed to resolve remote address '%s' of node '%s'", remote_str, node->name);
|
||||||
|
|
||||||
/* Optional settings */
|
|
||||||
if (config_setting_lookup_string(cfg, "type", &type_str))
|
|
||||||
node->type = node_lookup_type(type_str);
|
|
||||||
else
|
|
||||||
node->type = NODE_UNKNOWN;
|
|
||||||
|
|
||||||
config_setting_t *cfg_netem = config_setting_get_member(cfg, "netem");
|
config_setting_t *cfg_netem = config_setting_get_member(cfg, "netem");
|
||||||
if (cfg_netem) {
|
if (cfg_netem) {
|
||||||
node->netem = (struct netem *) malloc(sizeof(struct netem));
|
node->netem = (struct netem *) malloc(sizeof(struct netem));
|
||||||
|
|
|
@ -1,10 +1,4 @@
|
||||||
/** Nodes
|
/** Nodes
|
||||||
*
|
|
||||||
* The S2SS server connects multiple nodes.
|
|
||||||
* There are multiple types of nodes:
|
|
||||||
* - simulators
|
|
||||||
* - servers
|
|
||||||
* - workstations
|
|
||||||
*
|
*
|
||||||
* @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
|
* @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
|
||||||
* @copyright 2014, Institute for Automation of Complex Power Systems, EONERC
|
* @copyright 2014, Institute for Automation of Complex Power Systems, EONERC
|
||||||
|
@ -54,22 +48,6 @@ int node_disconnect(struct node *n)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum node_type node_lookup_type(const char *str)
|
|
||||||
{
|
|
||||||
if (!strcmp(str, "workstation"))
|
|
||||||
return NODE_WORKSTATION;
|
|
||||||
else if (!strcmp(str, "server"))
|
|
||||||
return NODE_SERVER;
|
|
||||||
else if (!strcmp(str, "rtds"))
|
|
||||||
return NODE_SIM_RTDS;
|
|
||||||
else if (!strcmp(str, "opal"))
|
|
||||||
return NODE_SIM_OPAL;
|
|
||||||
else if (!strcmp(str, "dsp"))
|
|
||||||
return NODE_SIM_DSP;
|
|
||||||
else
|
|
||||||
return NODE_UNKNOWN;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct node* node_lookup_name(const char *str, struct node *nodes)
|
struct node* node_lookup_name(const char *str, struct node *nodes)
|
||||||
{
|
{
|
||||||
for (struct node *n = nodes; n; n = n->next) {
|
for (struct node *n = nodes; n; n = n->next) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue