Exemplo n.º 1
0
void CommsThread::findNetworkInterfaces() {
    pcap_if_t *list_if;
    int interfaceCount = 0;

#ifdef _WIN32
    if (pcap_findalldevs_ex((char *) PCAP_SRC_IF_STRING, NULL /* auth is not needed */, &list_if, CommsThread::errbuf) == -1) {
        fprintf(stderr, "Error in pcap_findalldevs_ex: %s\n", CommsThread::errbuf);
        exit(1);
    }
#else
    if (pcap_findalldevs(&list_if, CommsThread::errbuf) == -1) {
        fprintf(stderr, "Error in pcap_findalldevs: %s\n", CommsThread::errbuf);
        exit(1);
    }
#endif

    while (list_if != NULL) {
#ifdef _WIN32
        emit addInterface(interfaceCount, QString(list_if->description));
#else
        emit addInterface(interfaceCount, QString(list_if->name));
#endif
        list_if = list_if->next;
        interfaceCount++;
    }
}
Exemplo n.º 2
0
 JObjectOutputClass():JClass(JClassLoader::getBootClassLoader()){
     canonicalName="java.io.ObjectOutput";
     name="java.io.ObjectOutput";
     simpleName="ObjectOutput";
     bIsInterface=true;
     addInterface(JDataOutput::getClazz());
     addInterface(JAutoCloseable::getClazz());
 }
Exemplo n.º 3
0
 JPrimitiveShortClass(){
     this->canonicalName="short";
     this->name="short";
     this->simpleName="short";
     this->bIsPrimitive=true;
     addInterface(JComparable::getClazz());
     addInterface(JSerializable::getClazz());
 }
Exemplo n.º 4
0
 JRunnableFutureClass(){
     this->canonicalName="java.util.concurrent.RunnableFuture";
     this->name="java.util.concurrent.RunnableFuture";
     this->simpleName="RunnableFuture";
     this->bIsInterface=true;
     addInterface(JRunnable::getClazz());
     addInterface(JFuture::getClazz());
 }
Exemplo n.º 5
0
 JWriterClass(){
     this->canonicalName="java.io.Writer";
     this->name="java.io.Writer";
     this->simpleName="Writer";
     addInterface(JAppendable::getClazz());
     addInterface(JCloseable::getClazz());
     addInterface(JFlushable::getClazz());
 }
Exemplo n.º 6
0
 JDirectoryStreamClass(){
     this->canonicalName="java.nio.file.DirectoryStream";
     this->name="java.nio.file.DirectoryStream";
     this->simpleName="DirectoryStream";
     addInterface(JCloseable::getClazz());
     addInterface(JIterable::getClazz());
     this->bIsInterface=true;
 }
Exemplo n.º 7
0
 JByteClass():JClass(){
     this->canonicalName="java.lang.Byte";
     this->name="java.lang.Byte";
     this->simpleName="Byte";
     this->serialVersionUID=-7183698231559129828ULL;
     addInterface(JSerializable::getClazz());
     addInterface(JComparable::getClazz());
     addField(new JField("value",JPrimitiveByte::getClazz(),this,staticGetValue,staticSetValue));
 }
Exemplo n.º 8
0
 JBooleanClass(){
     this->canonicalName="java.lang.Boolean";
     this->name="java.lang.Boolean";
     this->simpleName="Boolean";
     this->serialVersionUID=-3665804199014368530ULL;
     addInterface(JSerializable::getClazz());
     addInterface(JComparable::getClazz());
     addField(new JField("value",JPrimitiveBoolean::getClazz(),this,getValue,setValue));
 }
Exemplo n.º 9
0
 JCharClass(){
     this->canonicalName="java.lang.Character";
     this->name="java.lang.Character";
     this->simpleName="Character";
     this->serialVersionUID=3786198910865385080ULL;
     addInterface(JSerializable::getClazz());
     addInterface(JComparable::getClazz());
     addField(new JField("value",JPrimitiveChar::getClazz(),this,staticGetValue,staticSetValue));
 }
