File: e2k-context.h

package info (click to toggle)
evolution-data-server 1.6.3-5etch3
  • links: PTS
  • area: main
  • in suites: etch
  • size: 59,384 kB
  • ctags: 43,218
  • sloc: ansic: 319,315; tcl: 30,499; xml: 19,166; sh: 18,776; perl: 11,529; cpp: 8,259; java: 7,653; makefile: 6,448; awk: 1,338; yacc: 1,103; sed: 772; cs: 505; lex: 134; asm: 14
file content (218 lines) | stat: -rw-r--r-- 6,800 bytes parent folder | download | duplicates (3)
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* Copyright (C) 2001-2004 Novell, Inc. */

#ifndef __E2K_CONTEXT_H__
#define __E2K_CONTEXT_H__

#include <libsoup/soup-message.h>
#include <sys/time.h>

#include <glib-object.h>

#include "e2k-types.h"
#include "e2k-operation.h"
#include "e2k-http-utils.h"
#include "e2k-result.h"

#ifdef __cplusplus
extern "C" {
#pragma }
#endif /* __cplusplus */

#define E2K_TYPE_CONTEXT            (e2k_context_get_type ())
#define E2K_CONTEXT(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), E2K_TYPE_CONTEXT, E2kContext))
#define E2K_CONTEXT_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), E2K_TYPE_CONTEXT, E2kContextClass))
#define E2K_IS_CONTEXT(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E2K_TYPE_CONTEXT))
#define E2K_IS_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E2K_TYPE_CONTEXT))

struct _E2kContext {
	GObject parent;

	E2kContextPrivate *priv;
};

struct _E2kContextClass {
	GObjectClass parent_class;

	/* signals */
	void (*redirect) (E2kContext *ctx, E2kHTTPStatus status,
			  const char *old_uri, const char *new_uri);
};

GType          e2k_context_get_type         (void);

E2kContext    *e2k_context_new              (const char  *uri);
void           e2k_context_set_auth         (E2kContext  *ctx,
					     const char  *username,
					     const char  *domain,
					     const char  *authmech,
					     const char  *password);
gboolean       e2k_context_fba              (E2kContext  *ctx,
					     SoupMessage *failed_msg);

time_t        e2k_context_get_last_timestamp    (E2kContext *ctx);

typedef gboolean (*E2kContextTestCallback)     (E2kContext *ctx,
						const char *test_name,
						gpointer user_data);

E2kHTTPStatus  e2k_context_get               (E2kContext *ctx,
					      E2kOperation *op,
					      const char *uri,
					      char **content_type,
					      char **body, int *len);
E2kHTTPStatus  e2k_context_get_owa           (E2kContext *ctx,
					      E2kOperation *op,
					      const char *uri,
					      gboolean claim_ie,
					      char **body, int *len);

E2kHTTPStatus  e2k_context_put               (E2kContext *ctx,
					      E2kOperation *op,
					      const char *uri,
					      const char *content_type,
					      const char *body, int length,
					      char **repl_uid);
E2kHTTPStatus  e2k_context_put_new           (E2kContext *ctx,
					      E2kOperation *op,
					      const char *folder_uri,
					      const char *object_name,
					      E2kContextTestCallback test_callback,
					      gpointer user_data,
					      const char *content_type,
					      const char *body, int length,
					      char **location,
					      char **repl_uid);
E2kHTTPStatus  e2k_context_post              (E2kContext *ctx,
					      E2kOperation *op,
					      const char *uri,
					      const char *content_type,
					      const char *body, int length,
					      char **location,
					      char **repl_uid);

E2kHTTPStatus  e2k_context_proppatch         (E2kContext *ctx,
					      E2kOperation *op,
					      const char *uri,
					      E2kProperties *props,
					      gboolean create,
					      char **repl_uid);
E2kHTTPStatus  e2k_context_proppatch_new     (E2kContext *ctx,
					      E2kOperation *op,
					      const char *folder_uri,
					      const char *object_name,
					      E2kContextTestCallback test_callback,
					      gpointer user_data,
					      E2kProperties *props,
					      char **location,
					      char **repl_uid);
E2kResultIter *e2k_context_bproppatch_start  (E2kContext *ctx,
					      E2kOperation *op,
					      const char *uri,
					      const char **hrefs,
					      int nhrefs,
					      E2kProperties *props,
					      gboolean create);

E2kHTTPStatus  e2k_context_propfind          (E2kContext *ctx,
					      E2kOperation *op,
					      const char *uri,
					      const char **props,
					      int nprops,
					      E2kResult **results,
					      int *nresults);
E2kResultIter *e2k_context_bpropfind_start   (E2kContext *ctx,
					      E2kOperation *op,
					      const char *uri,
					      const char **hrefs,
					      int nhrefs,
					      const char **props,
					      int nprops);

E2kResultIter *e2k_context_search_start      (E2kContext *ctx,
					      E2kOperation *op,
					      const char *uri,
					      const char **props,
					      int nprops,
					      E2kRestriction *rn,
					      const char *orderby,
					      gboolean ascending);

E2kHTTPStatus  e2k_context_delete            (E2kContext *ctx,
					      E2kOperation *op,
					      const char *uri);

E2kResultIter *e2k_context_bdelete_start     (E2kContext *ctx,
					      E2kOperation *op,
					      const char *uri,
					      const char **hrefs,
					      int nhrefs);

E2kHTTPStatus  e2k_context_mkcol             (E2kContext *ctx,
					      E2kOperation *op,
					      const char *uri,
					      E2kProperties *props,
					      char **permanent_url);

E2kResultIter *e2k_context_transfer_start    (E2kContext *ctx,
					      E2kOperation *op,
					      const char *source_folder,
					      const char *dest_folder,
					      GPtrArray *source_hrefs,
					      gboolean delete_originals);
E2kHTTPStatus  e2k_context_transfer_dir      (E2kContext *ctx,
					      E2kOperation *op,
					      const char *source_href,
					      const char *dest_href,
					      gboolean delete_original,
					      char **permanent_url);

/* Subscriptions */
typedef enum {
	E2K_CONTEXT_OBJECT_CHANGED,
	E2K_CONTEXT_OBJECT_ADDED,
	E2K_CONTEXT_OBJECT_REMOVED,
	E2K_CONTEXT_OBJECT_MOVED
} E2kContextChangeType;

typedef void (*E2kContextChangeCallback)     (E2kContext *ctx,
					      const char *uri,
					      E2kContextChangeType type,
					      gpointer user_data);

void          e2k_context_subscribe          (E2kContext *ctx,
					      const char *uri,
					      E2kContextChangeType type,
					      int min_interval,
					      E2kContextChangeCallback callback,
					      gpointer user_data);
void          e2k_context_unsubscribe        (E2kContext *ctx,
					      const char *uri);


/*
 * Utility functions
 */
SoupMessage   *e2k_soup_message_new      (E2kContext *ctx,
					  const char *uri,
					  const char *method);
SoupMessage   *e2k_soup_message_new_full (E2kContext *ctx,
					  const char *uri,
					  const char *method,
					  const char *content_type,
					  SoupOwnership owner,
					  const char *body,
					  gulong length);
void           e2k_context_queue_message (E2kContext *ctx,
					  SoupMessage *msg, 
					  SoupMessageCallbackFn callback, 
					  gpointer user_data);
E2kHTTPStatus  e2k_context_send_message  (E2kContext *ctx,
					  E2kOperation *op,
					  SoupMessage *msg);

#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif /* __E2K_CONTEXT_H__ */