Aw
view release on metacpan or search on metacpan
xs/Aw/Admin.xs view on Meta::CPAN
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <awadapter.h>
#include <aweb.h>
#include <adapter_log.h>
#if ( AW_VERSION_31 || AW_VERSION_40 )
# include <adapter_sessions.h>
#endif /* ( AW_VERSION_31 || AW_VERSION_40 ) */
#include <awfilter.h>
/* Theses are required only for the constant routine */
#include "messages.h"
#include <awlicense.h>
/* includes for Admin.xs */
#include <admin/awadmin.h>
#include <admin/awaccess.h>
#include <admin/awetadm.h>
#include <admin/awlog.h>
#include <admin/awserver.h>
/* includes for Aw.xs */
#include <awxs.h>
#include <awxs.m>
#include <awxs.def>
#include <admin/adminxs.h>
#include <admin/adminxs.m>
#include <admin/adminxs.def>
#include "Av_CharPtrPtr.h"
#include "exttypes.h"
#include "Util.h"
#include "HashToTypeDef.h"
typedef HV * Aw__Info;
BrokerError gErr = AW_NO_ERROR;
char * gErrMsg = NULL;
int gErrCode = 0;
awaBool gWarn = awaFalse;
SV * getBrokerClientSessions ( BrokerClientSession * sessions, int num_sessions );
void BrokerServerConnectionCallbackFunc ( BrokerServerClient cbClient, int connect_status, void * vcb );
static int
not_here(char *s)
{
croak("%s not implemented on this architecture", s);
return -1;
}
static double
constant(char *name, int arg)
{
errno = 0;
switch (*name) {
case 'A':
if (strEQ(name, "AW_AUTH_TYPE_NONE"))
#ifdef AW_AUTH_TYPE_NONE
return AW_AUTH_TYPE_NONE;
#else
goto not_there;
#endif
if (strEQ(name, "AW_AUTH_TYPE_SSL"))
#ifdef AW_AUTH_TYPE_SSL
return AW_AUTH_TYPE_SSL;
#else
goto not_there;
#endif
if (strEQ(name, "AW_LIFECYCLE_DESTROY_ON_DISCONNECT"))
#ifdef AW_LIFECYCLE_DESTROY_ON_DISCONNECT
return AW_LIFECYCLE_DESTROY_ON_DISCONNECT;
#else
goto not_there;
#endif
if (strEQ(name, "AW_LIFECYCLE_EXPLICIT_DESTROY"))
#ifdef AW_LIFECYCLE_EXPLICIT_DESTROY
return AW_LIFECYCLE_EXPLICIT_DESTROY;
#else
goto not_there;
#endif
if (strEQ(name, "AW_SERVER_LOG_ALL_ENTRIES"))
#ifdef AW_SERVER_LOG_ALL_ENTRIES
return AW_SERVER_LOG_ALL_ENTRIES;
#else
goto not_there;
#endif
if (strEQ(name, "AW_SERVER_LOG_MESSAGE_ALERT"))
#ifdef AW_SERVER_LOG_MESSAGE_ALERT
return AW_SERVER_LOG_MESSAGE_ALERT;
#else
goto not_there;
#endif
if (strEQ(name, "AW_SERVER_LOG_MESSAGE_INFO"))
#ifdef AW_SERVER_LOG_MESSAGE_INFO
return AW_SERVER_LOG_MESSAGE_INFO;
#else
goto not_there;
#endif
if (strEQ(name, "AW_SERVER_LOG_MESSAGE_UNKNOWN"))
#ifdef AW_SERVER_LOG_MESSAGE_UNKNOWN
return AW_SERVER_LOG_MESSAGE_UNKNOWN;
#else
goto not_there;
#endif
if (strEQ(name, "AW_SERVER_LOG_MESSAGE_WARNING"))
#ifdef AW_SERVER_LOG_MESSAGE_WARNING
return AW_SERVER_LOG_MESSAGE_WARNING;
#else
goto not_there;
#endif
if (strEQ(name, "AW_SERVER_STATUS_ERROR"))
#ifdef AW_SERVER_STATUS_ERROR
return AW_SERVER_STATUS_ERROR;
#else
goto not_there;
#endif
if (strEQ(name, "AW_SERVER_STATUS_RUNNING"))
#ifdef AW_SERVER_STATUS_RUNNING
return AW_SERVER_STATUS_RUNNING;
#else
goto not_there;
#endif
if (strEQ(name, "AW_SERVER_STATUS_STARTING"))
#ifdef AW_SERVER_STATUS_STARTING
return AW_SERVER_STATUS_STARTING;
#else
goto not_there;
#endif
if (strEQ(name, "AW_SERVER_STATUS_STOPPED"))
#ifdef AW_SERVER_STATUS_STOPPED
return AW_SERVER_STATUS_STOPPED;
#else
goto not_there;
#endif
if (strEQ(name, "AW_SERVER_STATUS_STOPPING"))
#ifdef AW_SERVER_STATUS_STOPPING
return AW_SERVER_STATUS_STOPPING;
#else
goto not_there;
#endif
if (strEQ(name, "AW_SSL_STATUS_DISABLED"))
#ifdef AW_SSL_STATUS_DISABLED
return AW_SSL_STATUS_DISABLED;
#else
goto not_there;
#endif
if (strEQ(name, "AW_SSL_STATUS_ENABLED"))
#ifdef AW_SSL_STATUS_ENABLED
return AW_SSL_STATUS_ENABLED;
#else
goto not_there;
#endif
if (strEQ(name, "AW_SSL_STATUS_ERROR"))
#ifdef AW_SSL_STATUS_ERROR
return AW_SSL_STATUS_ERROR;
#else
goto not_there;
#endif
if (strEQ(name, "AW_SSL_STATUS_NOT_SUPPORTED"))
#ifdef AW_SSL_STATUS_NOT_SUPPORTED
return AW_SSL_STATUS_NOT_SUPPORTED;
#else
goto not_there;
#endif
if (strEQ(name, "AW_TRACE_BROKER_ADDED"))
#ifdef AW_TRACE_BROKER_ADDED
return AW_TRACE_BROKER_ADDED;
#else
goto not_there;
#endif
if (strEQ(name, "AW_TRACE_BROKER_REMOVED"))
#ifdef AW_TRACE_BROKER_REMOVED
return AW_TRACE_BROKER_REMOVED;
#else
goto not_there;
#endif
if (strEQ(name, "AW_TRACE_CLIENT_CONNECT"))
#ifdef AW_TRACE_CLIENT_CONNECT
return AW_TRACE_CLIENT_CONNECT;
#else
goto not_there;
#endif
if (strEQ(name, "AW_TRACE_CLIENT_CREATE"))
#ifdef AW_TRACE_CLIENT_CREATE
return AW_TRACE_CLIENT_CREATE;
#else
goto not_there;
#endif
if (strEQ(name, "AW_TRACE_CLIENT_DESTROY"))
#ifdef AW_TRACE_CLIENT_DESTROY
return AW_TRACE_CLIENT_DESTROY;
#else
goto not_there;
#endif
if (strEQ(name, "AW_TRACE_CLIENT_DISCONNECT"))
#ifdef AW_TRACE_CLIENT_DISCONNECT
return AW_TRACE_CLIENT_DISCONNECT;
#else
goto not_there;
#endif
if (strEQ(name, "AW_TRACE_EVENT_DROP"))
#ifdef AW_TRACE_EVENT_DROP
return AW_TRACE_EVENT_DROP;
#else
goto not_there;
#endif
if (strEQ(name, "AW_TRACE_EVENT_ENQUEUE"))
#ifdef AW_TRACE_EVENT_ENQUEUE
return AW_TRACE_EVENT_ENQUEUE;
#else
goto not_there;
#endif
if (strEQ(name, "AW_TRACE_EVENT_PUBLISH"))
#ifdef AW_TRACE_EVENT_PUBLISH
return AW_TRACE_EVENT_PUBLISH;
#else
goto not_there;
#endif
if (strEQ(name, "AW_TRACE_EVENT_RECEIVE"))
#ifdef AW_TRACE_EVENT_RECEIVE
return AW_TRACE_EVENT_RECEIVE;
#else
goto not_there;
#endif
if (strEQ(name, "AW_TRACE_OTHER"))
#ifdef AW_TRACE_OTHER
return AW_TRACE_OTHER;
#else
goto not_there;
#endif
break;
case 'B':
break;
case 'C':
break;
case 'D':
break;
case 'E':
break;
case 'F':
break;
case 'G':
break;
case 'H':
break;
case 'I':
break;
case 'J':
break;
case 'K':
break;
case 'L':
break;
case 'M':
break;
case 'N':
break;
case 'O':
break;
case 'P':
break;
case 'Q':
break;
case 'R':
break;
case 'S':
break;
case 'T':
break;
case 'U':
break;
case 'V':
break;
case 'W':
break;
case 'X':
break;
case 'Y':
break;
case 'Z':
break;
}
errno = EINVAL;
return 0;
not_there:
errno = ENOENT;
return 0;
}
SV *
getBrokerClientSessions ( BrokerClientSession * sessions, int num_sessions )
{
AV * av;
HV * hv;
SV * sv;
int i;
av = newAV();
for ( i = 0; i < num_sessions ; i++ ) {
hv = newHV();
hv_store ( hv, "session_id", 10, newSViv ( (int)sessions[i].session_id ), 0 );
hv_store ( hv, "connection_id", 13, newSViv ( (int)sessions[i].connection_id ), 0 );
// why the hell did this start SIGBUSing?
// sv_setuv_mg ( sv, (UV)sessions[i].ip_address );
// hv_store ( hv, "ip_address", 10, sv, 0 );
hv_store ( hv, "ip_address", 10, newSViv( (unsigned int)sessions[i].ip_address ), 0 );
hv_store ( hv, "port", 4, newSViv ( (int)sessions[i].port ), 0 );
hv_store ( hv, "encrypt_level", 13, newSViv ( (int)sessions[i].encrypt_level ), 0 );
hv_store ( hv, "num_platform_info", 17, newSViv ( (int)sessions[i].num_platform_info ), 0 );
if ( sessions[i].encrypt_protocol != NULL )
hv_store ( hv, "encrypt_protocol", 16, newSVpv ( (char *)sessions[i].encrypt_protocol, 0 ), 0 );
if ( sessions[i].encrypt_version != NULL )
hv_store ( hv, "encrypt_version", 15, newSVpv ( (char *)sessions[i].encrypt_version, 0 ), 0 );
if ( sessions[i].auth_protocol != NULL )
hv_store ( hv, "auth_protocol", 13, newSVpv ( (char *)sessions[i].auth_protocol, 0 ), 0 );
if ( sessions[i].auth_version != NULL )
hv_store ( hv, "auth_version", 12, newSVpv ( (char *)sessions[i].auth_version, 0 ), 0 );
/* if ( sessions[i].ssl_certificate.serial_number != NULL ) { segfaults */
if ( sessions[i].ssl_certificate.begin_date.year ) {
sv = sv_newmortal();
SvREFCNT_inc(sv);
sv_setref_pv( sv, "Aw::SSLCertificate", (void*)&sessions[i].ssl_certificate );
hv_store ( hv, "ssl_certificate", 15, sv, 0 );
}
sv = sv_newmortal();
SvREFCNT_inc(sv);
sv_setref_pv( sv, "Aw::Date", (void*)awCopyDate(&sessions[i].connect_time) );
hv_store ( hv, "connect_time", 12, sv, 0 );
sv = sv_newmortal();
SvREFCNT_inc(sv);
sv_setref_pv( sv, "Aw::Date", (void*)awCopyDate(&sessions[i].create_time) );
hv_store ( hv, "create_time", 11, sv, 0 );
( run in 1.291 second using v1.01-cache-2.11-cpan-97f6503c9c8 )