linklocalclient.h
/*
Copyright (c) 2012-2023 by Jakob Schröter <js@camaya.net>
This file is part of the gloox library. http://camaya.net/gloox
This software is distributed under a license. The full license
agreement can be found in the file LICENSE in this distribution.
This software may not be copied, modified, sold or distributed
other than expressed in the named license agreement.
This software is distributed without any warranty.
*/
#ifndef LINKLOCALCLIENT_H__
#define LINKLOCALCLIENT_H__
#include "config.h"
#ifdef HAVE_MDNS
#include "client.h"
#include "jid.h"
#include <string>
#include <dns_sd.h>
namespace gloox
{
class Tag;
namespace LinkLocal
{
class Client : public gloox::Client
{
public:
Client( const JID& jid );
virtual ~Client();
bool connect();
bool connect( const std::string& service, const std::string& type, const std::string& domain, int iface = 0 );
virtual ConnectionError recv( int timeout = -1 );
// reimplemented from ConnectionDataHandler, overwriting ClientBase::handleConnect()
virtual void handleConnect( const ConnectionBase* connection );
protected:
// reimplemented from ClientBase
virtual void handleStartNode( const Tag* start );
private:
static void handleResolveReply( DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t interfaceIndex,
DNSServiceErrorType errorCode, const char *fullname, const char *hosttarget,
uint16_t port, uint16_t txtLen, const unsigned char *txtRecord, void *context );
static void handleQueryReply( DNSServiceRef sdRef, DNSServiceFlags flags, uint32_t interfaceIndex,
DNSServiceErrorType errorCode, const char *fullname, uint16_t rrtype,
uint16_t rrclass, uint16_t rdlen, const void *rdata, uint32_t ttl,
void *context );
bool resolve( const std::string& serviceName, const std::string& regtype, const std::string& replyDomain );
bool query( const std::string& hostname, int port );
void handleQuery( const std::string& addr );
void sendStart( const std::string& to );
DNSServiceRef m_qRef;
DNSServiceRef m_rRef;
DNSServiceRef m_currentRef;
std::string m_to;
int m_interface;
int m_port;
bool m_streamSent;
};
}
}
#endif // HAVE_MDNS
#endif // LINKLOCALCLIENT_H__
gloox::ClientBase::port
int port() const
Definition clientbase.h:221
gloox::ClientBase::jid
const JID & jid()
Definition clientbase.h:147
gloox::Client
This class implements a basic Jabber/XMPP Client.
Definition client.h:117
gloox::ConnectionBase
An abstract base class for a connection.
Definition connectionbase.h:35
gloox::JID
An abstraction of a JID.
Definition jid.h:31
gloox::LinkLocal::Client::~Client
virtual ~Client()
Definition linklocalclient.cpp:46
gloox::LinkLocal::Client::recv
virtual ConnectionError recv(int timeout=-1)
Definition linklocalclient.cpp:62
gloox::LinkLocal::Client::handleConnect
virtual void handleConnect(const ConnectionBase *connection)
Definition linklocalclient.cpp:181
gloox::LinkLocal::Client::Client
Client(const JID &jid)
Definition linklocalclient.cpp:40
gloox::LinkLocal::Client::connect
bool connect()
Definition linklocalclient.cpp:50
gloox::LinkLocal::Client::handleStartNode
virtual void handleStartNode(const Tag *start)
Definition linklocalclient.cpp:197
gloox::Tag
This is an abstraction of an XML element.
Definition tag.h:47
gloox::LinkLocal
Namespace holding all the Link-local-related structures and definitions.
Definition linklocal.h:33
gloox
The namespace for the gloox library.
Definition adhoc.cpp:28
gloox::ConnectionError
ConnectionError
Definition gloox.h:684