Exemple #1
0
 Impl(Input& input)
 : input(input), textInput(NULL)
 {
     std::fill(buttonStates.begin(), buttonStates.end(), false);
     
     mouseFactorX = mouseFactorY = 1;
     mouseOffsetX = mouseOffsetY = 0;
 }
Exemple #2
0
int main(int argc, char* argv[])
{
   Logger logger = Logger::getInstance(LOG4CPLUS_TEXT("test.ChannelSupervisor.Server"));
   PropertyConfigurator::doConfigure(LOG4CPLUS_TEXT("log4cplus.properties"));

   int option_index = 0;
   int c;

   while (true)
   {
      c = getopt_long(argc, argv, "x:u:r:p:", long_options, &option_index);

      if (-1 == c)
         break;

      switch (c)
      {
      case 'x':
         //Log("option x = '%s'", optarg);
         strncpy(cs_sock_path.begin(), optarg, cs_sock_path.size());
         cs_sock_path[cs_sock_path.size() - 1] = 0;
         break;
      case 'u':
         //Log("option u = '%s'", optarg);
         strncpy(ca_sock_path.begin(), optarg, ca_sock_path.size());
         ca_sock_path[ca_sock_path.size() - 1] = 0;
         break;
      default:
         //Log("unknown param %c (%d)", c, c);
         exit(1);
         break;
      }
   }

   if (ca_sock_path[0] != 0)
   {
      extern char const * gpCA_UNIX_SOCK_PATH;
      gpCA_UNIX_SOCK_PATH = ca_sock_path.begin();
      // gpCA_UNIX_SOCK_PATH = "/tmp/axis_ca2";
   }

   if (cs_sock_path[0] != 0)
   {
      extern char const * gpNEGOTIATOR_IPC_ADDR;
      gpNEGOTIATOR_IPC_ADDR = cs_sock_path.begin();
      // gpNEGOTIATOR_IPC_ADDR = "/tmp/axis_neg2";
   }


   //


   CServer server;
   server.threadFunc();
   // server.start();
   // while(true)
   // {
   //    sleep(1000);
   // };
}
Exemple #3
0
int main(int argc, char* argv[])
{
   Logger logger = Logger::getInstance(LOG4CPLUS_TEXT("ConnectivityAgent.test.client.main"));

   PropertyConfigurator::doConfigure(LOG4CPLUS_TEXT("log4cplus.properties"));

   int option_index = 0;
   int c;

   while (true)
   {
      c = getopt_long(argc, argv, "x:u:r:p:", long_options, &option_index);

      if (-1 == c)
         break;

      switch (c)
      {
      case 'u':
         //Log("option u = '%s'", optarg);
         strncpy(ca_sock_path.begin(), optarg, ca_sock_path.size());
         ca_sock_path[ca_sock_path.size() - 1] = 0;
         break;
      default:
         //Log("unknown param %c (%d)", c, c);
         exit(1);
         break;
      }
   }

   if (ca_sock_path[0] != 0)
   {
      extern char const * gpCA_UNIX_SOCK_PATH;
      gpCA_UNIX_SOCK_PATH = ca_sock_path.begin();
   }

   // please run client first
   CSignalSemaphoreInterproc::unlink("/connectivity_agent_test_server");
   CSignalSemaphoreInterproc::unlink("/connectivity_agent_test_client");

   CClient client;
   client.threadFunc();
   // client.start();
   // while(true)
   // {	

   //    sleep(1000);
   // };
}
		void _ReadImpl(u_long size, u_long error)
		{
			if( error != 0 || size == 0 )
			{
				_ReStart();
				return;
			}

			readCallback_(buf_.data(), size);
		}