Exemplo n.º 10
0
struct Interfaces* getInterfaces()
{
	// Variables
	struct Interfaces *interfaces = malloc(sizeof(struct Interfaces));
	interfaces->count = 0;

	struct ifaddrs *ifap, *ifa;
	struct sockaddr_in *sa;
	size_t current_size;
	//

	if(interfaces != NULL)
	{
		getifaddrs(&ifap);

		for(ifa = ifap, current_size = 1; ifa; ifa = ifa->ifa_next, current_size++)
		{
			if(ifa->ifa_addr->sa_family == AF_INET)
			{
				sa = (struct sockaddr_in *) ifa->ifa_addr;

				addInterface(interfaces, ifa->ifa_name, inet_ntoa(sa->sin_addr), sa->sin_port, current_size);
			}
		}
		freeifaddrs(ifap);
	}

	return interfaces;
}
Exemplo n.º 11
0
MM::VOID MM::PoolNodeBehavior::update(MM::Observable * observable,
                                      MM::VOID * aux,
                                      MM::UINT32 message,
                                      MM::VOID * object)
{
  switch(message)
  {
    //pool node behavior is observing its type definition
    case MM::MSG_NEW_DRAIN:
    case MM::MSG_NEW_POOL:
    case MM::MSG_NEW_SOURCE:
    case MM::MSG_NEW_REF:
    case MM::MSG_NEW_GATE:
      addInterface((MM::Machine *) aux, (MM::Node *) object);
      break;
    //pool node behavior is observing its type definition
    case MM::MSG_DEL_DRAIN:
    case MM::MSG_DEL_POOL:
    case MM::MSG_DEL_SOURCE:
    case MM::MSG_DEL_REF:
    case MM::MSG_DEL_GATE:
      removeInterface((MM::Machine *) aux, (MM::Node *) object);
      break;
    default:
      //message not understood
      break;
  }
}
Exemplo n.º 12
0
 JPrimitiveIntClass():JClass(){
     this->canonicalName="int";
     this->name="int";
     this->simpleName="int";
     this->bIsPrimitive=true;
     addInterface(JComparable::getClazz());
 }
Exemplo n.º 13
0
 JExecutorServiceClass(){
     this->canonicalName="java.util.concurrent.ExecutorService";
     this->name="java.util.concurrent.ExecutorService";
     this->simpleName="ExecutorService";
     this->bIsInterface=true;
     addInterface(JExecutor::getClazz());
 }
Exemplo n.º 14
0
std::shared_ptr<InterfaceMap>
InterfaceMap::fromFollyDynamic(const folly::dynamic& intfMapJson) {
  auto intfMap = std::make_shared<InterfaceMap>();
  for (const auto& intf: intfMapJson) {
    intfMap->addInterface(Interface::fromFollyDynamic(intf));
  }
  return intfMap;
}
Exemplo n.º 15
0
 JProxy::JProxyClass::JProxyClass():JClass(JClassLoader::getBootClassLoader()){
     canonicalName="java.lang.reflect.Proxy";
     name="java.lang.reflect.Proxy";
     simpleName="Proxy";
     serialVersionUID=-2222568056686623797ULL;
     addField(new JField("h",JInvocationHandler::getClazz(),this,staticGetInvocationHandler,staticSetInvocationHandler));
     addInterface(JSerializable::getClazz());
 }
