Synesis Software STLSoft - ... Robust, Lightweight, Cross-platform, Template Software ...

pantheios/backends/bec.WindowsSyslog.h

Go to the documentation of this file.
00001 /* /////////////////////////////////////////////////////////////////////////
00002  * File:        pantheios/backends/bec.WindowsSyslog.h
00003  *
00004  * Purpose:     Declaration of the Pantheios Windows-SysLog Stock Back-end API.
00005  *
00006  * Created:     23rd September 2005
00007  * Updated:     30th April 2010
00008  *
00009  * Home:        http://www.pantheios.org/
00010  *
00011  * Copyright (c) 2005-2010, Matthew Wilson and Synesis Software
00012  * All rights reserved.
00013  *
00014  * Redistribution and use in source and binary forms, with or without
00015  * modification, are permitted provided that the following conditions are
00016  * met:
00017  *
00018  * - Redistributions of source code must retain the above copyright notice,
00019  *   this list of conditions and the following disclaimer.
00020  * - Redistributions in binary form must reproduce the above copyright
00021  *   notice, this list of conditions and the following disclaimer in the
00022  *   documentation and/or other materials provided with the distribution.
00023  * - Neither the name(s) of Matthew Wilson and Synesis Software nor the
00024  *   names of any contributors may be used to endorse or promote products
00025  *   derived from this software without specific prior written permission.
00026  *
00027  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
00028  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
00029  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00030  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
00031  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00032  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00033  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00034  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00035  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00036  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00037  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00038  *
00039  * ////////////////////////////////////////////////////////////////////// */
00040 
00041 
00047 #ifndef PANTHEIOS_INCL_PANTHEIOS_BACKENDS_H_BEC_WINDOWSSYSLOG
00048 #define PANTHEIOS_INCL_PANTHEIOS_BACKENDS_H_BEC_WINDOWSSYSLOG
00049 
00050 /* /////////////////////////////////////////////////////////////////////////
00051  * Version information
00052  */
00053 
00054 #ifndef PANTHEIOS_DOCUMENTATION_SKIP_SECTION
00055 # define PANTHEIOS_VER_PANTHEIOS_BACKENDS_H_BEC_WINDOWSSYSLOG_MAJOR     4
00056 # define PANTHEIOS_VER_PANTHEIOS_BACKENDS_H_BEC_WINDOWSSYSLOG_MINOR     1
00057 # define PANTHEIOS_VER_PANTHEIOS_BACKENDS_H_BEC_WINDOWSSYSLOG_REVISION  2
00058 # define PANTHEIOS_VER_PANTHEIOS_BACKENDS_H_BEC_WINDOWSSYSLOG_EDIT      22
00059 #endif /* !PANTHEIOS_DOCUMENTATION_SKIP_SECTION */
00060 
00061 /* /////////////////////////////////////////////////////////////////////////
00062  * Includes
00063  */
00064 
00065 #ifndef PANTHEIOS_INCL_PANTHEIOS_H_PANTHEIOS
00066 # include <pantheios/pantheios.h>
00067 #endif /* !PANTHEIOS_INCL_PANTHEIOS_H_PANTHEIOS */
00068 #ifndef PANTHEIOS_INCL_PANTHEIOS_H_BACKEND
00069 # include <pantheios/backend.h>
00070 #endif /* !PANTHEIOS_INCL_PANTHEIOS_H_BACKEND */
00071 
00072 /* /////////////////////////////////////////////////////////////////////////
00073  * Documentation
00074  */
00075 
00082 /* /////////////////////////////////////////////////////////////////////////
00083  * Constants
00084  */
00085 
00097 #define PANTHEIOS_BE_WINDOWSSYSLOG_F_USE_SYSTEM_TIME  PANTHEIOS_BE_INIT_F_USE_SYSTEM_TIME
00098 
00099 
00110 #define PANTHEIOS_BE_WINDOWSSYSLOG_F_PERROR    (0x00100000)
00111 
00122 #define PANTHEIOS_BE_WINDOWSSYSLOG_F_CONS      (0x00200000)
00123 
00133 #define PANTHEIOS_BE_WINDOWSSYSLOG_F_PID       (0x00400000)
00134 
00145 #define PANTHEIOS_BE_WINDOWSSYSLOG_F_NDELAY    (0x00800000)
00146 
00147 
00148 
00159 #ifdef LOG_KERN
00160 # define PANTHEIOS_SYSLOG_FAC_KERN          LOG_KERN
00161 #else /* ? LOG_KERN */
00162 # define PANTHEIOS_SYSLOG_FAC_KERN          (0)
00163 #endif /* LOG_KERN */
00164 
00170 #ifdef LOG_USER
00171 # define PANTHEIOS_SYSLOG_FAC_USER          LOG_USER
00172 #else /* ? LOG_USER */
00173 # define PANTHEIOS_SYSLOG_FAC_USER          (1)
00174 #endif /* LOG_USER */
00175 
00181 #ifdef LOG_MAIL
00182 # define PANTHEIOS_SYSLOG_FAC_MAIL          LOG_MAIL
00183 #else /* ? LOG_MAIL */
00184 # define PANTHEIOS_SYSLOG_FAC_MAIL          (2)
00185 #endif /* LOG_MAIL */
00186 
00192 #ifdef LOG_DAEMON
00193 # define PANTHEIOS_SYSLOG_FAC_DAEMON        LOG_DAEMON
00194 #else /* ? LOG_DAEMON */
00195 # define PANTHEIOS_SYSLOG_FAC_DAEMON        (3)
00196 #endif /* LOG_DAEMON */
00197 
00203 #ifdef LOG_AUTH
00204 # define PANTHEIOS_SYSLOG_FAC_AUTH          LOG_AUTH
00205 #else /* ? LOG_AUTH */
00206 # define PANTHEIOS_SYSLOG_FAC_AUTH          (4)
00207 #endif /* LOG_AUTH */
00208 
00214 #ifdef LOG_SYSLOG
00215 # define PANTHEIOS_SYSLOG_FAC_SYSLOG        LOG_SYSLOG
00216 #else /* ? LOG_SYSLOG */
00217 # define PANTHEIOS_SYSLOG_FAC_SYSLOG        (5)
00218 #endif /* LOG_SYSLOG */
00219 
00225 #ifdef LOG_LPR
00226 # define PANTHEIOS_SYSLOG_FAC_LPR           LOG_LPR
00227 #else /* ? LOG_LPR */
00228 # define PANTHEIOS_SYSLOG_FAC_LPR           (6)
00229 #endif /* LOG_LPR */
00230 
00236 #ifdef LOG_NEWS
00237 # define PANTHEIOS_SYSLOG_FAC_NEWS          LOG_NEWS
00238 #else /* ? LOG_NEWS */
00239 # define PANTHEIOS_SYSLOG_FAC_NEWS          (7)
00240 #endif /* LOG_NEWS */
00241 
00247 #ifdef LOG_UUCP
00248 # define PANTHEIOS_SYSLOG_FAC_UUCP          LOG_UUCP
00249 #else /* ? LOG_UUCP */
00250 # define PANTHEIOS_SYSLOG_FAC_UUCP          (8)
00251 #endif /* LOG_UUCP */
00252 
00258 #ifdef LOG_CRON
00259 # define PANTHEIOS_SYSLOG_FAC_CRON      LOG_CRON
00260 #else /* ? LOG_CRON */
00261 # define PANTHEIOS_SYSLOG_FAC_CRON      (9)
00262 #endif /* LOG_CRON */
00263 
00269 #ifdef LOG_AUTHPRIV
00270 # define PANTHEIOS_SYSLOG_FAC_AUTHPRIV      LOG_AUTHPRIV
00271 #else /* ? LOG_AUTHPRIV */
00272 # define PANTHEIOS_SYSLOG_FAC_AUTHPRIV      (10)
00273 #endif /* LOG_AUTHPRIV */
00274 
00280 #ifdef LOG_FTP
00281 # define PANTHEIOS_SYSLOG_FAC_FTP           LOG_FTP
00282 #else /* ? LOG_FTP */
00283 # define PANTHEIOS_SYSLOG_FAC_FTP           (11)
00284 #endif /* LOG_FTP */
00285 
00291 #ifdef LOG_NETINFO
00292 # define PANTHEIOS_SYSLOG_FAC_NETINFO       LOG_NETINFO
00293 #else /* ? LOG_NETINFO */
00294 # define PANTHEIOS_SYSLOG_FAC_NETINFO       (12)
00295 #endif /* LOG_NETINFO */
00296 
00302 #ifdef LOG_REMOTEAUTH
00303 # define PANTHEIOS_SYSLOG_FAC_REMOTEAUTH    LOG_REMOTEAUTH
00304 #else /* ? LOG_REMOTEAUTH */
00305 # define PANTHEIOS_SYSLOG_FAC_REMOTEAUTH    (13)
00306 #endif /* LOG_REMOTEAUTH */
00307 
00313 #ifdef LOG_INSTALL
00314 # define PANTHEIOS_SYSLOG_FAC_INSTALL       LOG_INSTALL
00315 #else /* ? LOG_INSTALL */
00316 # define PANTHEIOS_SYSLOG_FAC_INSTALL       (14)
00317 #endif /* LOG_INSTALL */
00318 
00324 #ifdef LOG_RAS
00325 # define PANTHEIOS_SYSLOG_FAC_RAS           LOG_RAS
00326 #else /* ? LOG_RAS */
00327 # define PANTHEIOS_SYSLOG_FAC_RAS           (15)
00328 #endif /* LOG_RAS */
00329 
00335 #ifdef LOG_LOCAL0
00336 # define PANTHEIOS_SYSLOG_FAC_LOCAL0        LOG_LOCAL0
00337 #else /* ? LOG_LOCAL0 */
00338 # define PANTHEIOS_SYSLOG_FAC_LOCAL0        (16)
00339 #endif /* LOG_LOCAL0 */
00340 
00346 #ifdef LOG_LOCAL1
00347 # define PANTHEIOS_SYSLOG_FAC_LOCAL1        LOG_LOCAL1
00348 #else /* ? LOG_LOCAL1 */
00349 # define PANTHEIOS_SYSLOG_FAC_LOCAL1        (17)
00350 #endif /* LOG_LOCAL1 */
00351 
00357 #ifdef LOG_LOCAL2
00358 # define PANTHEIOS_SYSLOG_FAC_LOCAL2        LOG_LOCAL2
00359 #else /* ? LOG_LOCAL2 */
00360 # define PANTHEIOS_SYSLOG_FAC_LOCAL2        (18)
00361 #endif /* LOG_LOCAL2 */
00362 
00368 #ifdef LOG_LOCAL3
00369 # define PANTHEIOS_SYSLOG_FAC_LOCAL3        LOG_LOCAL3
00370 #else /* ? LOG_LOCAL3 */
00371 # define PANTHEIOS_SYSLOG_FAC_LOCAL3        (19)
00372 #endif /* LOG_LOCAL3 */
00373 
00379 #ifdef LOG_LOCAL4
00380 # define PANTHEIOS_SYSLOG_FAC_LOCAL4        LOG_LOCAL4
00381 #else /* ? LOG_LOCAL4 */
00382 # define PANTHEIOS_SYSLOG_FAC_LOCAL4        (20)
00383 #endif /* LOG_LOCAL4 */
00384 
00390 #ifdef LOG_LOCAL5
00391 # define PANTHEIOS_SYSLOG_FAC_LOCAL5        LOG_LOCAL5
00392 #else /* ? LOG_LOCAL5 */
00393 # define PANTHEIOS_SYSLOG_FAC_LOCAL5        (21)
00394 #endif /* LOG_LOCAL5 */
00395 
00401 #ifdef LOG_LOCAL6
00402 # define PANTHEIOS_SYSLOG_FAC_LOCAL6        LOG_LOCAL6
00403 #else /* ? LOG_LOCAL6 */
00404 # define PANTHEIOS_SYSLOG_FAC_LOCAL6        (22)
00405 #endif /* LOG_LOCAL6 */
00406 
00412 #ifdef LOG_LOCAL7
00413 # define PANTHEIOS_SYSLOG_FAC_LOCAL7        LOG_LOCAL7
00414 #else /* ? LOG_LOCAL7 */
00415 # define PANTHEIOS_SYSLOG_FAC_LOCAL7        (23)
00416 #endif /* LOG_LOCAL7 */
00417 
00423 #ifdef LOG_LAUNCHD
00424 # define PANTHEIOS_SYSLOG_FAC_LAUNCHD       LOG_LAUNCHD
00425 #else /* ? LOG_LAUNCHD */
00426 # define PANTHEIOS_SYSLOG_FAC_LAUNCHD       (24)
00427 #endif /* LOG_LAUNCHD */
00428 
00429 /* /////////////////////////////////////////////////////////////////////////
00430  * Typedefs
00431  */
00432 
00437 struct pan_be_WindowsSyslog_init_t
00438 {
00439 #if !defined(PANTHEIOS_DOCUMENTATION_SKIP_SECTION) && \
00440     !defined(PANTHEIOS_NO_NAMESPACE)
00441     typedef pantheios::pan_uint8_t  pan_uint8_t;
00442     typedef pantheios::pan_uint16_t pan_uint16_t;
00443     typedef pantheios::pan_uint32_t pan_uint32_t;
00444 #endif /* !PANTHEIOS_DOCUMENTATION_SKIP_SECTION && !PANTHEIOS_NO_NAMESPACE */
00445 
00446     pan_uint32_t    version;    
00447     pan_uint32_t    flags;      
00448     size_t          addrSize;   
00449     pan_uint8_t     bytes[16];  
00450     char const*     hostName;   
00451     pan_uint16_t    port;       
00452     pan_uint8_t     facility;   
00453     char            hostNameBuff[101]; 
00455 #ifdef __cplusplus
00456 public: /* Construction */
00457 # ifndef PANTHEIOS_BE_INIT_NO_CPP_STRUCT_INIT
00458     pan_be_WindowsSyslog_init_t();
00459 # endif /* !PANTHEIOS_BE_INIT_NO_CPP_STRUCT_INIT */
00460 #endif /* __cplusplus */
00461 };
00462 #if !defined(__cplusplus)
00463 typedef struct pan_be_WindowsSyslog_init_t    pan_be_WindowsSyslog_init_t;
00464 #endif /* !__cplusplus */
00465 
00466 
00467 /* /////////////////////////////////////////////////////////////////////////
00468  * Application-defined functions
00469  */
00470 
00480 PANTHEIOS_CALL(void) pantheios_be_WindowsSyslog_getAppInit(
00481     int                             backEndId
00482 ,   pan_be_WindowsSyslog_init_t*    init
00483 ) /* throw() */;
00484 
00485 /* /////////////////////////////////////////////////////////////////////////
00486  * API
00487  */
00488 
00501 PANTHEIOS_CALL(void) pantheios_be_WindowsSyslog_getDefaultAppInit(
00502     pan_be_WindowsSyslog_init_t* init
00503 ) /* throw() */;
00504 
00517 PANTHEIOS_CALL(int) pantheios_be_WindowsSyslog_init(
00518     PAN_CHAR_T const*                   processIdentity
00519 ,   int                                 id
00520 ,   pan_be_WindowsSyslog_init_t const*  init
00521 ,   void*                               reserved
00522 ,   void**                              ptoken
00523 );
00524 
00528 PANTHEIOS_CALL(void) pantheios_be_WindowsSyslog_uninit(
00529     void* token
00530 );
00531 
00535 PANTHEIOS_CALL(int) pantheios_be_WindowsSyslog_logEntry(
00536     void*               feToken
00537 ,   void*               beToken
00538 ,   int                 severity
00539 ,   PAN_CHAR_T const*   entry
00540 ,   size_t              cchEntry
00541 );
00542 
00573 PANTHEIOS_CALL(int) pantheios_be_WindowsSyslog_parseArgs(
00574     size_t                          numArgs
00575 #ifdef PANTHEIOS_NO_NAMESPACE
00576 ,   struct pan_slice_t* const       args
00577 #else /* ? PANTHEIOS_NO_NAMESPACE */
00578 ,   pantheios::pan_slice_t* const   args
00579 #endif /* PANTHEIOS_NO_NAMESPACE */
00580 ,   pan_be_WindowsSyslog_init_t*    init
00581 );
00582 
00583 /* ////////////////////////////////////////////////////////////////////// */
00584 
00585 #ifdef __cplusplus
00586 # ifndef PANTHEIOS_BE_INIT_NO_CPP_STRUCT_INIT
00587 inline pan_be_WindowsSyslog_init_t::pan_be_WindowsSyslog_init_t()
00588 {
00589     pantheios_be_WindowsSyslog_getDefaultAppInit(this);
00590 }
00591 # endif /* !PANTHEIOS_BE_INIT_NO_CPP_STRUCT_INIT */
00592 #endif /* __cplusplus */
00593 
00594 /* ////////////////////////////////////////////////////////////////////// */
00595 
00596 #endif /* PANTHEIOS_INCL_PANTHEIOS_BACKENDS_H_BEC_WINDOWSSYSLOG */
00597 
00598 /* ///////////////////////////// end of file //////////////////////////// */

pantheios Library documentation © Matthew Wilson & Synesis Software, 2006-2011 SourceForge.net Logo