#include <arpa/inet.h>#include <errno.h>#include <net/if.h>#include <netdb.h>#include <netinet/in.h>#include <netinet/tcp.h>#include <stdlib.h>#include <sys/param.h>#include <sys/socket.h>#include <sys/stat.h>#include <sys/time.h>#include <sys/uio.h>#include <sys/un.h>#include <time.h>#include <atalk/adouble.h>#include <atalk/cnid_bdb_private.h>#include <atalk/cnid.h>#include <atalk/logger.h>#include <atalk/util.h>#include <atalk/volume.h>#include "cnid_dbd.h"Macros | |
| #define | SOL_TCP IPPROTO_TCP |
| #define | MAX_DELAY 20 |
| #define | ONE_DELAY 5 |
Functions | |
| static void | RQST_RESET (struct cnid_dbd_rqst *r) |
| static void | delay (int sec) |
| static int | tsock_getfd (const char *host, const char *port) |
| static int | write_vec (int fd, struct iovec *iov, ssize_t towrite, int vecs) |
| Write "towrite" bytes using writev on non-blocking fd. | |
| static int | init_tsock (CNID_bdb_private *db) |
| static int | send_packet (CNID_bdb_private *db, struct cnid_dbd_rqst *rqst) |
| static void | dbd_initstamp (struct cnid_dbd_rqst *rqst) |
| static int | dbd_reply_stamp (struct cnid_dbd_rply *rply) |
| static int | dbd_rpc (CNID_bdb_private *db, struct cnid_dbd_rqst *rqst, struct cnid_dbd_rply *rply) |
| send a request and get reply | |
| static int | transmit (CNID_bdb_private *db, struct cnid_dbd_rqst *rqst, struct cnid_dbd_rply *rply) |
| static struct _cnid_db * | cnid_dbd_new (struct vol *vol) |
| struct _cnid_db * | cnid_dbd_open (struct cnid_open_args *args) |
| void | cnid_dbd_close (struct _cnid_db *cdb) |
| static int | cnid_dbd_stamp (CNID_bdb_private *db) |
| cnid_t | cnid_dbd_add (struct _cnid_db *cdb, const struct stat *st, cnid_t did, const char *name, size_t len, cnid_t hint) |
| cnid_t | cnid_dbd_get (struct _cnid_db *cdb, cnid_t did, const char *name, size_t len) |
| char * | cnid_dbd_resolve (struct _cnid_db *cdb, cnid_t *id, void *buffer, size_t len) |
| int | cnid_dbd_getstamp (struct _cnid_db *cdb, void *buffer, const size_t len) |
| cnid_t | cnid_dbd_lookup (struct _cnid_db *cdb, const struct stat *st, cnid_t did, const char *name, size_t len) |
| int | cnid_dbd_find (struct _cnid_db *cdb, const char *name, size_t namelen, void *buffer, size_t buflen) |
| int | cnid_dbd_update (struct _cnid_db *cdb, cnid_t id, const struct stat *st, cnid_t did, const char *name, size_t len) |
| cnid_t | cnid_dbd_rebuild_add (struct _cnid_db *cdb, const struct stat *st, cnid_t did, const char *name, size_t len, cnid_t hint) |
| int | cnid_dbd_delete (struct _cnid_db *cdb, const cnid_t id) |
| int | cnid_dbd_wipe (struct _cnid_db *cdb) |
Variables | |
| struct _cnid_module | cnid_dbd_module |
| #define MAX_DELAY 20 |
Wait MAX_DELAY seconds before a request to the CNID server times out
| #define ONE_DELAY 5 |
| #define SOL_TCP IPPROTO_TCP |
| cnid_t cnid_dbd_add | ( | struct _cnid_db * | cdb, |
| const struct stat * | st, | ||
| cnid_t | did, | ||
| const char * | name, | ||
| size_t | len, | ||
| cnid_t | hint ) |
| void cnid_dbd_close | ( | struct _cnid_db * | cdb | ) |
| int cnid_dbd_find | ( | struct _cnid_db * | cdb, |
| const char * | name, | ||
| size_t | namelen, | ||
| void * | buffer, | ||
| size_t | buflen ) |
| int cnid_dbd_getstamp | ( | struct _cnid_db * | cdb, |
| void * | buffer, | ||
| const size_t | len ) |
Caller passes buffer where we will store the db stamp
| cnid_t cnid_dbd_lookup | ( | struct _cnid_db * | cdb, |
| const struct stat * | st, | ||
| cnid_t | did, | ||
| const char * | name, | ||
| size_t | len ) |
| struct _cnid_db * cnid_dbd_open | ( | struct cnid_open_args * | args | ) |
| cnid_t cnid_dbd_rebuild_add | ( | struct _cnid_db * | cdb, |
| const struct stat * | st, | ||
| cnid_t | did, | ||
| const char * | name, | ||
| size_t | len, | ||
| cnid_t | hint ) |
|
static |
Get the db stamp
| int cnid_dbd_update | ( | struct _cnid_db * | cdb, |
| cnid_t | id, | ||
| const struct stat * | st, | ||
| cnid_t | did, | ||
| const char * | name, | ||
| size_t | len ) |
| int cnid_dbd_wipe | ( | struct _cnid_db * | cdb | ) |
|
static |
|
static |
|
static |
send a request and get reply
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Write "towrite" bytes using writev on non-blocking fd.
Every short write is considered an error, transmit can handle that.
| [in] | fd | socket fd which must be non-blocking |
| [in] | iov | iovec for writev |
| [in] | towrite | number of bytes in all iovec elements |
| [in] | vecs | number of iovecs in array |
| struct _cnid_module cnid_dbd_module |