Exemplo n.º 16
0
/*!
    \reimp
*/
void QTelephonyService::initialize()
{
    // Create a default service checker if we don't have one yet.
    if ( !supports<QServiceChecker>() )
        addInterface( new QServiceCheckerServer( service(), true, this ) );

    QAbstractIpcInterfaceGroup::initialize();
}
Exemplo n.º 17
0
void InterfacesTabWidget::load(const QList<QTM_PREPEND_NAMESPACE(QServiceInterfaceDescriptor)> &descriptors)
{
    QWidget *widg;
    while (count() > 0) {
        widg = widget(count()-1);
        if (widg) {
            removeTab(count()-1);
            delete widg;
        }
    }

    for (int i=0; i<descriptors.count(); i++)
        addInterface(descriptors[i]);

    if (count() == 0)
        addInterface(); // blank placeholder interface
    setCurrentIndex(0);
}
Exemplo n.º 18
0
/**
 * @brief addInterface  Adds and bind a interface to a resource
 *
 * @param resource      The resource to bind a type to
 * @param interfaceName Interface name to bind.
 *
 * @return OC_STACK_OK if successfully bound
 */
OCStackResult addInterface(OCBaseResourceT *resource, const char *interfaceName)
{
    OCResourceInterface *interface = (OCResourceInterface*)malloc(sizeof(OCResourceInterface));
    if(interface == NULL) {printNoMemoryMsg(); return OC_STACK_NO_MEMORY;}

    interface->name = (char*) interfaceName;
    interface->next = NULL;

    return(addInterface(resource, interface));
}
Exemplo n.º 19
0
          JHashMapClass(){
              this->canonicalName="java.util.HashMap";
              this->name="java.util.HashMap";
              this->simpleName="HashMap";
              this->serialVersionUID=362498820763181265ULL;
              addInterface(JMap::getClazz());
              addInterface(JSerializable::getClazz());
              addInterface(JCloneable::getClazz());

              vector<JClass*>* paramType=new vector<JClass*>();
              paramType->push_back(JObjectInputStream::getClazz());
              addMethod(new JMethod("readObject",this,JVoid::getClazz(),paramType,invokeReadObject));

              paramType=new vector<JClass*>;
              paramType->push_back(JObjectOutputStream::getClazz());
              addMethod(new JMethod("writeObject",this,JVoid::getClazz(),paramType,invokeWriteObject));

              addField(new JField("threshold",JPrimitiveInt::getClazz(),this,staticGetThreshold,staticSetThreshold));
              addField(new JField("loadFactor",JPrimitiveFloat::getClazz(),this,staticGetLoadFactor,staticSetLoadFactor));
          }
Exemplo n.º 20
0
                    JLevelClass(){
                        this->canonicalName="java.util.logging.Level";
                        this->name="java.util.logging.Level";
                        this->simpleName="Level";
                        this->serialVersionUID=-8176160795706313070ULL;
                        addInterface(JSerializable::getClazz());

                        addField(new JField("name",JString::getClazz(),this,staticGetName,staticSetName));
                        addField(new JField("value",JPrimitiveInt::getClazz(),this,staticGetValue,staticSetValue));
                        addField(new JField("resourceBundleName",JString::getClazz(),this,staticGetResouveBundleName,staticSetResourceBundleName));
                    }
Exemplo n.º 21
0
                JBasicPermissionClass(){
                    this->canonicalName="java.security.BasicPermission";
                    this->name="java.security.BasicPermission";
                    this->simpleName="BasicPermission";
                    this->serialVersionUID=6279438298436773498ULL;
                    addInterface(JSerializable::getClazz());

                    vector<JClass*>* paramType=new vector<JClass*>();
                    paramType->push_back(JObjectInputStream::getClazz());
                    addMethod(new JMethod("readObject",this,JVoid::getClazz(),paramType,invokeReadObject));
                }
