コード例 #1
0
ファイル: P2pEndpoint.cpp プロジェクト: jcloudpld/srpc
bool P2pEndpoint::open(srpc::UInt16 port)
{
    const ACE_INET_Addr localAddr(port);
    const int reuse_addr = 1;

    if (udp_->open(localAddr, ACE_PROTOCOL_FAMILY_INET, 0, reuse_addr) == -1) {
        NSRPC_LOG_ERROR2(ACE_TEXT("Can't open a UDP socket(port:%d)(%m)"),
            port);
        return false;
    }
    setMaximumSocketBufferSize(get_handle());
    udp_->enable(ACE_NONBLOCK);

    workaroundWinsockConnectionResetProblem(get_handle());

    const ACE_Reactor_Mask masks = ACE_Event_Handler::READ_MASK;
    if (reactor()->register_handler(this, masks) == -1) {
        NSRPC_LOG_ERROR2(
            ACE_TEXT("ACE_Reactor::register_handler() FAILED!!!(%d,%m)"), 
            ACE_OS::last_error());
        return false;
    }

    ACE_INET_Addr realAddress;
    if (0 != udp_->get_local_addr(realAddress)) {
        assert(false && "what's the matter!");
        return false;
    }

    if (! setAddresses(realAddress.get_port_number())) {
        return false;
    }

    return true;
}
コード例 #2
0
shared_ptr<Interface> ThriftConfigApplier::updateInterface(
    const shared_ptr<Interface>& orig,
    const cfg::Interface* config,
    const Interface::Addresses& addrs) {
    CHECK_EQ(orig->getID(), config->intfID);

    cfg::NdpConfig ndp;
    if (config->__isset.ndp) {
        ndp = config->ndp;
    }
    auto name = getInterfaceName(config);
    auto mac = getInterfaceMac(config);
    auto mtu = config->__isset.mtu ? config->mtu : Interface::kDefaultMtu;
    if (orig->getRouterID() == RouterID(config->routerID) &&
            orig->getVlanID() == VlanID(config->vlanID) &&
            orig->getName() == name &&
            orig->getMac() == mac &&
            orig->getAddresses() == addrs &&
            orig->getNdpConfig() == ndp &&
            orig->getMtu() == mtu) {
        // No change
        return nullptr;
    }

    auto newIntf = orig->clone();
    newIntf->setRouterID(RouterID(config->routerID));
    newIntf->setVlanID(VlanID(config->vlanID));
    newIntf->setName(name);
    newIntf->setMac(mac);
    newIntf->setAddresses(addrs);
    newIntf->setNdpConfig(ndp);
    newIntf->setMtu(mtu);
    return newIntf;
}
コード例 #3
0
ファイル: ipv6setting.cpp プロジェクト: Bridges/libnm-qt5
NetworkManager::Ipv6Setting::Ipv6Setting(const Ptr &other):
    Setting(other),
    d_ptr(new Ipv6SettingPrivate())
{
    setMethod(other->method());
    setDns(other->dns());
    setDnsSearch(other->dnsSearch());
    setAddresses(other->addresses());
    setRoutes(other->routes());
    setIgnoreAutoRoutes(other->ignoreAutoRoutes());
    setIgnoreAutoDns(other->ignoreAutoDns());
    setNeverDefault(other->neverDefault());
    setMayFail(other->mayFail());
}
コード例 #4
0
ファイル: lab7a5.c プロジェクト: Kernelalive/My_Projects
int main (int argc, char *argv[]) {
	
	char *addressTable[2*SIZE];
	char str1[SIZE], str2[SIZE];
	char formatstring[15];

	sprintf(formatstring, "%%%ds %%%ds", SIZE-1, SIZE-1);
	printf("Enter two strings separated by space: ");
	scanf(formatstring, str1, str2);
	
	setAddresses(str1,str2,addressTable);
	printAddresses(addressTable);

	return 0;
			
}
コード例 #5
0
ファイル: lab7a3.c プロジェクト: Kernelalive/My_Projects
int main (int argc, char *argv[]) {
	
	char *uppercase[SIZE], *lowercase[SIZE];
	char string[SIZE];
	char formatstring[15];

	sprintf(formatstring, "%%%ds", SIZE-1);
	printf("Enter string: ");
	scanf(formatstring, string);
	
	setAddresses(string,uppercase,lowercase);
	printAddresses(uppercase,lowercase);

	return 0;
			
}
コード例 #6
0
shared_ptr<Interface> ThriftConfigApplier::createInterface(
    const cfg::Interface* config,
    const Interface::Addresses& addrs) {
    auto name = getInterfaceName(config);
    auto mac = getInterfaceMac(config);
    auto mtu = config->__isset.mtu ? config->mtu : Interface::kDefaultMtu;
    auto intf = make_shared<Interface>(InterfaceID(config->intfID),
                                       RouterID(config->routerID),
                                       VlanID(config->vlanID),
                                       name,
                                       mac,
                                       mtu);
    intf->setAddresses(addrs);
    if (config->__isset.ndp) {
        intf->setNdpConfig(config->ndp);
    }
    return intf;
}
コード例 #7
0
void JabberPersonalInfoService::updatePersonalInfo(const QString &id, Buddy buddy)
{
	Q_UNUSED(id);

	if (!VCardService)
	{
		emit personalInfoUpdated(false);
		return;
	}

	CurrentBuddy = buddy;

	auto  vcard = QXmppVCardIq{};
	vcard.setFullName(CurrentBuddy.firstName());
	vcard.setNickName(CurrentBuddy.nickName());
	vcard.setMiddleName(CurrentBuddy.familyName());
	QDate birthday;
	birthday.setDate(CurrentBuddy.birthYear(), 1, 1);
	vcard.setBirthday(birthday);

	auto addr = QXmppVCardAddress{};
	addr.setLocality(CurrentBuddy.city());
	vcard.setAddresses({addr});

	auto email = QXmppVCardEmail{};
	email.setAddress(CurrentBuddy.email());
	vcard.setEmails({email});

	vcard.setUrl(CurrentBuddy.website());

	auto vCardUploader = VCardService->createVCardUploader();
	if (!vCardUploader)
	{
		emit personalInfoUpdated(false);
		return;
	}

	vCardUploader->uploadVCard(vcard);
	emit personalInfoUpdated(true);
}
コード例 #8
0
ファイル: net.c プロジェクト: duncanj/XDataPlugin
void resetSocket() {
    closeSocket();
    openSocket();
    setAddresses();
    bindSocket();
}