Exemple #1
0
#include <ulib/net/client/client.h>
#include <ulib/net/server/server.h>

bool  UClient_Base::log_shared_with_server;
ULog* UClient_Base::log;

const UString* UClient_Base::str_RES_TIMEOUT;

void UClient_Base::str_allocate()
{
   U_TRACE(0, "UClient_Base::str_allocate()")

   U_INTERNAL_ASSERT_EQUALS(str_RES_TIMEOUT,0)

   static ustringrep stringrep_storage[] = {
      { U_STRINGREP_FROM_CONSTANT("RES_TIMEOUT") }
   };

   U_NEW_ULIB_OBJECT(str_RES_TIMEOUT, U_STRING_FROM_STRINGREP_STORAGE(0));
}

UClient_Base::UClient_Base() : response(U_CAPACITY), buffer(U_CAPACITY), host_port(100U), logbuf(100U)
{
   U_TRACE_REGISTER_OBJECT(0, UClient_Base, "")

   bIPv6     = false;
   port      = verify_mode = 0;
   timeoutMS = U_TIMEOUT_MS;
}

UClient_Base::UClient_Base(UFileConfig* cfg) : response(U_CAPACITY), buffer(U_CAPACITY), host_port(100U), logbuf(100U)
Exemple #2
0
const char*  UGeoIPPlugIn::org;
const char*  UGeoIPPlugIn::country_code;
const char*  UGeoIPPlugIn::country_name;
GeoIPRecord* UGeoIPPlugIn::gir;
GeoIPRegion* UGeoIPPlugIn::region;

const UString* UGeoIPPlugIn::str_COUNTRY_FORBIDDEN_MASK;

void UGeoIPPlugIn::str_allocate()
{
   U_TRACE(0, "UGeoIPPlugIn::str_allocate()")

   U_INTERNAL_ASSERT_EQUALS(str_COUNTRY_FORBIDDEN_MASK,0)

   static ustringrep stringrep_storage[] = {
      { U_STRINGREP_FROM_CONSTANT("COUNTRY_FORBIDDEN_MASK") }
   };

   U_NEW_ULIB_OBJECT(str_COUNTRY_FORBIDDEN_MASK, U_STRING_FROM_STRINGREP_STORAGE(0));
}

