Example #1
0
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)
{
   U_TRACE_REGISTER_OBJECT(0, UClient_Base, "%p", cfg)
Example #2
0
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;

   ipnum = U_SYSCALL(_GeoIP_lookupaddress, "%s", UServer_Base::client_address);
Example #3
0
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);

   str_allocate();
}

USSIPlugIn::~USSIPlugIn()
Example #4
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_NEW_ULIB_OBJECT(str_SENDER_ADDRESS,   U_STRING_FROM_STRINGREP_STORAGE(6));
   U_NEW_ULIB_OBJECT(str_REPLY_TO_ADDRESS, U_STRING_FROM_STRINGREP_STORAGE(7));
}

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

char* USmtpClient::status()
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
#define ENTRY(name) {name, #name}

void UOrmDriverSqlite::handlerError()
{
   U_TRACE(0, "UOrmDriverSqlite::handlerError()")
Example #6
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));
}

// gcc: call is unlikely and code size would grow

void Url::set(const UString& x)
{
   U_TRACE(0, "Url::set(%.*S)", U_STRING_TO_TRACE(x))

   url = x;
Example #7
0
   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()
{
   U_TRACE(0, "UWebSocket::sendAccept()")

   U_INTERNAL_ASSERT(U_http_websocket)
   U_INTERNAL_ASSERT_POINTER(str_websocket_key)
   U_INTERNAL_ASSERT_MAJOR(U_http_websocket_len, 0)

   // In order to establish a websocket connection, a client (a web browser) sends a HTTP GET request with a number of HTTP headers.
   // Among those headers there is the Sec-WebSocket-Key header, which contains a handshake key. According to the WebSocket protocol,
   // the server should:
Example #8
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));
   U_NEW_ULIB_OBJECT(str_dbname,        U_STRING_FROM_STRINGREP_STORAGE(5));
   U_NEW_ULIB_OBJECT(str_timeout,       U_STRING_FROM_STRINGREP_STORAGE(6));
   U_NEW_ULIB_OBJECT(str_compress,      U_STRING_FROM_STRINGREP_STORAGE(7));
   U_NEW_ULIB_OBJECT(str_character_set, U_STRING_FROM_STRINGREP_STORAGE(8));
}

UOrmDriver::~UOrmDriver()
{
   U_TRACE_UNREGISTER_OBJECT(0, UOrmDriver)
}
Example #9
0
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);

   UInterrupt::sendOurselves(SIGTERM);
}

UStreamPlugIn::UStreamPlugIn()
{
Example #10
0
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
#  define ENTRY(name) {name, #name}

void UOrmDriverMySql::handlerError()
{
    U_TRACE(0, "UOrmDriverMySql::UOrmDriverMySql()")
Example #11
0
            "<faultcode>env:VersionMismatch</faultcode>"
            "<faultstring>Version Mismatch</faultstring>"
         "</env:Fault>"
      "</env:Body>"
   "</env:Envelope>") },
   { U_STRINGREP_FROM_CONSTANT(
   "<?xml version='1.0' ?>"
   "<env:Envelope xmlns:env=\"http://www.w3.org/2003/05/soap-envelope\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">"
      "<env:Header>%.*s</env:Header>"
         "<env:Body>"
            "<%.*s:%.*s env:encodingStyle=\"http://www.w3.org/2003/05/soap-encoding\" xmlns:%.*s=\"%.*s\">%.*s</%.*s:%.*s>"
         "</env:Body>"
   "</env:Envelope>") }
};

   U_NEW_ULIB_OBJECT(str_boolean,       U_STRING_FROM_STRINGREP_STORAGE(0));
   U_NEW_ULIB_OBJECT(str_byte,          U_STRING_FROM_STRINGREP_STORAGE(1));
   U_NEW_ULIB_OBJECT(str_unsignedByte,  U_STRING_FROM_STRINGREP_STORAGE(2));
   U_NEW_ULIB_OBJECT(str_short,         U_STRING_FROM_STRINGREP_STORAGE(3));
   U_NEW_ULIB_OBJECT(str_unsignedShort, U_STRING_FROM_STRINGREP_STORAGE(4));
   U_NEW_ULIB_OBJECT(str_int,           U_STRING_FROM_STRINGREP_STORAGE(5));
   U_NEW_ULIB_OBJECT(str_unsignedInt,   U_STRING_FROM_STRINGREP_STORAGE(6));
   U_NEW_ULIB_OBJECT(str_long,          U_STRING_FROM_STRINGREP_STORAGE(7));
   U_NEW_ULIB_OBJECT(str_unsignedLong,  U_STRING_FROM_STRINGREP_STORAGE(8));
   U_NEW_ULIB_OBJECT(str_float,         U_STRING_FROM_STRINGREP_STORAGE(9));
   U_NEW_ULIB_OBJECT(str_double,        U_STRING_FROM_STRINGREP_STORAGE(10));
   U_NEW_ULIB_OBJECT(str_string,        U_STRING_FROM_STRINGREP_STORAGE(11));
   U_NEW_ULIB_OBJECT(str_base64Binary,  U_STRING_FROM_STRINGREP_STORAGE(12));
   U_NEW_ULIB_OBJECT(str_response,      U_STRING_FROM_STRINGREP_STORAGE(13));
   U_NEW_ULIB_OBJECT(str_encode_wrap,   U_STRING_FROM_STRINGREP_STORAGE(14));
   U_NEW_ULIB_OBJECT(str_mismatch,      U_STRING_FROM_STRINGREP_STORAGE(15));