本文整理汇总了C++中Endpoint::AppendEndpoint方法的典型用法代码示例。如果您正苦于以下问题:C++ Endpoint::AppendEndpoint方法的具体用法?C++ Endpoint::AppendEndpoint怎么用?C++ Endpoint::AppendEndpoint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Endpoint
的用法示例。
在下文中一共展示了Endpoint::AppendEndpoint方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TestTopology2
void TestTopology2(Environment& aEnv, const std::vector<Brn>& aArgs)
{
if( find(aArgs.begin(), aArgs.end(), Brn("--path")) == aArgs.end() )
{
Log::Print("No path supplied!\n");
ASSERTS();
}
OptionParser parser;
OptionString optionServer("-s", "--server", Brn("eng"), "address of server to connect to");
parser.AddOption(&optionServer);
OptionUint optionPort("-p", "--port", 80, "server port to connect on");
parser.AddOption(&optionPort);
OptionString optionPath("", "--path", Brn(""), "path to use on server");
parser.AddOption(&optionPath);
if (!parser.Parse(aArgs) || parser.HelpDisplayed()) {
return;
}
TUint port = optionPort.Value();
ASSERT(port <= 65535);
Bwh uriBuf(100);
Endpoint endptServer = Endpoint(port, optionServer.Value());
uriBuf.Replace(Brn("http://"));
endptServer.AppendEndpoint(uriBuf);
uriBuf.Append(Brn("/"));
uriBuf.Append(optionPath.Value());
Uri uri(uriBuf);
auto reader = new HttpReader(aEnv);
TUint code = reader->Connect(uri);
if ((code < HttpStatus::kSuccessCodes) || (code >= HttpStatus::kRedirectionCodes))
{
Log::Print("Failed to connect \n");
ASSERTS();
}
ReaderUntilS<1024>* readerUntil = new ReaderUntilS<1024>(*reader);
Runner runner("Topology2 tests\n");
runner.Add(new SuiteTopology2(*readerUntil));
runner.Run();
delete readerUntil;
delete reader;
}
示例2: iDvStack
PropertyWriterUpnp::PropertyWriterUpnp(DvStack& aDvStack, const Endpoint& aPublisher, const Endpoint& aSubscriber,
const Brx& aSubscriberPath, const Brx& aSid, TUint aSequenceNumber)
: iDvStack(aDvStack)
{
iSocket.Open();
iSocket.Connect(aSubscriber, aDvStack.GetStack().InitParams().TcpConnectTimeoutMs());
iWriterChunked = new WriterHttpChunked(iSocket);
iWriteBuffer = new Sws<kMaxRequestBytes>(*iWriterChunked);
iWriterEvent = new WriterHttpRequest(*iWriteBuffer);
SetWriter(*iWriteBuffer);
iWriterEvent->WriteMethod(kUpnpMethodNotify, aSubscriberPath, Http::eHttp11);
IWriterAscii& writer = iWriterEvent->WriteHeaderField(Http::kHeaderHost);
Endpoint::EndpointBuf buf;
aPublisher.AppendEndpoint(buf);
writer.Write(buf);
writer.WriteFlush();
iWriterEvent->WriteHeader(Http::kHeaderContentType, Brn("text/xml; charset=\"utf-8\""));
iWriterEvent->WriteHeader(kUpnpHeaderNt, Brn("upnp:event"));
iWriterEvent->WriteHeader(kUpnpHeaderNts, Brn("upnp:propchange"));
writer = iWriterEvent->WriteHeaderField(HeaderSid::kHeaderSid);
writer.Write(HeaderSid::kFieldSidPrefix);
writer.Write(aSid);
writer.WriteFlush();
iWriterEvent->WriteHeader(Http::kHeaderTransferEncoding, Http::kTransferEncodingChunked);
writer = iWriterEvent->WriteHeaderField(kUpnpHeaderSeq);
writer.WriteUint(aSequenceNumber);
writer.WriteFlush();
iWriterEvent->WriteHeader(Http::kHeaderConnection, Http::kConnectionClose);
iWriterEvent->WriteFlush();
iWriterChunked->SetChunked(true);
iWriteBuffer->Write(Brn("<?xml version=\"1.0\"?>"));
iWriteBuffer->Write(Brn("<e:propertyset xmlns:e=\"urn:schemas-upnp-org:event-1-0\">"));
}
示例3: adapter
void OpenHome::TestFramework::Runner::Main(TInt aArgc, TChar* aArgv[], Net::InitialisationParams* aInitParams)
{
OptionParser parser;
OptionUint adapter("-i", "--interface", 0, "index of network adapter to use");
parser.AddOption(&adapter);
OptionBool send("-s", "--send", "Send");
parser.AddOption(&send);
OptionString endpoint("-a", "--address", Brn("239.255.255.250"), "Multicast address");
parser.AddOption(&endpoint);
OptionUint port("-p", "--port", 1968, "Multicast port");
parser.AddOption(&port);
if (!parser.Parse(aArgc, aArgv) || parser.HelpDisplayed()) {
return;
}
Net::UpnpLibrary::InitialiseMinimal(aInitParams);
std::vector<NetworkAdapter*>* ifs = Os::NetworkListAdapters(*Net::gStack, Net::InitialisationParams::ELoopbackExclude, "TestMulticast");
ASSERT(ifs->size() > 0 && adapter.Value() < ifs->size());
TIpAddress addr = (*ifs)[adapter.Value()]->Address();
for (TUint i=0; i<ifs->size(); i++) {
(*ifs)[i]->RemoveRef("TestMulticast");
}
delete ifs;
Endpoint endpt(0, addr);
Endpoint::AddressBuf buf;
endpt.AppendAddress(buf);
Print("Using network interface %s\n\n", buf.Ptr());
Endpoint multicast(port.Value(), endpoint.Value());
if (send.Value() == false) {
SocketUdpMulticast socket(addr, multicast);
Endpoint actual(socket.Port(), multicast.Address());
Bws<100> buf2;
actual.AppendEndpoint(buf2);
Print("Receiving from multicast endpoint %s\n", buf2.Ptr());
Bwh message(10000);
Endpoint sender = socket.Receive(message);
Bws<100> buf3;
sender.AppendEndpoint(buf3);
if (message == Brn("Test message")) {
Print("Received test messsge from %s\n", buf3.Ptr());
}
else {
Print("Received unrecognised messsge from %s\n", buf3.Ptr());
}
}
else {
if (multicast.Port() == 0) {
Print("Cannot send to port 0\n");
}
else {
Bws<100> buf2;
multicast.AppendEndpoint(buf2);
Print("Sending test message to %s\n", buf2.Ptr());
//SocketUdpMulticast socket(addr, multicast);
SocketUdp socket(0, addr);
socket.Send(Brn("Test message"), multicast);
}
}
Net::UpnpLibrary::Close();
}
示例4: PrintEndpoint
static void PrintEndpoint(const Endpoint& aEndpoint)
{
Endpoint::EndpointBuf buf;
aEndpoint.AppendEndpoint(buf);
Print("%s", buf.Ptr());
}