Chapter 3 Protocol Level Plug-in API Reference This chapter is a reference to Protocol Level Plug-in API functions, data structures, macros, and result codes. The chapter has the following sections:
This chapter is a reference to Protocol Level Plug-in API functions, data structures, macros, and result codes.
Functions
Return Values for Functions
Access Macros
Data Structures
Plug-in Result Codes
#include <protplug.h>int PPModule_Init(ProtPlugSystem *pSys);
#include <protplug.h> void PPModule_Exit(void);
#include <protplug.h>ProtPlug *PPModule_NewProtPlug(PPSession *ps);
#include <protplug.h>int ProtPlug_ProcessLine(ProtPlug *ppp, char *pszLine, char **ppszResp);
#include <protplug.h>void ProtPlug_Delete(ProtPlug *ppp);
#include <protplug.h>PPSESSION_DEFERLINE(p,l,r) ((PPSessionActions *)(p))->DeferLine((p),(l),(r))
#include <protplug.h>PPSESSION_GETPROPERTY(p,k,d) (((PPSessionActions *)(p))->GetProperty((p),(k),(d)))
#include <protplug.h>typedef struct PPMutexStruct PPMutex;
PPMutex *(*PPMutex_New)(void);
void (*PPMutex_Lock)(PPMutex *pm);
void (*PPMutex_Unlock)(PPMutex *pm);
void (*PPMutex_Delete)(PPMutex *pm);
See Also ProtPlugSystem
#include <protplug.h>typedef struct PPSessionStruct PPSession;
struct ProtPlugSystem { int iSomeCount; /* counter used by the plug-in */ PPSession *pMySession; /* ptr to current session handle */ char *pszMyPeerAddress; /* buffer for the client address */ char *pszResp; /* response buffer */ };
#include <protplug.h>typedef struct PPSessionActionsStruct{ int (*DeferLine) (PPSession *ps, char *pszLine, char **ppszResp); char *(*GetProperty) (PPSession *ps, char *pszKey, char *pszDefault);} PPSessionActions;
int (*DeferLine) PPSession *ps, char *pszLine, char **ppszResp);
char *(*GetProperty) (PPSession *ps, char *pszKey, char *pszDefault);
For more information, see "The PPSessionActions Structure" and "Using Macros."
#include <protplug.h>typedef struct ProtPlugSystemStruct { void *(*PPRealloc)(void *pOld, int nSize); /* all memory comes from here */ PPMutex *(*PPMutex_New)(void); void (*PPMutex_Lock)(PPMutex *pm); void (*PPMutex_Unlock)(PPMutex *pm); void (*PPMutex_Delete)(PPMutex *pm); char *(*PPGetIni)(char *pszKey, char *pszDefault, char *pszResult, int nResultSize); void (*PPLogPrintf)(char *pszFormat,...); struct in_addr (*PPGetHostByName)(char *pszName); char *(*PPGetHostByAddr)(struct in_addr ina, char *pBuf, int nBufSize);} ProtPlugSystem;
char *(*PPRealloc) (char *pOld, int nSize);
char *(*PPGetIni) (char *pszKey, char *pszDefault, char *pszResult, int nResultSize);
char *(*PPLogPrintf) (char *pszFormat,...);
struct in_addr (*PPGetHostByName) (char *pszName);
char *(*PPGetHostByAddr) (struct in_addr ina, char *pBuf, int nBufSize);
Allocate, reallocate, and free all memory used by the plug-in through the PPRealloc function.
Perform thread synchronization through the PPMutex functions. For more information, see PPMutex.
Get basic server configuration information in Directory Server or the local config.db through the PPGetIni function, for example, service.smtp.smtp-accept.minruncount. To see a list of configuration value keys you can use, run configutil.
Write to the SMTP server log through the PPLogPrintf function.
Provide basic name resolution through the PPGetHostByName and PPGetHostByAddr functions.
#include <protplug.h>typedef struct ProtPlugStruct ProtPlug;