summaryrefslogblamecommitdiffstats
path: root/src/util/serviceDiscoveryUtil.h
blob: 537daeb5de3984378c587cc03f2d6f61b8837aa9 (plain) (tree)


















                                                                                     
#ifndef SERVICEDISCOVERYUTIL_H_
#define SERVICEDISCOVERYUTIL_H_

#include <QtCore/QString>
#include <QtCore/QHash>

typedef QHash<QString, QString> SdFields;

// These two functions build/parse the message format used in SD broadcasts
// It is some kind of key-value pairs, encoded as follows:
// <3 chars/bytes, key><1 byte, value length in bytes><up to 100 chars/bytes, value>
void appendSdField(QByteArray* target, const char* id, QString data);
SdFields parseSdFields(unsigned char* data, int len);

// This algorithm is supposed to generate a readable and maybe pronouncable
// string from the fingerprint of the servers certificate
QString sha1ToReadable(QByteArray input);

#endif /* SERVICEDISCOVERYUTIL_H_ */