"Fossies" - the Fresh Open Source Software Archive

Member "smbnetfs-0.6.3/src/smb_conn_srv.h" (3 Jan 2015, 4684 Bytes) of package /linux/misc/smbnetfs-0.6.3.tar.bz2:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "smb_conn_srv.h" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 0.5.3b_vs_0.6.0.

    1 #ifndef __SMB_CONN_SRV_H__
    2 #define __SMB_CONN_SRV_H__
    3 
    4 #include "config.h"
    5 #include <sys/types.h>
    6 #include <unistd.h>
    7 #include "smb_conn_proto.h"
    8 
    9 /* gcc specific extension. does nothing on other compilers */
   10 #if defined(__GNUC__)
   11   #define ATTRIB(x) __attribute__ (x)
   12 #else
   13   #define ATTRIB(x) /* no attributes */
   14 #endif
   15 
   16 enum smb_conn_srv_fd_type{
   17     SMB_CONN_FILE,
   18     SMB_CONN_DIR
   19 };
   20 
   21 struct smb_conn_srv_fd{
   22     enum smb_conn_srv_fd_type   type;
   23     int             fd;
   24     off_t           offset;
   25 };
   26 
   27 void smb_conn_srv_debug_print(struct smb_conn_srv_ctx *ctx,
   28                 enum smb_conn_cmd msg_type,
   29                 int errno_value,
   30                 int level, int no_fallback,
   31                 const char *fmt, ...) ATTRIB((format(printf, 6, 7)));
   32 
   33 void smb_conn_srv_send_reply(struct smb_conn_srv_ctx *ctx,
   34                 enum smb_conn_cmd query_cmd,
   35                 int errno_value,
   36                 void *reply, size_t reply_len);
   37 
   38 int smb_conn_srv_send_msg(struct smb_conn_srv_ctx *ctx,
   39                 enum smb_conn_cmd msg_type,
   40                 int errno_value,
   41                 int level,
   42                 const char *msg);
   43 
   44 void smb_conn_srv_open       (struct smb_conn_srv_ctx *ctx, struct smb_conn_open_query        *query, size_t query_len);
   45 void smb_conn_srv_creat      (struct smb_conn_srv_ctx *ctx, struct smb_conn_url_mode_query    *query, size_t query_len);
   46 void smb_conn_srv_read       (struct smb_conn_srv_ctx *ctx, struct smb_conn_rw_query          *query, size_t query_len);
   47 void smb_conn_srv_write      (struct smb_conn_srv_ctx *ctx, struct smb_conn_rw_query          *query, size_t query_len);
   48 void smb_conn_srv_close      (struct smb_conn_srv_ctx *ctx, struct smb_conn_fd_query          *query, size_t query_len);
   49 void smb_conn_srv_unlink     (struct smb_conn_srv_ctx *ctx, struct smb_conn_url_query         *query, size_t query_len);
   50 void smb_conn_srv_rename     (struct smb_conn_srv_ctx *ctx, struct smb_conn_rename_query      *query, size_t query_len);
   51 void smb_conn_srv_opendir    (struct smb_conn_srv_ctx *ctx, struct smb_conn_url_query         *query, size_t query_len);
   52 void smb_conn_srv_closedir   (struct smb_conn_srv_ctx *ctx, struct smb_conn_fd_query          *query, size_t query_len);
   53 void smb_conn_srv_readdir    (struct smb_conn_srv_ctx *ctx, struct smb_conn_rw_query          *query, size_t query_len);
   54 void smb_conn_srv_mkdir      (struct smb_conn_srv_ctx *ctx, struct smb_conn_url_mode_query    *query, size_t query_len);
   55 void smb_conn_srv_rmdir      (struct smb_conn_srv_ctx *ctx, struct smb_conn_url_query         *query, size_t query_len);
   56 void smb_conn_srv_stat       (struct smb_conn_srv_ctx *ctx, struct smb_conn_url_query         *query, size_t query_len);
   57 void smb_conn_srv_fstat      (struct smb_conn_srv_ctx *ctx, struct smb_conn_fd_query          *query, size_t query_len);
   58 void smb_conn_srv_ftruncate  (struct smb_conn_srv_ctx *ctx, struct smb_conn_ftruncate_query   *query, size_t query_len);
   59 void smb_conn_srv_chmod      (struct smb_conn_srv_ctx *ctx, struct smb_conn_url_mode_query    *query, size_t query_len);
   60 void smb_conn_srv_utimes     (struct smb_conn_srv_ctx *ctx, struct smb_conn_utimes_query      *query, size_t query_len);
   61 void smb_conn_srv_setxattr   (struct smb_conn_srv_ctx *ctx, struct smb_conn_setxattr_query    *query, size_t query_len);
   62 void smb_conn_srv_getxattr   (struct smb_conn_srv_ctx *ctx, struct smb_conn_getxattr_query    *query, size_t query_len);
   63 void smb_conn_srv_listxattr  (struct smb_conn_srv_ctx *ctx, struct smb_conn_listxattr_query   *query, size_t query_len);
   64 void smb_conn_srv_removexattr(struct smb_conn_srv_ctx *ctx, struct smb_conn_removexattr_query *query, size_t query_len);
   65 
   66 static inline const char* smb_conn_srv_get_url_from_query(const void *query, size_t url_offs){
   67     return  ((const char *) query) + url_offs;
   68 }
   69 
   70 #ifdef PRINTF_DEBUG
   71   #include <stdio.h>
   72   #define   DSRVPRINTF(ctx, level_value, fmt, args...)  { \
   73                                     fprintf(stderr, "srv(%d)->%s: " fmt, getpid(), __FUNCTION__, ## args); fflush(stderr); \
   74                                     smb_conn_srv_debug_print(ctx, MESSAGE, 0, level_value, 1, "srv(%d)->%s: " fmt, getpid(), __FUNCTION__, ## args); \
   75                                 }
   76   #define   DSRVDIEMSG(ctx, errno_value, fmt, args...)  { \
   77                                     fprintf(stderr, "srv(%d)->%s: " fmt, getpid(), __FUNCTION__, ## args); fflush(stderr); \
   78                                     smb_conn_srv_debug_print(ctx, DIE_MSG, errno_value, 0, 1, "srv(%d)->%s: " fmt, getpid(), __FUNCTION__, ## args); \
   79                                 }
   80 #else
   81   #define   DSRVPRINTF(ctx, level_value, fmt, args...)  smb_conn_srv_debug_print(ctx, MESSAGE, 0, level_value, 0, "srv(%d)->%s: " fmt, getpid(), __FUNCTION__, ## args)
   82   #define   DSRVDIEMSG(ctx, errno_value, fmt, args...)  smb_conn_srv_debug_print(ctx, DIE_MSG, errno_value, 0, 0, "srv(%d)->%s: " fmt, getpid(), __FUNCTION__, ## args)
   83 #endif
   84 
   85 #endif /* __SMB_CONN_SRV_H__ */