-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathphp_tnc_dav.h
92 lines (77 loc) · 2.91 KB
/
php_tnc_dav.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/*
Copyright 2012 The NetCircle <[email protected]>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#ifndef PHP_TNC_DAV_H
#define PHP_TNC_DAV_H
#define PHP_TNC_DAV_EXTNAME "tnc_dav"
#define PHP_TNC_DAV_VERSION "0.1.4"
extern zend_module_entry dav_module_entry;
#define phpext_dav_ptr &dav_module_entry
#ifdef PHP_WIN32
#define PHP_TNC_DAV_API __declspec(dllexport)
#else
#define PHP_TNC_DAV_API
#endif
#ifdef ZTS
#include "TSRM.h"
#endif
typedef struct _tnc_dav {
zend_object std;
char *url;
int url_len;
char *user;
int user_len;
char *pass;
int pass_len;
ne_session *sess;
char *status_buffer;
int status_code;
} tnc_dav_t;
#define GET_DAV(obj) \
object = (tnc_dav_t*)zend_object_store_get_object((obj) TSRMLS_CC);
#if ZEND_MODULE_API_NO >= 20100525
#define init_properties(intern) object_properties_init(&intern->std, class_type)
#else
#define init_properties(intern) { \
zval *tmp; \
zend_hash_copy(intern->std.properties, \
&class_type->default_properties, (copy_ctor_func_t) zval_add_ref, \
(void *) &tmp, sizeof(zval *)); \
}
#endif
static zend_object_value create_new_tnc_dav(zend_class_entry *class_type TSRMLS_DC);
void php_tnc_dav_t_free(void *object TSRMLS_DC);
static int cb_dav_auth(void *userdata, const char *realm, int attempts, char *username, char *password);
static int cb_dav_reader(void *userdata, const char *buf, size_t len);
static char *get_error_msg(ne_session *sess);
static char *make_full_uri(tnc_dav_t *object, const char *path, int path_len);
static void status_callback(void *userdata, ne_session_status status, const ne_session_status_info *info);
int tnc_dav_accept_2xx(void *userdata, ne_request *req, const ne_status *st);
PHP_MINIT_FUNCTION(tnc_dav);
PHP_METHOD(TncWebdav, __construct);
PHP_METHOD(TncWebdav, getHost);
PHP_METHOD(TncWebdav, getUser);
PHP_METHOD(TncWebdav, getPassword);
PHP_METHOD(TncWebdav, get);
PHP_METHOD(TncWebdav, put);
PHP_METHOD(TncWebdav, delete);
PHP_METHOD(TncWebdav, copy);
PHP_METHOD(TncWebdav, move);
PHP_METHOD(TncWebdav, mkcol);
PHP_METHOD(TncWebdav, propfind);
PHP_METHOD(TncWebdav, options);
PHP_METHOD(TncWebdav, getModTime);
PHP_METHOD(TncWebdav, close);
PHP_METHOD(TncWebdav, setReadTimeout);
PHP_METHOD(TncWebdav, setConnectTimeout);
PHP_METHOD(TncWebdav, getStatus);
#endif /* PHP_TNC_DAV_H */