X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=etc%2Fafpd%2Ffce_api_internal.h;h=9ed185e53457868b7107b42ee4322caebdcea198;hb=5bc10701fe3992bc08ab1a265265ebca5a9fd472;hp=bf6cea3e83be0223661e7d8a6a0a95fb880ca2ce;hpb=09fc36d97b784e8d8d66dbfe8c60e9127c30826a;p=netatalk.git diff --git a/etc/afpd/fce_api_internal.h b/etc/afpd/fce_api_internal.h old mode 100755 new mode 100644 index bf6cea3e..9ed185e5 --- a/etc/afpd/fce_api_internal.h +++ b/etc/afpd/fce_api_internal.h @@ -1,69 +1,53 @@ -/* - * File: fce_api_internal.h - * Author: mw - * - * Created on 1. Oktober 2010, 23:48 - */ - -#ifndef _FCE_API_INTERNAL_H -#define _FCE_API_INTERNAL_H - -/* fce_packet.mode */ -#define FCE_FILE_MODIFY 1 -#define FCE_FILE_DELETE 2 -#define FCE_DIR_DELETE 3 -#define FCE_FILE_CREATE 4 -#define FCE_DIR_CREATE 5 -#define FCE_CONN_START 42 -#define FCE_CONN_BROKEN 99 - -/* fce_packet.fce_magic */ -#define FCE_PACKET_MAGIC "at_fcapi" - -#define FCE_MAX_PATH_LEN 1024 -#define FCE_MAX_UDP_SOCKS 5 /* Allow a maximum of udp listeners for file change events */ -#define FCE_MAX_IP_LEN 255 /* Man len of listener name */ -#define FCE_SOCKET_RETRY_DELAY_S 600 /* Pause this time in s after socket was broken */ -#define FCE_PACKET_VERSION 1 -#define FCE_HISTORY_LEN 10 /* This is used to coalesce events */ -#define MAX_COALESCE_TIME_MS 1000 /* Events oldeer than this are not coalesced */ - -struct udp_entry -{ - int sock; - char ip[FCE_MAX_IP_LEN]; - int port; - struct sockaddr_in addr; - time_t next_try_on_error; /* In case of error set next timestamp to retry */ -}; - -/* This packet goes over the network, so we want to - * be shure about datastructs and type sizes between platforms - */ -struct fce_packet -{ - char magic[8]; - unsigned char version; - unsigned char mode; - uint16_t len; /* network byte order */ - uint32_t event_id; /* network byte order */ - char data[FCE_MAX_PATH_LEN]; -}; - -struct fce_history -{ - unsigned char mode; - int is_dir; - char path[FCE_MAX_PATH_LEN + 1]; - struct timeval tv; -}; - - -#define PACKET_HDR_LEN (sizeof(struct fce_packet) - FCE_MAX_PATH_LEN) - -int fce_handle_coalescation( char *path, int is_dir, int mode ); -void fce_initialize_history(); - - -#endif /* _FCE_API_INTERNAL_H */ - +/* + * File: fce_api_internal.h + * Author: mw + * + * Created on 1. Oktober 2010, 23:48 + */ + +#ifndef _FCE_API_INTERNAL_H +#define _FCE_API_INTERNAL_H + +#include + +#define FCE_MAX_UDP_SOCKS 5 /* Allow a maximum of udp listeners for file change events */ +#define FCE_SOCKET_RETRY_DELAY_S 600 /* Pause this time in s after socket was broken */ +#define FCE_PACKET_VERSION 1 +#define FCE_HISTORY_LEN 10 /* This is used to coalesce events */ +#define MAX_COALESCE_TIME_MS 1000 /* Events oldeer than this are not coalesced */ + +#define FCE_COALESCE_CREATE (1 << 0) +#define FCE_COALESCE_DELETE (1 << 1) +#define FCE_COALESCE_ALL (FCE_COALESCE_CREATE | FCE_COALESCE_DELETE) + +struct udp_entry +{ + int sock; + char *addr; + char *port; + struct addrinfo addrinfo; + struct sockaddr_storage sockaddr; + time_t next_try_on_error; /* In case of error set next timestamp to retry */ +}; + +struct fce_history +{ + unsigned char mode; + int is_dir; + char path[MAXPATHLEN + 1]; + struct timeval tv; +}; + +struct fce_close_event { + time_t time; + char path[MAXPATHLEN + 1]; +}; + +#define PACKET_HDR_LEN (sizeof(struct fce_packet) - FCE_MAX_PATH_LEN) + +bool fce_handle_coalescation( char *path, int is_dir, int mode ); +void fce_initialize_history(); + + +#endif /* _FCE_API_INTERNAL_H */ +