Exemple #5
0
int main(int argc, char* argv[])
{
    PropertyConfigurator::doConfigure(LOG4CPLUS_TEXT("ProfileTestChannelTest.properties"));
    int option_index = 0;
    int c;

    while (true)
    {
        c = getopt_long(argc, argv, "x:u:", long_options, &option_index);

        if (-1 == c)
        {
            break;
        }

        switch (c)
        {
        case 'x':
            strncpy(cs_sock_path.begin(), optarg, cs_sock_path.size());
            cs_sock_path[cs_sock_path.size() - 1] = 0;
            break;
        case 'u':
            strncpy(ca_sock_path.begin(), optarg, ca_sock_path.size());
            ca_sock_path[ca_sock_path.size() - 1] = 0;
            break;
        default:
            exit(1);
            break;
        }
    }

    if (0 != ca_sock_path[0])
    {
        extern char const * gpCA_UNIX_SOCK_PATH;
        gpCA_UNIX_SOCK_PATH = ca_sock_path.begin();
    }

    if (0 != cs_sock_path[0])
    {
        extern char const * gpNEGOTIATOR_IPC_ADDR;
        gpNEGOTIATOR_IPC_ADDR = cs_sock_path.begin();
    }

    // please run client first
    CSignalSemaphoreInterproc::unlink(gSemServerName.c_str());
    CSignalSemaphoreInterproc::unlink(gSemClientName.c_str());

    ChannelClient client;
    client.threadFunc();
}
Exemple #6
0
    void serialize_vc6(SF::Archive & ar, std::tr1::array<T, N> & a, const unsigned int)
    {
        if (ar.isRead())
        {
            unsigned int count = 0;
            ar & count;
            RCF_VERIFY(count == a.size(), RCF::Exception());

            for (std::size_t i=0; i<a.size(); ++i)
            {
                ar & a[i];
            }
        }
        else if (ar.isWrite())
        {
            unsigned int count = a.size();
            ar & count;

            for (std::size_t i=0; i<a.size(); ++i)
            {
                ar & a[i];
            }
        }
    }
Exemple #7
0
#include "user.h"
#include "map.h"
#include "chat.h"
#include "nbt.h"
#include "mineserver.h"
#include "packets.h"


extern int setnonblock(int fd);

#ifndef WIN32
#define SOCKET_ERROR -1
#endif

static const size_t BUFSIZE = 2048;
static std::tr1::array<uint8_t, BUFSIZE> BUF;
static std::tr1::array<uint8_t, BUFSIZE> BUFCRYPT;
static char* const cpBUF = reinterpret_cast<char*>(BUF.data());
static uint8_t* const upBUF = BUF.data();

static char* cpBUFCRYPT = reinterpret_cast<char*>(BUFCRYPT.data());

extern "C" void client_callback(int fd, short ev, void* arg)
{
  User* user = reinterpret_cast<User*>(arg);

  if (ev & EV_READ)
  {
    int read = 1;

    //Data must be decrypted if we are in crypted mode
Exemple #8
0
int profileManagerEntryPoint(const std::string& pathToProfileRepository, const std::string& pathToServiceRepository)
#endif //ANDROID
{
    Logger logger = Logger::getInstance(LOG4CPLUS_TEXT("profileManager.PMP.process.main"));

    WatchdogThread watchdogThread(iviLink::SystemController::PROFILE_MANAGER);
    watchdogThread.start();

    iviLink::conf::Configurator config("");
#ifndef ANDROID
    PropertyConfigurator::doConfigure(LOG4CPLUS_TEXT("log4cplus.properties"));

    int option_index = 0;
    int c;

    while (true)
    {
        c = getopt_long(argc, argv, "x:u:r:p:", long_options, &option_index);

        if (-1 == c)
        {
            break;
        }

        switch (c)
        {
        case 'x':
            strncpy(cs_sock_path.begin(), optarg, cs_sock_path.size());
            cs_sock_path[cs_sock_path.size() - 1] = 0;
            break;
        case 'u':
            strncpy(ca_sock_path.begin(), optarg, ca_sock_path.size());
            ca_sock_path[ca_sock_path.size() - 1] = 0;
            break;
        case 'r':
            strncpy(repo_sock_path.begin(), optarg, repo_sock_path.size());
            repo_sock_path[repo_sock_path.size() - 1] = 0;
            break;
        case 'p':
            strncpy(pmp_sock_path.begin(), optarg, pmp_sock_path.size());
            pmp_sock_path[pmp_sock_path.size() - 1] = 0;
            break;
        default:
            LOG4CPLUS_FATAL(logger, "unknown param");
            exit(1);
            break;
        }
    }

    if (ca_sock_path[0] != 0)
    {
        extern char const * gpCA_UNIX_SOCK_PATH;
        gpCA_UNIX_SOCK_PATH = ca_sock_path.begin();
    }

    if (ca_sock_path[0] != 0)
    {
        extern char const * gpNEGOTIATOR_IPC_ADDR;
        gpNEGOTIATOR_IPC_ADDR = cs_sock_path.begin();
    }


    if (repo_sock_path[0] != 0)
    {
        config.setParam("pmp_repo_ipc_address", repo_sock_path.begin());
    }

    if (pmp_sock_path[0] != 0)
    {
        config.setParam("pmp_ipc_address", pmp_sock_path.begin());
    }
#else
    config.setParam("path_to_database", pathToProfileRepository);
    config.setParam("path_to_services", pathToServiceRepository);
#endif //ANDROID

    iviLink::PMP::PmpComponentManager manager(&config);
    manager.initPmp();
    manager.wait();
    manager.uninitPmp();

    return 0;
}