| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| #ifndef NE_LOCKS_H |
| #define NE_LOCKS_H |
| |
| #include "ne_request.h" /* for ne_session + ne_request */ |
| #include "ne_uri.h" /* for ne_uri */ |
| |
| NE_BEGIN_DECLS |
| |
| |
| enum ne_lock_scope { |
| ne_lockscope_exclusive, |
| ne_lockscope_shared |
| }; |
| |
| |
| enum ne_lock_type { |
| ne_locktype_write |
| }; |
| |
| |
| struct ne_lock { |
| ne_uri uri; |
| int depth; |
| enum ne_lock_type type; |
| enum ne_lock_scope scope; |
| char *token; |
| char *owner; |
| long timeout; |
| }; |
| |
| |
| |
| |
| #define NE_TIMEOUT_INFINITE -1 |
| #define NE_TIMEOUT_INVALID -2 |
| |
| |
| |
| |
| struct ne_lock *ne_lock_create(void); |
| |
| |
| |
| |
| |
| |
| struct ne_lock *ne_lock_copy(const struct ne_lock *lock); |
| |
| |
| |
| void ne_lock_free(struct ne_lock *lock); |
| |
| |
| void ne_lock_destroy(struct ne_lock *lock); |
| |
| |
| |
| typedef struct ne_lock_store_s ne_lock_store; |
| |
| |
| ne_lock_store *ne_lockstore_create(void); |
| |
| |
| |
| |
| void ne_lockstore_register(ne_lock_store *store, ne_session *sess); |
| |
| |
| void ne_lockstore_destroy(ne_lock_store *store); |
| |
| |
| |
| |
| |
| |
| |
| void ne_lockstore_add(ne_lock_store *store, struct ne_lock *lock); |
| |
| |
| |
| void ne_lockstore_remove(ne_lock_store *store, struct ne_lock *lock); |
| |
| |
| |
| struct ne_lock *ne_lockstore_first(ne_lock_store *store); |
| |
| |
| |
| |
| |
| |
| struct ne_lock *ne_lockstore_next(ne_lock_store *store); |
| |
| |
| |
| struct ne_lock *ne_lockstore_findbyuri(ne_lock_store *store, |
| const ne_uri *uri); |
| |
| |
| |
| |
| |
| |
| int ne_lock(ne_session *sess, struct ne_lock *lock); |
| |
| |
| int ne_unlock(ne_session *sess, const struct ne_lock *lock); |
| |
| |
| int ne_lock_refresh(ne_session *sess, struct ne_lock *lock); |
| |
| |
| |
| |
| |
| |
| |
| typedef void (*ne_lock_result)(void *userdata, const struct ne_lock *lock, |
| const ne_uri *uri, const ne_status *status); |
| |
| |
| |
| int ne_lock_discover(ne_session *sess, const char *path, |
| ne_lock_result result, void *userdata); |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| void ne_lock_using_resource(ne_request *req, const char *path, int depth); |
| |
| |
| |
| |
| void ne_lock_using_parent(ne_request *req, const char *path); |
| |
| NE_END_DECLS |
| |
| #endif /* NE_LOCKS_H */ |