server: intialize aux_header buffer to null if the data is missing.
[tridge/openchange.git] / branches / plugfest / libmapi / mapi_notification.h
1 /*
2    OpenChange MAPI implementation.
3
4    Copyright (C) Julien Kerihuel 2007.
5
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 3 of the License, or
9    (at your option) any later version.
10    
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15    
16    You should have received a copy of the GNU General Public License
17    along with this program.  If not, see <http://www.gnu.org/licenses/>.
18  */
19
20 #ifndef __MAPI_NOTIFICATION_H__
21 #define __MAPI_NOTIFICATION_H__
22
23 /* notification which takes:
24  * - ulEvenType = type of notification
25  * - void * = notification data
26  * - void * = private data pointer
27 */
28 typedef int (*mapi_notify_callback_t)(uint16_t, void *, void *);
29
30 typedef int (*mapi_notify_continue_callback_t)(void *);
31
32 struct notifications {
33         uint32_t                ulConnection;           /* connection number */
34         uint32_t                NotificationFlags;      /* events mask associated */
35         mapi_id_t               parentID;               /* parent EntryID == FID here */
36         mapi_notify_callback_t  callback;               /* callback to run when */
37         void                    *private_data;          /* private data for the callback */
38         struct mapi_object      obj_notif;              /* notification object */
39         struct notifications    *prev;
40         struct notifications    *next;
41 };
42
43 struct mapi_notify_ctx {
44         struct NOTIFKEY         key;            /* unique identifier */
45         int                     fd;             /* UDP socket file descriptor */
46         struct sockaddr         *addr;
47         struct notifications    *notifications;
48 };
49
50 struct mapi_notify_continue_callback_data {
51         mapi_notify_continue_callback_t callback; /* Consulted for continuing processing events*/
52         void *data;                               /* Data for callback */
53         struct timeval tv;                        /* Timeout for Select call */
54 };
55
56 #define DFLT_NOTIF_PORT 2500
57
58 #endif /*!__MAPI_NOTIFICATION_H__ */