Exemplo n.º 22
0
void HtcuniversalModemService::initialize()
{
  HtcuniversalGsmPower::getInstance(this)->init();
  HtcuniversalGsmPower::getInstance(this)->enableNotifications();
  chat("AT+CSCA?");

  if (!supports<QPinManager>())
    addInterface(new HtcuniversalPinManager(this));

  if (!supports<QBandSelection>())
    addInterface(new HtcuniversalBandSelection(this));

  if (!callProvider())
    setCallProvider(new HtcuniversalCallProvider(this));

  if (!supports<QVibrateAccessory>())
    addInterface(new HtcuniversalVibrateAccessory(this));

  if (!supports<QCallVolume>())
    addInterface(new HtcuniversalCallVolume(this));

  if (!supports<QModemPreferredNetworkOperators>())
    addInterface(new HtcuniversalPreferredNetworkOperators(this));

  if (!supports<QModemNetworkRegistration>())
    addInterface(new HtcuniversalModemNetworkRegistration(this));

  if (!supports<QModemSimFiles>())
    addInterface(new QModemSimFiles(this));

  if (!supports<QModemCallSettings>())
    addInterface(new QModemCallSettings(this));

  if (!supports<QModemServiceNumbers>())
    addInterface(new QModemServiceNumbers(this));

  if (!supports<QPhoneRfFunctionality>())
    addInterface(new HtcuniversalRfFunctionality(this));

  QModemService::initialize();
}
Exemplo n.º 23
0
void emit_class(EmitUnitState& state,
                UnitEmitter& ue,
                const php::Class& cls) {
  FTRACE(2, "    class: {}\n", cls.name->data());
  auto const pce = ue.newPreClassEmitter(
    cls.name,
    cls.hoistability
  );
  pce->init(
    std::get<0>(cls.srcInfo.loc),
    std::get<1>(cls.srcInfo.loc),
    ue.bcPos(),
    cls.attrs,
    cls.parentName ? cls.parentName : s_empty.get(),
    cls.srcInfo.docComment
  );
  pce->setUserAttributes(cls.userAttributes);

  for (auto& i : cls.interfaceNames)   pce->addInterface(i);
  for (auto& ut : cls.usedTraitNames)  pce->addUsedTrait(ut);
  for (auto& req : cls.traitRequirements) pce->addTraitRequirement(req);
  for (auto& tp : cls.traitPrecRules)  pce->addTraitPrecRule(tp);
  for (auto& ta : cls.traitAliasRules) pce->addTraitAliasRule(ta);

  for (auto& m : cls.methods) {
    FTRACE(2, "    method: {}\n", m->name->data());
    auto const fe = ue.newMethodEmitter(m->name, pce);
    emit_init_func(*fe, *m);
    pce->addMethod(fe);
    auto const info = emit_bytecode(state, ue, *m);
    emit_finish_func(*m, *fe, info);
  }

  for (auto& prop : cls.properties) {
    pce->addProperty(
      prop.name,
      prop.attrs,
      prop.typeConstraint,
      prop.docComment,
      &prop.val,
      KindOfInvalid // hphpcType
    );
  }

  for (auto& cconst : cls.constants) {
    pce->addConstant(
      cconst.name,
      cconst.typeConstraint,
      &cconst.val,
      cconst.phpCode
    );
  }
}
Exemplo n.º 24
0
 JConnectionConfigurationClass(){
     this->canonicalName="jcpp.rmi.server.impl.connection.ConnectionConfiguration";
     this->name="jcpp.rmi.server.impl.connection.ConnectionConfiguration";
     this->simpleName="ConnectionConfiguration";
     addInterface(JSerializable::getClazz());
     addField(new JField("transportConfiguration",JTransportConfiguration::getClazz(),this,staticGetTransportConfiguration,staticSetTransportConfiguration));
     addField(new JField("gcTimeout",JLong::getClazz(),this,staticGetGcTimeout,staticSetGcTimeout));
     addField(new JField("gcClientTimeout",JLong::getClazz(),this,staticGetGcClientTimeout,staticSetGcClientTimeout));
     addField(new JField("gcClientExceptionThreshold",JInteger::getClazz(),this,staticGetGcClientExceptionThreshold,staticSetGcClientExceptionThreshold));
     addField(new JField("executorCorePoolSize",JInteger::getClazz(),this,staticGetExecutorCorePoolSize,staticSetExecutorCorePoolSize));
     serialVersionUID=-7733929591819747912ULL;
 }
