1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
2 * camel-private.h: Private info for class implementers.
4 * Authors: Michael Zucchi <notzed@ximian.com>
6 * Copyright 1999, 2000 Ximian, Inc. (www.ximian.com)
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of version 2 of the GNU Lesser General Public
10 * License as published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
23 #ifndef CAMEL_PRIVATE_H
24 #define CAMEL_PRIVATE_H 1
26 /* need a way to configure and save this data, if this header is to
27 be installed. For now, dont install it */
34 #include <libedataserver/e-msgport.h>
38 struct _CamelFolderPrivate {
40 GStaticMutex change_lock;
41 /* must require the 'change_lock' to access this */
43 struct _CamelFolderChangeInfo *changed_frozen; /* queues changed events */
46 #define CAMEL_FOLDER_LOCK(f, l) \
47 (g_static_mutex_lock(&((CamelFolder *)f)->priv->l))
48 #define CAMEL_FOLDER_UNLOCK(f, l) \
49 (g_static_mutex_unlock(&((CamelFolder *)f)->priv->l))
50 #define CAMEL_FOLDER_REC_LOCK(f, l) \
51 (g_static_rec_mutex_lock(&((CamelFolder *)f)->priv->l))
52 #define CAMEL_FOLDER_REC_UNLOCK(f, l) \
53 (g_static_rec_mutex_unlock(&((CamelFolder *)f)->priv->l))
56 struct _CamelStorePrivate {
57 GStaticRecMutex folder_lock; /* for locking folder operations */
60 #define CAMEL_STORE_LOCK(f, l) \
61 (g_static_rec_mutex_lock(&((CamelStore *)f)->priv->l))
62 #define CAMEL_STORE_UNLOCK(f, l) \
63 (g_static_rec_mutex_unlock(&((CamelStore *)f)->priv->l))
66 struct _CamelTransportPrivate {
67 GMutex *send_lock; /* for locking send operations */
70 #define CAMEL_TRANSPORT_LOCK(f, l) (g_mutex_lock(((CamelTransport *)f)->priv->l))
71 #define CAMEL_TRANSPORT_UNLOCK(f, l) (g_mutex_unlock(((CamelTransport *)f)->priv->l))
74 struct _CamelServicePrivate {
75 GStaticRecMutex connect_lock; /* for locking connection operations */
76 GStaticMutex connect_op_lock; /* for locking the connection_op */
79 #define CAMEL_SERVICE_LOCK(f, l) \
80 (g_static_mutex_lock(&((CamelService *)f)->priv->l))
81 #define CAMEL_SERVICE_UNLOCK(f, l) \
82 (g_static_mutex_unlock(&((CamelService *)f)->priv->l))
83 #define CAMEL_SERVICE_REC_LOCK(f, l) \
84 (g_static_rec_mutex_lock(&((CamelService *)f)->priv->l))
85 #define CAMEL_SERVICE_REC_UNLOCK(f, l) \
86 (g_static_rec_mutex_unlock(&((CamelService *)f)->priv->l))
89 struct _CamelSessionPrivate {
90 GMutex *lock; /* for locking everything basically */
91 GMutex *thread_lock; /* locking threads */
94 GHashTable *thread_active;
95 GThreadPool *thread_pool;
97 GHashTable *thread_msg_op;
100 #define CAMEL_SESSION_LOCK(f, l) (g_mutex_lock(((CamelSession *)f)->priv->l))
101 #define CAMEL_SESSION_UNLOCK(f, l) (g_mutex_unlock(((CamelSession *)f)->priv->l))
104 /* most of this stuff really is private, but the lock can be used by subordinate classes */
105 struct _CamelFolderSummaryPrivate {
106 GHashTable *filter_charset; /* CamelMimeFilterCharset's indexed by source charset */
108 struct _CamelMimeFilterIndex *filter_index;
109 struct _CamelMimeFilterBasic *filter_64;
110 struct _CamelMimeFilterBasic *filter_qp;
111 struct _CamelMimeFilterBasic *filter_uu;
112 struct _CamelMimeFilterSave *filter_save;
113 struct _CamelMimeFilterHTML *filter_html;
115 struct _CamelStreamFilter *filter_stream;
117 struct _CamelIndex *index;
119 GMutex *summary_lock; /* for the summary hashtable/array */
120 GMutex *io_lock; /* load/save lock, for access to saved_count, etc */
121 GMutex *filter_lock; /* for accessing any of the filtering/indexing stuff, since we share them */
122 GMutex *alloc_lock; /* for setting up and using allocators */
123 GMutex *ref_lock; /* for reffing/unreffing messageinfo's ALWAYS obtain before summary_lock */
126 #define CAMEL_SUMMARY_LOCK(f, l) (g_mutex_lock(((CamelFolderSummary *)f)->priv->l))
127 #define CAMEL_SUMMARY_UNLOCK(f, l) (g_mutex_unlock(((CamelFolderSummary *)f)->priv->l))
130 struct _CamelStoreSummaryPrivate {
131 GMutex *summary_lock; /* for the summary hashtable/array */
132 GMutex *io_lock; /* load/save lock, for access to saved_count, etc */
133 GMutex *alloc_lock; /* for setting up and using allocators */
134 GMutex *ref_lock; /* for reffing/unreffing messageinfo's ALWAYS obtain before summary_lock */
137 #define CAMEL_STORE_SUMMARY_LOCK(f, l) (g_mutex_lock(((CamelStoreSummary *)f)->priv->l))
138 #define CAMEL_STORE_SUMMARY_UNLOCK(f, l) (g_mutex_unlock(((CamelStoreSummary *)f)->priv->l))
141 struct _CamelVeeFolderPrivate {
142 GList *folders; /* lock using subfolder_lock before changing/accessing */
143 GList *folders_changed; /* for list of folders that have changed between updates */
145 GMutex *summary_lock; /* for locking vfolder summary */
146 GMutex *subfolder_lock; /* for locking the subfolder list */
147 GMutex *changed_lock; /* for locking the folders-changed list */
150 #define CAMEL_VEE_FOLDER_LOCK(f, l) (g_mutex_lock(((CamelVeeFolder *)f)->priv->l))
151 #define CAMEL_VEE_FOLDER_UNLOCK(f, l) (g_mutex_unlock(((CamelVeeFolder *)f)->priv->l))
154 struct _CamelDataWrapperPrivate {
155 pthread_mutex_t stream_lock;
158 #define CAMEL_DATA_WRAPPER_LOCK(dw, l) (pthread_mutex_lock(&((CamelDataWrapper *)dw)->priv->l))
159 #define CAMEL_DATA_WRAPPER_UNLOCK(dw, l) (pthread_mutex_unlock(&((CamelDataWrapper *)dw)->priv->l))
162 /* most of this stuff really is private, but the lock can be used by subordinate classes */
163 struct _CamelCertDBPrivate {
164 GMutex *db_lock; /* for the db hashtable/array */
165 GMutex *io_lock; /* load/save lock, for access to saved_count, etc */
166 GMutex *alloc_lock; /* for setting up and using allocators */
167 GMutex *ref_lock; /* for reffing/unreffing certs */
170 #define CAMEL_CERTDB_LOCK(db, l) (g_mutex_lock (((CamelCertDB *) db)->priv->l))
171 #define CAMEL_CERTDB_UNLOCK(db, l) (g_mutex_unlock (((CamelCertDB *) db)->priv->l))
176 const char *_camel_get_localedir (void) G_GNUC_CONST;
177 const char *_camel_get_libexecdir (void) G_GNUC_CONST;
178 const char *_camel_get_providerdir (void) G_GNUC_CONST;
180 #undef EVOLUTION_LOCALEDIR
181 #define EVOLUTION_LOCALEDIR _camel_get_localedir ()
183 #undef CAMEL_LIBEXECDIR
184 #define CAMEL_LIBEXECDIR _camel_get_libexecdir ()
186 #undef CAMEL_PROVIDERDIR
187 #define CAMEL_PROVIDERDIR _camel_get_providerdir ()
189 #endif /* G_OS_WIN32 */
193 #endif /* CAMEL_PRIVATE_H */