udphole

Basic UDP wormhole proxy
git clone git://git.finwo.net/app/udphole
Log | Files | Refs | README | LICENSE

node.h (1024B)


      1 #ifndef UDPHOLE_CLUSTER_NODE_H
      2 #define UDPHOLE_CLUSTER_NODE_H
      3 
      4 #include <stdbool.h>
      5 #include <stdint.h>
      6 
      7 #include "common/resp.h"
      8 
      9 typedef struct cluster_node cluster_node_t;
     10 
     11 struct cluster_node {
     12   char *name;
     13   char *url;
     14   int weight;
     15   char *user;
     16   char *secret;
     17   int fd;
     18   int session_count;
     19   bool available;
     20   int consecutive_failures;
     21   int64_t last_check;
     22   cluster_node_t *next;
     23 };
     24 
     25 cluster_node_t *cluster_node_create(const char *name, const char *url, int weight, const char *user, const char *secret);
     26 
     27 void cluster_node_free(cluster_node_t *node);
     28 
     29 int cluster_node_connect(cluster_node_t *node);
     30 
     31 void cluster_node_disconnect(cluster_node_t *node);
     32 
     33 resp_object *cluster_node_send_command(cluster_node_t *node, const char *cmd, ...);
     34 
     35 int cluster_node_ping(cluster_node_t *node);
     36 
     37 int cluster_node_get_session_count(cluster_node_t *node);
     38 
     39 void cluster_node_set_available(cluster_node_t *node, bool available);
     40 
     41 bool cluster_node_select_weighted_lowest(cluster_node_t *node, cluster_node_t *best);
     42 
     43 #endif