#include "share_hash.h"
Go to the source code of this file.
Classes | |
| struct | file_share |
Defines | |
| #define | LIBGIFTPROTO_EXPORT /* nothing */ |
| #define | SHARE_BACKCOMPAT |
| #define | SHARE_DATA(share) (share) |
Typedefs | |
| typedef file_share | Share |
| typedef file_share | FileShare |
Functions | |
| EXTERN_C_BEGIN LIBGIFTPROTO_EXPORT BOOL | share_init (Share *share, const char *path) |
| LIBGIFTPROTO_EXPORT void | share_finish (Share *share) |
| LIBGIFTPROTO_EXPORT Share * | share_new (const char *path) |
| LIBGIFTPROTO_EXPORT Share * | share_new_ex (struct protocol *p, const char *root, size_t root_len, const char *path, const char *mime, off_t size, time_t mtime) |
| LIBGIFTPROTO_EXPORT void | share_free (Share *share) |
| LIBGIFTPROTO_EXPORT unsigned int | share_ref (Share *share) |
| LIBGIFTPROTO_EXPORT unsigned int | share_unref (Share *share) |
| LIBGIFTPROTO_EXPORT char * | share_get_hpath (Share *share) |
| LIBGIFTPROTO_EXPORT void | share_set_path (Share *share, const char *path) |
| LIBGIFTPROTO_EXPORT void | share_set_root (Share *share, const char *root, size_t len) |
| LIBGIFTPROTO_EXPORT void | share_set_mime (Share *share, const char *mime) |
| LIBGIFTPROTO_EXPORT void | share_set_meta (Share *share, const char *key, const char *value) |
| LIBGIFTPROTO_EXPORT char * | share_get_meta (Share *share, const char *key) |
| LIBGIFTPROTO_EXPORT void | share_clear_meta (Share *share) |
| LIBGIFTPROTO_EXPORT void | share_foreach_meta (Share *share, DatasetForeachFn func, void *udata) |
| LIBGIFTPROTO_EXPORT void | share_set_udata (Share *share, const char *proto, void *udata) |
| LIBGIFTPROTO_EXPORT void * | share_get_udata (Share *share, const char *proto) |
| LIBGIFTPROTO_EXPORT BOOL | share_complete (Share *share) |
Please note that is an integral part of the giFT communication API for protocol plugins. You are encouraged to use this internally wherever appropriate.
Also note that there is a supplementary share_hash.[ch] that provides the rest of the API. Eventually it will merged in here, but as of now it is better left independent.
|
|
Clear all previously set meta data entries. |
|
|
Determines if the supplied share object is filled. The current determination is that a path must be set, and that it must begin with a leading '/'. |
|
|
Corresponding to share_init, but will destroy any internally owned memory from the storage location provided. The calling argument will not be free'd. |
|
||||||||||||||||
|
Simple abstraction from the Share::meta member. |
|
|
Destroy an allocated Share object and all its internally managed members as with share_init. The only difference between the two is that this function will free the calling argument. |
|
|
Access the "hidden" path from the object that is to be sent out to remote peers when responding to searches (whichever method is used to do this by the protocol plugin). When requests come back for a new upload, they will be required to be in this form. Please note that this routine will not function properly without a path and a root value set. See share_set_path, and share_set_root for more details.
|
|
||||||||||||
|
Access previously set meta data. |
|
||||||||||||
|
Access previously attached user-data. This should be pretty self-explanatory. |
|
||||||||||||
|
Similar to the share_new constructor, except that new memory is not allocated. Instead, a pre-allocated storage address is supplied. |
|
|
Construct a new shared file object. This is intended to be used both by giFT for each local file shared as well as by protocol plugins. The protocol communication API may require usage of this structure.
|
|
||||||||||||||||||||||||||||||||
|
Backwards compatible interface that matches the old share_new. This is done as a convenience to current protocol plugins out there and will hopefully be phased out with time. |
|
|
Increment the mortality/reference count for the supplied object. Please note that the initial reference count is 1 when constructed, and will be free'd automatically using share_free when the reference reaches 0 from share_unref.
|
|
||||||||||||||||
|
Set arbitrary meta data. Please note that key will be copied and lowercased. A copy of value will also be made by the dataset and internally managed.
|
|
||||||||||||
|
Attempts to map the supplied MIME type in an internally managed table of MIME types and then assigns a pointer there. If the MIME type has been seen before, the memory address will be shared. |
|
||||||||||||
|
Set the share objects path. This is called by share_new, which also further documents the functionality of this function. |
|
||||||||||||||||
|
Copy len number of bytes of the supplied `root' parameter into an internally allocated memory segment. Special precuation is taken to avoid setting share->root to NULL even when invalid or ambiguous parameters are given here. |
|
||||||||||||||||
|
Attach arbitrary user-data for your plugin using the key described by `proto'.
|
|
|
Decrement the mortality/reference count for the supplied object. See share_ref for more information. Please note that direct calls to share_free will not obey reference counting, only this function will.
|
1.3.7