X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=include%2Fatalk%2Futil.h;h=5149acd9c308104913e0955d399e1507f95689fa;hb=b0bcb8f6b0571592a50ce039882c9319e012a270;hp=d60485e1614d3d0d54a546dedf455529f9221494;hpb=9be2e1841f0e7bdb52e8603d87f028c98e3dd268;p=netatalk.git diff --git a/include/atalk/util.h b/include/atalk/util.h index d60485e1..5149acd9 100644 --- a/include/atalk/util.h +++ b/include/atalk/util.h @@ -11,15 +11,13 @@ #ifndef _ATALK_UTIL_H #define _ATALK_UTIL_H 1 -#include #include #include #include +#include -#ifndef NO_DDP -#include -#endif #include +#include /* exit error codes */ #define EXITERR_CLNT 1 /* client related error */ @@ -55,6 +53,16 @@ #define STRCMP(a,b,c) (strcmp(a,c) b 0) #define ZERO_STRUCT(a) memset(&(a), 0, sizeof(a)) +#define ZERO_STRUCTP(a) memset((a), 0, sizeof(a)) + +#if BYTE_ORDER == BIG_ENDIAN +#define hton64(x) (x) +#define ntoh64(x) (x) +#else /* BYTE_ORDER == BIG_ENDIAN */ +#define hton64(x) ((uint64_t) (htonl(((x) >> 32) & 0xffffffffLL)) | \ + (uint64_t) ((htonl(x) & 0xffffffffLL) << 32)) +#define ntoh64(x) (hton64(x)) +#endif /* BYTE_ORDER == BIG_ENDIAN */ #ifdef WITH_SENDFILE extern ssize_t sys_sendfile (int __out_fd, int __in_fd, off_t *__offset,size_t __count); @@ -67,9 +75,6 @@ extern void freeifacelist(char **); #define diatolower(x) _dialowermap[(unsigned char) (x)] #define diatoupper(x) _diacasemap[(unsigned char) (x)] -#ifndef NO_DDP -extern int atalk_aton (char *, struct at_addr *); -#endif extern void bprint (char *, int); extern int strdiacasecmp (const char *, const char *); extern int strndiacasecmp (const char *, const char *, size_t); @@ -128,11 +133,35 @@ extern int lock_reg(int fd, int cmd, int type, off_t offest, int whence, off_t l extern int setnonblock(int fd, int cmd); extern ssize_t readt(int socket, void *data, const size_t length, int setnonblocking, int timeout); +extern ssize_t writet(int socket, void *data, const size_t length, int setnonblocking, int timeout); extern const char *getip_string(const struct sockaddr *sa); extern unsigned int getip_port(const struct sockaddr *sa); extern void apply_ip_mask(struct sockaddr *ai, int maskbits); extern int compare_ip(const struct sockaddr *sa1, const struct sockaddr *sa2); +/* Structures and functions dealing with dynamic pollfd arrays */ +enum fdtype {IPC_FD, LISTEN_FD, DISASOCIATED_IPC_FD}; +struct polldata { + enum fdtype fdtype; /* IPC fd or listening socket fd */ + void *data; /* pointer to AFPconfig for listening socket and * + * pointer to afp_child_t for IPC fd */ +}; + +extern void fdset_add_fd(struct pollfd **fdsetp, + struct polldata **polldatap, + int *fdset_usedp, + int *fdset_sizep, + int fd, + enum fdtype fdtype, + void *data); +extern void fdset_del_fd(struct pollfd **fdsetp, + struct polldata **polldatap, + int *fdset_usedp, + int *fdset_sizep, + int fd); +extern int send_fd(int socket, int fd); +extern int recv_fd(int fd, int nonblocking); + /****************************************************************** * unix.c *****************************************************************/ @@ -143,3 +172,9 @@ extern char *stripped_slashes_basename(char *p); extern int lchdir(const char *dir); extern void randombytes(void *buf, int n); #endif /* _ATALK_UTIL_H */ + +/****************************************************************** + * cnid.c + *****************************************************************/ + +extern bstring rel_path_in_vol(const char *path, const char *volpath);