File: fce_api_internal.h

package info (click to toggle)
netatalk 2.2.2-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 9,716 kB
  • sloc: ansic: 85,115; sh: 10,385; perl: 1,703; makefile: 1,363
file content (53 lines) | stat: -rw-r--r-- 1,292 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
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

#include <stdbool.h>

#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 */