X-Git-Url: https://arthur.barton.de/gitweb/?p=netatalk.git;a=blobdiff_plain;f=include%2Fatalk%2Ffce_api.h;fp=include%2Fatalk%2Ffce_api.h;h=c804d900bc08b46641c18b357668ae5871405975;hp=d11a2d4927a4752da0593fb3e54c2acc976cf57e;hb=ab6e6f8ed24667ced438afe4df5997469a2ff53b;hpb=471d63120ea3d21bd9d6eb3b220d1e3eec419f68 diff --git a/include/atalk/fce_api.h b/include/atalk/fce_api.h index d11a2d49..c804d900 100755 --- a/include/atalk/fce_api.h +++ b/include/atalk/fce_api.h @@ -12,45 +12,117 @@ #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_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 */ +#define FCE_LAST_EVENT FCE_LOGOUT /* 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; -typedef enum { fce_file, fce_dir } fce_obj_t; struct path; struct ofork; -void fce_pending_events(AFPObj *obj); -int fce_register(fce_ev_t event, const char *path, const char *oldpath, fce_obj_t type); +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 */