2 * 2008+ Copyright (c) Evgeniy Polyakov <zbr@ioremap.net>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
16 #include <sys/types.h>
18 #include <sys/socket.h>
29 #include "elliptics.h"
31 #include "elliptics/packet.h"
32 #include "elliptics/interface.h"
34 static int dnet_request_notification_raw(struct dnet_session
*s
, struct dnet_id
*id
,
35 int (* complete
)(struct dnet_net_state
*state
,
38 void *priv
, uint64_t cflags
)
40 struct dnet_trans_control ctl
;
42 memset(&ctl
, 0, sizeof(struct dnet_trans_control
));
44 memcpy(&ctl
.id
, id
, sizeof(struct dnet_id
));
45 ctl
.cmd
= DNET_CMD_NOTIFY
;
46 ctl
.complete
= complete
;
48 ctl
.cflags
= DNET_FLAGS_NEED_ACK
| cflags
;
50 return dnet_trans_alloc_send(s
, &ctl
);
53 int dnet_request_notification(struct dnet_session
*s
, struct dnet_id
*id
,
54 int (* complete
)(struct dnet_net_state
*state
,
64 return dnet_request_notification_raw(s
, id
, complete
, priv
, cflags
);
67 int dnet_drop_notification(struct dnet_session
*s
, struct dnet_id
*id
)
69 uint64_t cflags
= DNET_ATTR_DROP_NOTIFICATION
;
73 return dnet_request_notification_raw(s
, id
, NULL
, NULL
, cflags
);