2 OpenChange Exchange Administration library.
4 Copyright (C) Julien Kerihuel 2007.
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.
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.
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/>.
20 #include <libmapiadmin/libmapiadmin.h>
24 Housekeeping functions for mapiadmin
28 Create and initialise a mapiadmin_ctx structure
30 You should use mapiadmin_release to clean up the mapiadmin_ctx
33 _PUBLIC_
struct mapiadmin_ctx
*mapiadmin_init(struct mapi_session
*session
)
35 struct mapiadmin_ctx
*mapiadmin_ctx
;
37 if (!global_mapi_ctx
) return NULL
;
38 if (!session
) return NULL
;
39 if (!session
->profile
) return NULL
;
41 mapiadmin_ctx
= talloc_zero((TALLOC_CTX
*)session
, struct mapiadmin_ctx
);
43 mapiadmin_ctx
->binding
= talloc_asprintf((TALLOC_CTX
*)mapiadmin_ctx
, "ncacn_np:%s",
44 session
->profile
->server
);
45 mapiadmin_ctx
->session
= session
;
51 Clean up a mapiadmin_ctx structure
53 The structure is assumed to have been allocated uding mapiadmin_init() or
56 _PUBLIC_
enum MAPISTATUS
mapiadmin_release(struct mapiadmin_ctx
*mapiadmin_ctx
)
58 MAPI_RETVAL_IF(!mapiadmin_ctx
, MAPI_E_NOT_INITIALIZED
, NULL
);
60 talloc_free(mapiadmin_ctx
);
62 return MAPI_E_SUCCESS
;