Exemplo n.º 25
0
 JTransportConfigurationClass(){
     this->canonicalName="jcpp.rmi.server.impl.transport.TransportConfiguration";
     this->name="jcpp.rmi.server.impl.transport.TransportConfiguration";
     this->simpleName="TransportConfiguration";
     addInterface(JSerializable::getClazz());
     addField(new JField("gatewayConfiguration",JGatewayConfiguration::getClazz(),this,staticGetGatewayConfiguration,staticSetGatewayConfiguration));
     addField(new JField("connectionPoolTimeout",JLong::getClazz(),this,staticGetConnectionPoolTimeout,staticSetConnectionPoolTimeout));
     addField(new JField("socketTimeout",JInteger::getClazz(),this,staticGetSocketTimeout,staticSetSocketTimeout));
     addField(new JField("pingTimeout",JInteger::getClazz(),this,staticGetPingTimeout,staticSetPingTimeout));
     addField(new JField("limitedSocketTimeout",JInteger::getClazz(),this,staticGetLimitedSocketTimeout,staticSetLimitedSocketTimeout));
     addField(new JField("timeoutTimerInterval",JLong::getClazz(),this,staticGetTimeoutTimerInterval,staticSetTimeoutTimerInterval));
     serialVersionUID=721031819973449961ULL;
 }
Exemplo n.º 26
0
void QTelephonyServiceDummy::initialize()
{
    if ( !supports<QSimInfo>() )
        addInterface( new QSimInfoDummy( service(), this ) );

    if ( !supports<QPhoneBook>() )
        addInterface( new QPhoneBookDummy( service(), this ) );

    if ( !supports<QNetworkRegistration>() )
        addInterface( new QNetworkRegistrationDummy( service(), this ) );

    if ( !supports<QPhoneRfFunctionality>() )
        addInterface( new QPhoneRfFunctionalityDummy( service(), this ) );

    if ( !supports<QPinManager>() )
        addInterface( new QPinManagerDummy( service(), this ) );

    if ( !callProvider() )
        setCallProvider( new QPhoneCallProviderDummy( service(), this ) );

    QTelephonyService::initialize();
}
Exemplo n.º 27
0
 JPrimitiveArrayClass(JClass* componentType){
     this->componentType=componentType;
     JString cn=componentType->getCanonicalName();
     if (!cn.isEmpty()){
         this->canonicalName=cn+"[]";
     }else{
         canonicalName="";
     }
     this->name="["+componentType->getSignature();
     this->simpleName=componentType->getSimpleName()+"[]";
     this->bIsArray=true;
     addInterface(JSerializable::getClazz());
   }
