tsynk.h - synk - synchronize files between hosts
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
       tsynk.h (959B)
       ---
            1 #include <arpa/inet.h>
            2 #include <netinet/in.h>
            3 #include <sys/queue.h>
            4 
            5 #include <limits.h>
            6 
            7 #define DEFADDR      "127.0.0.1"
            8 #define DEFPORT      9723
            9 #define SERVERTIMEO  5 /* in seconds */
           10 #define RCVBUFSZ     512
           11 #define UTSLEN       19
           12 #define MAXCONNECT   1
           13 #define MAXRETRY     8
           14 #define PATHCONFIG   "/etc/synk.conf"
           15 
           16 /* hold a socket connection, used to pass a connection to a thread */
           17 struct client_t {
           18         int fd;
           19         struct in_addr inet;
           20 };
           21 
           22 /* metadata informations about a file, to decide about the synkro state */
           23 struct metadata_t {
           24         char path[_POSIX_PATH_MAX];
           25         unsigned char hash[64];
           26         long mtime;
           27 };
           28 
           29 /* singly-linked list for all the nodes that should be in synk */
           30 struct peer_t {
           31         char host[HOST_NAME_MAX];
           32         struct metadata_t meta;
           33         struct sockaddr_in peer;
           34         SLIST_ENTRY(peer_t) entries;
           35 };
           36 SLIST_HEAD(peers_t, peer_t);
           37 
           38 struct peer_t *addpeer(struct peers_t *, char *, in_port_t);
           39 int parseconf(struct peers_t *, const char *);