1#ifndef _MOD_SMBDAV_H_ 2#define _MOD_SMBDAV_H_ 3 4#if defined(HAVE_LIBXML_H) && defined(HAVE_SQLITE3_H) 5#define USE_PROPPATCH 6#define USE_MINIDLNA_DB 7#include <libxml/tree.h> 8#include <libxml/parser.h> 9 10#include <sqlite3.h> 11#endif 12 13#if defined(HAVE_LIBXML_H) && defined(HAVE_SQLITE3_H) && defined(HAVE_UUID_UUID_H) 14#define USE_LOCKS 15 16#ifndef EMBEDDED_EANBLE 17#include <uuid/uuid.h> 18#endif 19 20#endif 21 22#include <unistd.h> 23#include <dirent.h> 24#include <libsmbclient.h> 25#include "base.h" 26#include <dlinklist.h> 27 28typedef struct { 29 size_t namelen; 30 size_t iplen; 31 size_t maclen; 32 time_t mtime; 33 int online; 34 off_t size; 35} smbc_dirls_entry_t; 36 37typedef struct { 38 smbc_dirls_entry_t **ent; 39 size_t used; 40 size_t size; 41} smbc_dirls_list_t; 42 43#define DIRLIST_ENT_NAME(ent) ((char*)(ent) + sizeof(smbc_dirls_entry_t)) 44#define DIRLIST_BLOB_SIZE 16 45 46/** 47 * this is a smbdav for a lighttpd plugin 48 * 49 * at least a very basic one. 50 * - for now it is read-only and we only support PROPFIND 51 * 52 */ 53 54#define WEBDAV_FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH 55#define WEBDAV_DIR_MODE S_IRWXU | S_IRWXG | S_IRWXO 56 57/* plugin config for all request/connections */ 58 59typedef struct { 60 unsigned short enabled; 61 unsigned short is_readonly; 62 unsigned short log_xml; 63 64 buffer *sqlite_db_name; 65#ifdef USE_PROPPATCH 66 sqlite3 *sql; 67 sqlite3_stmt *stmt_update_prop; 68 sqlite3_stmt *stmt_delete_prop; 69 sqlite3_stmt *stmt_select_prop; 70 sqlite3_stmt *stmt_select_propnames; 71 72 sqlite3_stmt *stmt_delete_uri; 73 sqlite3_stmt *stmt_move_uri; 74 sqlite3_stmt *stmt_copy_uri; 75 76 sqlite3_stmt *stmt_remove_lock; 77 sqlite3_stmt *stmt_create_lock; 78 sqlite3_stmt *stmt_read_lock; 79 sqlite3_stmt *stmt_read_lock_by_uri; 80 sqlite3_stmt *stmt_refresh_lock; 81#endif 82 83 //- 20130304 JerryLin add 84 buffer *sqlite_minidlna_db_name; 85#ifdef USE_MINIDLNA_DB 86 sqlite3 *sql_minidlna; 87#endif 88 89} plugin_config; 90 91typedef struct { 92 PLUGIN_DATA; 93 94 buffer *tmp_buf; 95 request_uri uri; 96 physical physical; 97 98 plugin_config **config_storage; 99 100 plugin_config conf; 101/* 102 smb_info_t *smb_info_list; 103 buffer *username; 104 buffer *password; 105*/ 106 107} plugin_data; 108 109#if 0 110typedef struct smbdav_conn_s { 111 buffer *sess_id; 112 struct cli_state *cli; 113 //buffer *smb_host; 114 //buffer *smb_home_dir; 115 buffer *uri; 116 buffer *workgroup; 117 buffer *server; 118 buffer *share; 119 buffer *path; 120 buffer *home; 121 uint8_t qflag; 122 unsigned short smb_port; 123 NTLM_MESSAGE_TYPE state; 124 void *ntlmssp_state; 125 //int authed; 126 buffer *src_ipaddr; 127 uint16_t src_port; 128 struct smbdav_conn_s *next, *prev; 129}smbdav_conn_t; 130#endif 131 132#endif 133