bool UGeoIPPlugIn::setCountryCode()
{
   U_TRACE(1, "UGeoIPPlugIn::setCountryCode()")

   gir = 0;
   region = 0;
   domain_name = 0;
   netspeed = country_id = 0;
   bGEOIP_CITY_EDITION_REV1 = false;
   country_code = country_name = org = 0;
Exemple #3
0
UString* USSIPlugIn::header;
UString* USSIPlugIn::environment;
UString* USSIPlugIn::alternative_include;

const UString* USSIPlugIn::str_cgi;
const UString* USSIPlugIn::str_var;

void USSIPlugIn::str_allocate()
{
   U_TRACE(0, "USSIPlugIn::str_allocate()")

   U_INTERNAL_ASSERT_EQUALS(str_cgi, 0)
   U_INTERNAL_ASSERT_EQUALS(str_var, 0)

   static ustringrep stringrep_storage[] = {
      { U_STRINGREP_FROM_CONSTANT("cgi") },
      { U_STRINGREP_FROM_CONSTANT("var") }
   };

   U_NEW_ULIB_OBJECT(str_cgi, U_STRING_FROM_STRINGREP_STORAGE(0));
   U_NEW_ULIB_OBJECT(str_var, U_STRING_FROM_STRINGREP_STORAGE(1));
}

USSIPlugIn::USSIPlugIn()
{
   U_TRACE_REGISTER_OBJECT_WITHOUT_CHECK_MEMORY(0, USSIPlugIn, "")

   errmsg  = U_NEW(UString);
   timefmt = U_NEW(UString);
   docname = U_NEW(UString);
Exemple #4
0
void USmtpClient::str_allocate()
{
   U_TRACE(0, "USmtpClient::str_allocate()")

   U_INTERNAL_ASSERT_EQUALS(str_empty,0)
   U_INTERNAL_ASSERT_EQUALS(str_address,0)
   U_INTERNAL_ASSERT_EQUALS(str_subject,0)
   U_INTERNAL_ASSERT_EQUALS(str_domainName,0)
   U_INTERNAL_ASSERT_EQUALS(str_TO_ADDRESS,0)
   U_INTERNAL_ASSERT_EQUALS(str_SMTP_SERVER,0)
   U_INTERNAL_ASSERT_EQUALS(str_SENDER_ADDRESS,0)
   U_INTERNAL_ASSERT_EQUALS(str_REPLY_TO_ADDRESS,0)

   static ustringrep stringrep_storage[] = {
      { U_STRINGREP_FROM_CONSTANT("empty") },
      { U_STRINGREP_FROM_CONSTANT("*****@*****.**") },
      { U_STRINGREP_FROM_CONSTANT("(no subject)") },
      { U_STRINGREP_FROM_CONSTANT("somemachine.nowhere.org") },
      { U_STRINGREP_FROM_CONSTANT("TO_ADDRESS") },
      { U_STRINGREP_FROM_CONSTANT("SMTP_SERVER") },
      { U_STRINGREP_FROM_CONSTANT("SENDER_ADDRESS") },
      { U_STRINGREP_FROM_CONSTANT("REPLY_TO_ADDRESS") }
   };

   U_NEW_ULIB_OBJECT(str_empty,            U_STRING_FROM_STRINGREP_STORAGE(0));
   U_NEW_ULIB_OBJECT(str_address,          U_STRING_FROM_STRINGREP_STORAGE(1));
   U_NEW_ULIB_OBJECT(str_subject,          U_STRING_FROM_STRINGREP_STORAGE(2));
   U_NEW_ULIB_OBJECT(str_domainName,       U_STRING_FROM_STRINGREP_STORAGE(3));
   U_NEW_ULIB_OBJECT(str_TO_ADDRESS,       U_STRING_FROM_STRINGREP_STORAGE(4));
   U_NEW_ULIB_OBJECT(str_SMTP_SERVER,      U_STRING_FROM_STRINGREP_STORAGE(5));
U_CREAT_FUNC(orm_driver_sqlite, UOrmDriverSqlite)

const UString* UOrmDriverSqlite::str_name;
const UString* UOrmDriverSqlite::str_dbdir;
const UString* UOrmDriverSqlite::str_memory;

void UOrmDriverSqlite::str_allocate()
{
   U_TRACE(0, "UOrmDriverSqlite::str_allocate()")

   U_INTERNAL_ASSERT_EQUALS(str_name,0)
   U_INTERNAL_ASSERT_EQUALS(str_dbdir,0)
   U_INTERNAL_ASSERT_EQUALS(str_memory,0)

   static ustringrep stringrep_storage[] = {
      { U_STRINGREP_FROM_CONSTANT("sqlite") },
      { U_STRINGREP_FROM_CONSTANT("dbdir") },
      { U_STRINGREP_FROM_CONSTANT(":memory:") },
   };

   U_NEW_ULIB_OBJECT(str_name,   U_STRING_FROM_STRINGREP_STORAGE(0));
   U_NEW_ULIB_OBJECT(str_dbdir,  U_STRING_FROM_STRINGREP_STORAGE(1));
   U_NEW_ULIB_OBJECT(str_memory, U_STRING_FROM_STRINGREP_STORAGE(2));
}

UOrmDriverSqlite::~UOrmDriverSqlite()
{
   U_TRACE_UNREGISTER_OBJECT(0, UOrmDriverSqlite)
}

#undef  ENTRY
Exemple #6
0
const UString* Url::str_https;

void Url::str_allocate()
{
   U_TRACE(0+256, "Url::str_allocate()")

   U_INTERNAL_ASSERT_EQUALS(str_ftp,0)
   U_INTERNAL_ASSERT_EQUALS(str_ldap,0)
   U_INTERNAL_ASSERT_EQUALS(str_ldaps,0)
   U_INTERNAL_ASSERT_EQUALS(str_smtp,0)
   U_INTERNAL_ASSERT_EQUALS(str_pop3,0)
   U_INTERNAL_ASSERT_EQUALS(str_http,0)
   U_INTERNAL_ASSERT_EQUALS(str_https,0)

   static ustringrep stringrep_storage[] = {
      { U_STRINGREP_FROM_CONSTANT("ftp") },
      { U_STRINGREP_FROM_CONSTANT("ldap") },
      { U_STRINGREP_FROM_CONSTANT("ldaps") },
      { U_STRINGREP_FROM_CONSTANT("smtp") },
      { U_STRINGREP_FROM_CONSTANT("pop3") },
      { U_STRINGREP_FROM_CONSTANT("http") },
      { U_STRINGREP_FROM_CONSTANT("https") }
   };

   U_NEW_ULIB_OBJECT(str_ftp,   U_STRING_FROM_STRINGREP_STORAGE(0));
   U_NEW_ULIB_OBJECT(str_ldap,  U_STRING_FROM_STRINGREP_STORAGE(1));
   U_NEW_ULIB_OBJECT(str_ldaps, U_STRING_FROM_STRINGREP_STORAGE(2));
   U_NEW_ULIB_OBJECT(str_smtp,  U_STRING_FROM_STRINGREP_STORAGE(3));
   U_NEW_ULIB_OBJECT(str_pop3,  U_STRING_FROM_STRINGREP_STORAGE(4));
   U_NEW_ULIB_OBJECT(str_http,  U_STRING_FROM_STRINGREP_STORAGE(5));
   U_NEW_ULIB_OBJECT(str_https, U_STRING_FROM_STRINGREP_STORAGE(6));
Exemple #7
0
const UString* UWebSocket::str_websocket_key;
const UString* UWebSocket::str_websocket_prot;

UWebSocket::WebSocketFrameData UWebSocket::control_frame = { 0, 0, 1, 8, 0 };
UWebSocket::WebSocketFrameData UWebSocket::message_frame = { 0, 0, 1, 0, 0 };

void UWebSocket::str_allocate()
{
   U_TRACE(0+256, "UWebSocket::str_allocate()")

   U_INTERNAL_ASSERT_EQUALS(str_frm_websocket,0)
   U_INTERNAL_ASSERT_EQUALS(str_websocket_key,0)
   U_INTERNAL_ASSERT_EQUALS(str_websocket_prot,0)

   static ustringrep stringrep_storage[] = {
      { U_STRINGREP_FROM_CONSTANT("Sec-WebSocket-Key") },
      { U_STRINGREP_FROM_CONSTANT("Sec-WebSocket-Protocol") },
      { U_STRINGREP_FROM_CONSTANT("HTTP/1.1 101 Switching Protocols\r\n"
                                  "Upgrade: websocket\r\n"
                                  "Connection: Upgrade\r\n"
                                  "Sec-WebSocket-Accept: %.*s\r\n"
                                  "%.*s"
                                  "\r\n") }
   };

   U_NEW_ULIB_OBJECT(str_websocket_key,  U_STRING_FROM_STRINGREP_STORAGE(0));
   U_NEW_ULIB_OBJECT(str_websocket_prot, U_STRING_FROM_STRINGREP_STORAGE(1));
   U_NEW_ULIB_OBJECT(str_frm_websocket,  U_STRING_FROM_STRINGREP_STORAGE(2));
}

bool UWebSocket::sendAccept()
Exemple #8
0
void UOrmDriver::str_allocate()
{
   U_TRACE(0, "UOrmDriver::str_allocate()")

   U_INTERNAL_ASSERT_EQUALS(str_host,0)
   U_INTERNAL_ASSERT_EQUALS(str_port,0)
   U_INTERNAL_ASSERT_EQUALS(str_root,0)
   U_INTERNAL_ASSERT_EQUALS(str_UTF8,0)
   U_INTERNAL_ASSERT_EQUALS(str_UTF16,0)
   U_INTERNAL_ASSERT_EQUALS(str_dbname,0)
   U_INTERNAL_ASSERT_EQUALS(str_timeout,0)
   U_INTERNAL_ASSERT_EQUALS(str_compress,0)
   U_INTERNAL_ASSERT_EQUALS(str_character_set,0)

   static ustringrep stringrep_storage[] = {
      { U_STRINGREP_FROM_CONSTANT("host") },
      { U_STRINGREP_FROM_CONSTANT("port") },
      { U_STRINGREP_FROM_CONSTANT("root") },
      { U_STRINGREP_FROM_CONSTANT("UTF8") },
      { U_STRINGREP_FROM_CONSTANT("UTF16") },
      { U_STRINGREP_FROM_CONSTANT("dbname") },
      { U_STRINGREP_FROM_CONSTANT("timeout") },
      { U_STRINGREP_FROM_CONSTANT("compress") },
      { U_STRINGREP_FROM_CONSTANT("character-set") }
   };

   U_NEW_ULIB_OBJECT(str_host,          U_STRING_FROM_STRINGREP_STORAGE(0));
   U_NEW_ULIB_OBJECT(str_port,          U_STRING_FROM_STRINGREP_STORAGE(1));
   U_NEW_ULIB_OBJECT(str_root,          U_STRING_FROM_STRINGREP_STORAGE(2));
   U_NEW_ULIB_OBJECT(str_UTF8,          U_STRING_FROM_STRINGREP_STORAGE(3));
   U_NEW_ULIB_OBJECT(str_UTF16,         U_STRING_FROM_STRINGREP_STORAGE(4));
Exemple #9
0
const UString* UStreamPlugIn::str_METADATA;
const UString* UStreamPlugIn::str_CONTENT_TYPE;

// 1M size ring buffer
#define U_RING_BUFFER_SIZE (1 * 1024 * 1024)

void UStreamPlugIn::str_allocate()
{
   U_TRACE(0, "UStreamPlugIn::str_allocate()")

   U_INTERNAL_ASSERT_EQUALS(str_URI_PATH,0)
   U_INTERNAL_ASSERT_EQUALS(str_METADATA,0)
   U_INTERNAL_ASSERT_EQUALS(str_CONTENT_TYPE,0)

   static ustringrep stringrep_storage[] = {
      { U_STRINGREP_FROM_CONSTANT("URI_PATH") },
      { U_STRINGREP_FROM_CONSTANT("METADATA") },
      { U_STRINGREP_FROM_CONSTANT("CONTENT_TYPE") }
   };

   U_NEW_ULIB_OBJECT(str_URI_PATH,     U_STRING_FROM_STRINGREP_STORAGE(0));
   U_NEW_ULIB_OBJECT(str_METADATA,     U_STRING_FROM_STRINGREP_STORAGE(1));
   U_NEW_ULIB_OBJECT(str_CONTENT_TYPE, U_STRING_FROM_STRINGREP_STORAGE(2));
}

RETSIGTYPE UStreamPlugIn::handlerForSigTERM(int signo)
{
   U_TRACE(0, "[SIGTERM] UStreamPlugIn::handlerForSigTERM(%d)", signo)

   if (pid != -1) UProcess::kill(pid, SIGTERM);
U_CREAT_FUNC(orm_driver_mysql, UOrmDriverMySql)

const UString* UOrmDriverMySql::str_name;
const UString* UOrmDriverMySql::str_secure_auth;
const UString* UOrmDriverMySql::str_auto_reconnect;

void UOrmDriverMySql::str_allocate()
{
    U_TRACE(0, "UOrmDriverMySql::str_allocate()")

    U_INTERNAL_ASSERT_EQUALS(str_name, 0)
    U_INTERNAL_ASSERT_EQUALS(str_secure_auth, 0)
    U_INTERNAL_ASSERT_EQUALS(str_auto_reconnect, 0)

    static ustringrep stringrep_storage[] = {
        { U_STRINGREP_FROM_CONSTANT("mysql") },
        { U_STRINGREP_FROM_CONSTANT("secure-auth") },
        { U_STRINGREP_FROM_CONSTANT("auto-reconnect") }
    };

    U_NEW_ULIB_OBJECT(str_name,           U_STRING_FROM_STRINGREP_STORAGE(0));
    U_NEW_ULIB_OBJECT(str_secure_auth,    U_STRING_FROM_STRINGREP_STORAGE(1));
    U_NEW_ULIB_OBJECT(str_auto_reconnect, U_STRING_FROM_STRINGREP_STORAGE(2));
}

UOrmDriverMySql::~UOrmDriverMySql()
{
    U_TRACE_UNREGISTER_OBJECT(0, UOrmDriverMySql)
}

#undef  ENTRY
Exemple #11
0
   U_INTERNAL_ASSERT_EQUALS(str_unsignedShort,0)
   U_INTERNAL_ASSERT_EQUALS(str_int,0)
   U_INTERNAL_ASSERT_EQUALS(str_unsignedInt,0)
   U_INTERNAL_ASSERT_EQUALS(str_long,0)
   U_INTERNAL_ASSERT_EQUALS(str_unsignedLong,0)
   U_INTERNAL_ASSERT_EQUALS(str_float,0)
   U_INTERNAL_ASSERT_EQUALS(str_double,0)
   U_INTERNAL_ASSERT_EQUALS(str_string,0)
   U_INTERNAL_ASSERT_EQUALS(str_base64Binary,0)
   U_INTERNAL_ASSERT_EQUALS(str_response,0)
   U_INTERNAL_ASSERT_EQUALS(str_encode_wrap,0)
   U_INTERNAL_ASSERT_EQUALS(str_mismatch,0)
   U_INTERNAL_ASSERT_EQUALS(str_envelope,0)

   static ustringrep stringrep_storage[] = {
   { U_STRINGREP_FROM_CONSTANT("boolean") },
   { U_STRINGREP_FROM_CONSTANT("byte") },
   { U_STRINGREP_FROM_CONSTANT("unsignedByte") },
   { U_STRINGREP_FROM_CONSTANT("short") },
   { U_STRINGREP_FROM_CONSTANT("unsignedShort") },
   { U_STRINGREP_FROM_CONSTANT("int") },
   { U_STRINGREP_FROM_CONSTANT("unsignedInt") },
   { U_STRINGREP_FROM_CONSTANT("long") },
   { U_STRINGREP_FROM_CONSTANT("unsignedLong") },
   { U_STRINGREP_FROM_CONSTANT("float") },
   { U_STRINGREP_FROM_CONSTANT("double") },
   { U_STRINGREP_FROM_CONSTANT("string") },
   { U_STRINGREP_FROM_CONSTANT("base64Binary") },
   { U_STRINGREP_FROM_CONSTANT("Response") },
   { U_STRINGREP_FROM_CONSTANT("<%.*s xsi:type=\"xsd:%.*s\">%.*s</%.*s>") },
   { U_STRINGREP_FROM_CONSTANT(