X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=netatalk.git;a=blobdiff_plain;f=include%2Fatalk%2Ffce_api.h;h=4608a95c5b9a5396ffbfffc93f2e2cb174582f72;hp=aebb56adffcdafdb9463b712afa9fe91685186e0;hb=d3dff4ba4b8db3131a16641d35a6554be5fb5160;hpb=26c02c0d56d76a5b775e793e8ec1ea10d0040a7b diff --git a/include/atalk/fce_api.h b/include/atalk/fce_api.h index aebb56ad..4608a95c 100755 --- a/include/atalk/fce_api.h +++ b/include/atalk/fce_api.h @@ -12,50 +12,120 @@ #include +#define FCE_PACKET_VERSION 2 + /* 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_TM_SIZE 6 +#define FCE_FILE_MOVE 6 +#define FCE_DIR_MOVE 7 +#define FCE_LOGIN 8 +#define FCE_LOGOUT 9 #define FCE_CONN_START 42 #define FCE_CONN_BROKEN 99 +#define FCE_FIRST_EVENT FCE_FILE_MODIFY /* keep in sync with last file event above */ +#define FCE_LAST_EVENT FCE_DIR_CREATE /* keep in sync with last file event above */ /* fce_packet.fce_magic */ #define FCE_PACKET_MAGIC "at_fcapi" -/* This packet goes over the network, so we want to - * be shure about datastructs and type sizes between platforms. - * Format is network byte order. +/* flags for "fce_ev_info" of additional info to send in events */ +#define FCE_EV_INFO_PID (1 << 0) +#define FCE_EV_INFO_USER (1 << 1) +#define FCE_EV_INFO_SRCPATH (1 << 2) + +/* + * Network payload of an FCE packet, version 1 + * + * 1 2 3 4 5 6 7 8 + * +---------+---------+---------+---------+---------+---------+----------+----------+ + * | FCE magic | + * +---------+---------+---------+---------+---------+---------+----------+----------+ + * | version | + * +---------+ + * | event | + * +---------+-----------------------------+ + * | event ID | + * +-------------------+-------------------+ . . . . + * | pathlen | path + * +-------------------+------ . . . . . . . . . . . + * + * + * Network payload of an FCE packet, version 2 + * + * 1 2 3 4 5 6 7 8 + * +---------+---------+---------+---------+---------+---------+----------+----------+ + * | FCE magic | + * +---------+---------+---------+---------+---------+---------+----------+----------+ + * | version | + * +---------+ + * | options | + * +---------+ + * | event | + * +---------+ + * | padding | + * +---------+---------+---------+---------+---------+---------+----------+----------+ + * | reserved | + * +---------+---------+---------+---------+---------+---------+----------+----------+ + * | event ID | + * +---------+---------+---------+---------+ + * ... optional: + * +---------+---------+---------+---------+---------+---------+----------+----------+ + * | pid | + * +---------+---------+---------+---------+---------+---------+----------+----------+ + * ... + * ... optional: + * +-------------------+---------- . . . . + * | username length | username + * +-------------------+---------- . . . . + * ... + * +-------------------+------ . . . . . . + * | pathlen | path + * +-------------------+------ . . . . . . + * ... optional: + * +-------------------+------------- . . . + * | pathlen | source path + * +-------------------+------------- . . . + * + * version = 2 + * options = bitfield: + * 0: pid present + * 1: username present + * 2: source path present + * pid = optional pid + * username = optional username + * source path = optional source path */ -#define FCE_PACKET_HEADER_SIZE 8+1+1+4+2 -struct fce_packet -{ - char magic[8]; - unsigned char version; - unsigned char mode; - uint32_t event_id; - uint16_t datalen; - char data[MAXPATHLEN]; + +struct fce_packet { + char fcep_magic[8]; + unsigned char fcep_version; + unsigned char fcep_options; + unsigned char fcep_event; + uint32_t fcep_event_id; + uint64_t fcep_pid; + uint16_t fcep_userlen; + char fcep_user[MAXPATHLEN]; + uint16_t fcep_pathlen1; + char fcep_path1[MAXPATHLEN]; + uint16_t fcep_pathlen2; + char fcep_path2[MAXPATHLEN]; }; +typedef uint32_t fce_ev_t; + struct path; struct ofork; -void fce_pending_events(AFPObj *obj); - -int fce_register_delete_file( struct path *path ); -int fce_register_delete_dir( char *name ); -int fce_register_new_dir( struct path *path ); -int fce_register_new_file( struct path *path ); -int fce_register_file_modification( struct ofork *ofork ); -int fce_register_tm_size(const char *vol, size_t used); - +void fce_pending_events(const AFPObj *obj); +int fce_register(const AFPObj *obj, fce_ev_t event, const char *path, const char *oldpath); int fce_add_udp_socket(const char *target ); // IP or IP:Port int fce_set_coalesce(const char *coalesce_opt ); // all|delete|create -int fce_set_events(const char *events); /* fmod,fdel,ddel,fcre,dcre,tmsz (default is all except tmsz) */ +int fce_set_events(const char *events); /* fmod,fdel,ddel,fcre,dcre */ #define FCE_DEFAULT_PORT 12250 #define FCE_DEFAULT_PORT_STRING "12250"