Exemplo n.º 28
0
ServiceWidget::ServiceWidget(QWidget *parent)
    : QWidget(parent),
      m_ifacesTabs(new InterfacesTabWidget),
      m_title(new QLabel),
      m_name(new MandatoryLineEdit(tr("(Name required)"))),
      m_path(new MandatoryLineEdit(tr("(Path required)"))),
      m_desc(new QLineEdit),
      m_type(new QComboBox),
      m_text(QLatin1String("filepath"))
{
    connect(m_name, SIGNAL(textChanged(QString)), SLOT(setTitle(QString)));

    connect(m_name, SIGNAL(textEdited(QString)), SIGNAL(dataChanged()));
    connect(m_path, SIGNAL(textEdited(QString)), SIGNAL(dataChanged()));
    connect(m_desc, SIGNAL(textEdited(QString)), SIGNAL(dataChanged()));
    connect(m_ifacesTabs, SIGNAL(dataChanged()), SIGNAL(dataChanged()));
    connect(m_type, SIGNAL(currentIndexChanged(int)), SLOT(serviceTypeChanged(int)));

    QFont f = m_title->font();
    f.setBold(true);
    m_title->setFont(f);
    setTitle(QString());

    QPushButton *buttonAdd = new QPushButton(tr("Add interface"));
    buttonAdd->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
    connect(buttonAdd, SIGNAL(clicked()), m_ifacesTabs, SLOT(addInterface()));

    QStringList serviceTypes;
    serviceTypes << tr("* Plugin path") << tr("* IPC address");
    m_type->addItems(serviceTypes);

    QGroupBox *serviceAttrsGroup = new QGroupBox(tr("Main attributes"));
    QFormLayout *form = new QFormLayout;
    form->addRow(tr("* Name"), m_name);
    form->addRow(m_type, m_path);
    form->addRow(tr("Description"), m_desc);
    serviceAttrsGroup->setLayout(form);

    QGroupBox *interfaceTabsGroup = new QGroupBox(tr("Interfaces (must have at least one)"));
    QVBoxLayout *groupLayout = new QVBoxLayout;
    groupLayout->addWidget(m_ifacesTabs);
    groupLayout->addWidget(buttonAdd);
    interfaceTabsGroup->setLayout(groupLayout);

    QVBoxLayout *main = new QVBoxLayout;
    main->addWidget(m_title, 0, Qt::AlignHCenter);
    main->addWidget(serviceAttrsGroup);
    main->addWidget(interfaceTabsGroup);
    main->addWidget(new QLabel(tr("* Denotes mandatory attributes.")), 0, Qt::AlignHCenter);
    setLayout(main);
}
Exemplo n.º 29
0
//The setup function is called once at startup of the sketch
void setup()
{
    // Add your initialization code here
    // Note : This will initialize Serial port on Arduino at 115200 bauds
    OIC_LOG_INIT();
    OIC_LOG(DEBUG, TAG, ("OCServer is starting..."));


    // Connect to Ethernet or WiFi network
    if (ConnectToNetwork() != 0)
    {
        Serial.print("Unable to connect to Network");
        OIC_LOG(ERROR, TAG, ("Unable to connect to network"));
        return;
    }

    // Initialize the OC Stack in Server mode
    if (OCInit(NULL, 0, OC_SERVER) != OC_STACK_OK)
    {
        OIC_LOG(ERROR, TAG, ("OCStack init error"));
        return;
    }

    // DEBUG PIN
    pinMode(LED_PIN, OUTPUT);

    // Button resource
    OCBaseResourceT *temperatureResource = createResource("/a/temperatureSensor", OIC_DEVICE_SENSOR, OC_RSRVD_INTERFACE_DEFAULT,
                                                      (OC_DISCOVERABLE | OC_OBSERVABLE | OC_SLOW | OC_ACTIVE), temperatureIOHandler);

    temperatureResource->name = "LM35 Temperature Sensor";

    addType(temperatureResource, OIC_TYPE_TEMPERATURE);

    // READ only interface
    addInterface(temperatureResource, OC_RSRVD_INTERFACE_READ);

    OCIOPort port;
    port.pin = TEMPERATURE_PIN_IN;
    port.type = IN;

    // Setup ADC
    analogReference(INTERNAL1V1);

    ResourceData data;
    data.str = "0.0";
    addAttribute(&temperatureResource->attribute, "temperature", data, STRING, &port);

    printResource(temperatureResource);
}
Exemplo n.º 30
0
 JSampleObjectClass(){
     this->canonicalName="jcpp.SampleObject";
     this->name="jcpp.SampleObject";
     this->simpleName="SampleObject";
     this->serialVersionUID=40;
     addField(new JBool1Field(this));
     addField(new JByte1Field(this));
     addField(new JChar1Field(this));
     addField(new JDouble1Field(this));
     addField(new JFloat1Field(this));
     addField(new JLong1Field(this));
     addField(new JShort1Field(this));
     addField(new JInt1Field(this));
     addField(new JRSField(this));
     addInterface(JSerializable::getClazz());
 }