netatalk  4.4.0dev
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
fce_api.h
Go to the documentation of this file.
1/*
2 * File: fce_api.h
3 * Author: mw
4 *
5 * Created on 1. Oktober 2010, 21:35
6 *
7 * API calls for file change event api
8 */
9
10#ifndef _FCE_API_H
11#define _FCE_API_H
12
13#include <atalk/globals.h>
14
15#define FCE_PACKET_VERSION 2
16
17/*
18 * Public FCE events
19 */
20#define FCE_FILE_MODIFY 1
21#define FCE_FILE_DELETE 2
22#define FCE_DIR_DELETE 3
23#define FCE_FILE_CREATE 4
24#define FCE_DIR_CREATE 5
25#define FCE_FILE_MOVE 6
26#define FCE_DIR_MOVE 7
27#define FCE_LOGIN 8
28#define FCE_LOGOUT 9
29/* keep in sync with public FCE events */
30#define FCE_FIRST_EVENT FCE_FILE_MODIFY
31#define FCE_LAST_EVENT FCE_LOGOUT
32
33
34/*
35 * Private FCE events
36 */
37#define FCE_CONN_START 42
38#define FCE_CONN_BROKEN 99
39
40
41/* fce_packet.fce_magic */
42#define FCE_PACKET_MAGIC "at_fcapi"
43
44/* flags for "fce_ev_info" of additional info to send in events */
45#define FCE_EV_INFO_PID (1 << 0)
46#define FCE_EV_INFO_USER (1 << 1)
47#define FCE_EV_INFO_SRCPATH (1 << 2)
48
49/*
50 * Network payload of an FCE packet, version 1
51 *
52 * 1 2 3 4 5 6 7 8
53 * +---------+---------+---------+---------+---------+---------+----------+----------+
54 * | FCE magic |
55 * +---------+---------+---------+---------+---------+---------+----------+----------+
56 * | version |
57 * +---------+
58 * | event |
59 * +---------+-----------------------------+
60 * | event ID |
61 * +-------------------+-------------------+ . . . .
62 * | pathlen | path
63 * +-------------------+------ . . . . . . . . . . .
64 *
65 *
66 * Network payload of an FCE packet, version 2
67 *
68 * 1 2 3 4 5 6 7 8
69 * +---------+---------+---------+---------+---------+---------+----------+----------+
70 * | FCE magic |
71 * +---------+---------+---------+---------+---------+---------+----------+----------+
72 * | version |
73 * +---------+
74 * | options |
75 * +---------+
76 * | event |
77 * +---------+
78 * | padding |
79 * +---------+---------+---------+---------+---------+---------+----------+----------+
80 * | reserved |
81 * +---------+---------+---------+---------+---------+---------+----------+----------+
82 * | event ID |
83 * +---------+---------+---------+---------+
84 * ... optional:
85 * +---------+---------+---------+---------+---------+---------+----------+----------+
86 * | pid |
87 * +---------+---------+---------+---------+---------+---------+----------+----------+
88 * ...
89 * ... optional:
90 * +-------------------+---------- . . . .
91 * | username length | username
92 * +-------------------+---------- . . . .
93 * ...
94 * +-------------------+------ . . . . . .
95 * | pathlen | path
96 * +-------------------+------ . . . . . .
97 * ... optional:
98 * +-------------------+------------- . . .
99 * | pathlen | source path
100 * +-------------------+------------- . . .
101 *
102 * version = 2
103 * options = bitfield:
104 * 0: pid present
105 * 1: username present
106 * 2: source path present
107 * pid = optional pid
108 * username = optional username
109 * source path = optional source path
110 */
111
113 char fcep_magic[8];
114 unsigned char fcep_version;
115 unsigned char fcep_options;
116 unsigned char fcep_event;
118 uint64_t fcep_pid;
119 uint16_t fcep_userlen;
120 char fcep_user[MAXPATHLEN];
122 char fcep_path1[MAXPATHLEN];
124 char fcep_path2[MAXPATHLEN];
125};
126
127typedef uint32_t fce_ev_t;
128
129struct path;
130struct ofork;
131
132void fce_pending_events(const AFPObj *obj);
133int fce_register(const AFPObj *obj, fce_ev_t event, const char *path,
134 const char *oldpath);
135/* IP or IP:Port */
136int fce_add_udp_socket(const char *target);
137/* all|delete|create */
138int fce_set_coalesce(const char *coalesce_opt);
139/* fmod,fdel,ddel,fcre,dcre */
140int fce_set_events(const char *events);
141
142#define FCE_DEFAULT_PORT 12250
143#define FCE_DEFAULT_PORT_STRING "12250"
144
145#endif /* _FCE_API_H */
static struct sockaddr_at target
Definition aecho.c:57
int fce_register(const AFPObj *obj, fce_ev_t event, const char *path, const char *oldpath)
Definition fce_api.c:615
uint32_t fce_ev_t
Definition fce_api.h:127
int fce_set_coalesce(const char *coalesce_opt)
Definition fce_util.c:172
int fce_set_events(const char *events)
Definition fce_api.c:749
int fce_add_udp_socket(const char *target)
Definition fce_api.c:734
void fce_pending_events(const AFPObj *obj)
Definition fce_api.c:720
static AFPObj obj
Definition netatalk.c:62
Definition globals.h:154
Definition fce_api.h:112
unsigned char fcep_options
Definition fce_api.h:115
uint16_t fcep_userlen
Definition fce_api.h:119
unsigned char fcep_event
Definition fce_api.h:116
char fcep_path1[MAXPATHLEN]
Definition fce_api.h:122
uint16_t fcep_pathlen2
Definition fce_api.h:123
char fcep_user[MAXPATHLEN]
Definition fce_api.h:120
unsigned char fcep_version
Definition fce_api.h:114
uint16_t fcep_pathlen1
Definition fce_api.h:121
uint32_t fcep_event_id
Definition fce_api.h:117
char fcep_magic[8]
Definition fce_api.h:113
uint64_t fcep_pid
Definition fce_api.h:118
char fcep_path2[MAXPATHLEN]
Definition fce_api.h:124
Definition fork.h:22
Definition include/atalk/directory.h:97