]> arthur.barton.de Git - netatalk.git/blob - etc/afpd/fce_api_internal.h
Merge remote branch 'netafp/master' into branch-allea
[netatalk.git] / etc / afpd / fce_api_internal.h
1 /* 
2  * File:   fce_api_internal.h
3  * Author: mw
4  *
5  * Created on 1. Oktober 2010, 23:48
6  */
7
8 #ifndef _FCE_API_INTERNAL_H
9 #define _FCE_API_INTERNAL_H
10
11 #define FCE_MAX_UDP_SOCKS 5     /* Allow a maximum of udp listeners for file change events */
12 #define FCE_SOCKET_RETRY_DELAY_S 600 /* Pause this time in s after socket was broken */
13 #define FCE_PACKET_VERSION  1
14 #define FCE_HISTORY_LEN 10  /* This is used to coalesce events */
15 #define MAX_COALESCE_TIME_MS 1000  /* Events oldeer than this are not coalesced */
16
17 #define FCE_COALESCE_CREATE (1 << 0)
18 #define FCE_COALESCE_DELETE (1 << 1)
19 #define FCE_COALESCE_ALL    (FCE_COALESCE_CREATE | FCE_COALESCE_DELETE)
20
21 struct udp_entry
22 {
23     int sock;
24     char *addr;
25     char *port;
26     struct addrinfo addrinfo;
27     struct sockaddr_storage sockaddr;
28     time_t next_try_on_error;      /* In case of error set next timestamp to retry */
29 };
30
31 struct fce_history
32 {
33     unsigned char mode;
34         int is_dir;
35         char path[MAXPATHLEN + 1];
36         struct timeval tv;
37 };
38
39 struct fce_close_event {
40     time_t time;
41         char path[MAXPATHLEN + 1];
42 };
43
44 #define PACKET_HDR_LEN (sizeof(struct fce_packet) - FCE_MAX_PATH_LEN)
45
46 int fce_handle_coalescation( char *path, int is_dir, int mode );
47 void fce_initialize_history();
48
49
50 #endif  /* _FCE_API_INTERNAL_H */
51