session.h
Go to the documentation of this file.
1 /* Copyright (c) 2004-2009, Isode Limited, London, England.
2  * All rights reserved.
3  *
4  * Acquisition and use of this software and related materials for any
5  * purpose requires a written licence agreement from Isode Limited,
6  * or a written licence from an organisation licenced by Isode Limited
7  * to grant such a licence.
8  *
9  */
10 
11 #ifndef _SOM_SESSION_H
12 #define _SOM_SESSION_H
13 
14 /* stdlib.h is included to ensure the declaration of size_t */
15 #include <stdlib.h>
16 
17 #include "cdecl.h"
18 #include "errors.h"
19 
20 #define SOM_LIBRARY_VERSION 100
38 struct SOMSession;
39 
56 typedef void SOMSessionCallback (struct SOMSession *session,
57  void *ophandle,
58  void *clientdata,
59  int status,
60  const char *opdata,
61  size_t opdatalen);
62 
69 SOMAPI_CDECL const char *SOMError (int error);
70 
76 SOMAPI_CDECL void SOMSetService(struct SOMSession *session,
77  const char *service);
78 
84 SOMAPI_CDECL int SOMSessionAuthenticated(struct SOMSession *session);
85 
97 SOMAPI_CDECL int SOMInit (int version);
98 
114 /* Create a Session object which can be used in a multithreaded,
115  * single-SOM-session-per-thread, synchronous, manner */
116 #define SOM_FACILITY_MULTITHREADED (32)
117 
118 SOMAPI_CDECL int SOMSessionCreate (int facilities,
119  void *clientdata,
120  struct SOMSession **session);
121 
137 SOMAPI_CDECL int SOMEventPoll (int dispatch, int timeout);
138 
154 SOMAPI_CDECL int SOMEventPollSingle (struct SOMSession *sp, int dispatch, int timeout);
155 
178 SOMAPI_CDECL int SOMSessionSetTLS (struct SOMSession *session,
179  const char *identity,
180  const char *passphrase);
181 
193 SOMAPI_CDECL int SOMSessionSetSessionCallback (struct SOMSession *session,
194  SOMSessionCallback *callback,
195  SOMSessionCallback **oldvalue);
196 
220 SOMAPI_CDECL int SOMSessionOpen (struct SOMSession *session,
221  const char *host,
222  int port,
223  const char *username,
224  const char *password,
225  void *ophandle,
226  int async);
227 
228 
229 
256 SOMAPI_CDECL int SOMSessionOpenMech (struct SOMSession *session,
257  const char *host,
258  int port,
259  const char *username,
260  const char *passwd,
261  void *ophandle,
262  int async,
263  const char *mech);
272 SOMAPI_CDECL int SOMSessionClose (struct SOMSession *sp);
273 
274 
286 SOMAPI_CDECL int SOMSessionDelete (struct SOMSession *session);
287 
288 
289 
301 SOMAPI_CDECL int SOMSessionClear (struct SOMSession *session,
302  int facilities);
303 
304 /* \} */
305 
306 #endif /* _SOM_SESSION_H */
int SOMSessionOpen(struct SOMSession *session, const char *host, int port, const char *username, const char *password, void *ophandle, int async)
Open a session to the MTA.
int SOMInit(int version)
Return string for error code.
Switch Operation Management Interface.
int SOMSessionDelete(struct SOMSession *session)
Delete a session.
int SOMEventPoll(int dispatch, int timeout)
Poll for asynchronous events on all open sessions.
int SOMEventPollSingle(struct SOMSession *sp, int dispatch, int timeout)
Poll for asynchronous events on a single Session.
void SOMSetService(struct SOMSession *session, const char *service)
Set the service name - defaults to "som".
Opaque session data.
int SOMSessionSetTLS(struct SOMSession *session, const char *identity, const char *passphrase)
Enable use of TLS/SSL for the session.
int SOMSessionOpenMech(struct SOMSession *session, const char *host, int port, const char *username, const char *passwd, void *ophandle, int async, const char *mech)
Open a session to the MTA, specifying the SASL mechanism to be used.
int SOMSessionSetSessionCallback(struct SOMSession *session, SOMSessionCallback *callback, SOMSessionCallback **oldvalue)
Set the session callback function for this session.
int SOMSessionAuthenticated(struct SOMSession *session)
Return TRUE if session authenticated, FALSE otherwise.
const char * SOMError(int error)
Return string for error code.
void SOMSessionCallback(struct SOMSession *session, void *ophandle, void *clientdata, int status, const char *opdata, size_t opdatalen)
Prototype for callback for session operation completion.
Definition: session.h:56
int SOMSessionClose(struct SOMSession *sp)
Close a X400 Session.
int SOMSessionClear(struct SOMSession *session, int facilities)
Clear all subordinate objects.