Removing QHttp class, its tests and its usage in examples.
Task-number: QTBUG-22750 Change-Id: I161fad772bfb26797e6ee9d69da925b6747c371f Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
This commit is contained in:
parent
7dca461620
commit
b3ce4470ae
4
dist/changes-5.0.0
vendored
4
dist/changes-5.0.0
vendored
@ -141,6 +141,10 @@ information about a particular change.
|
||||
* Removed implicit conversion operator QUuid::operator QString(), instead
|
||||
QUuid::toString() function should be used.
|
||||
|
||||
- The QHttp, QHttpHeader, QHttpResponseHeader and QHttpRequestHeader classes have
|
||||
been removed, QNetworkAccessManager should be used instead.
|
||||
|
||||
|
||||
****************************************************************************
|
||||
* General *
|
||||
****************************************************************************
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include "trackerclient.h"
|
||||
|
||||
#include <QtCore>
|
||||
#include <QNetworkRequest>
|
||||
|
||||
TrackerClient::TrackerClient(TorrentClient *downloader, QObject *parent)
|
||||
: QObject(parent), torrentDownloader(downloader)
|
||||
@ -56,7 +57,7 @@ TrackerClient::TrackerClient(TorrentClient *downloader, QObject *parent)
|
||||
lastTrackerRequest = false;
|
||||
firstSeeding = true;
|
||||
|
||||
connect(&http, SIGNAL(done(bool)), this, SLOT(httpRequestDone(bool)));
|
||||
connect(&http, SIGNAL(finished(QNetworkReply*)), this, SLOT(httpRequestDone(QNetworkReply*)));
|
||||
}
|
||||
|
||||
void TrackerClient::start(const MetaInfo &info)
|
||||
@ -82,14 +83,12 @@ void TrackerClient::startSeeding()
|
||||
void TrackerClient::stop()
|
||||
{
|
||||
lastTrackerRequest = true;
|
||||
http.abort();
|
||||
fetchPeerList();
|
||||
}
|
||||
|
||||
void TrackerClient::timerEvent(QTimerEvent *event)
|
||||
{
|
||||
if (event->timerId() == requestIntervalTimer) {
|
||||
if (http.state() == QHttp::Unconnected)
|
||||
fetchPeerList();
|
||||
} else {
|
||||
QObject::timerEvent(event);
|
||||
@ -148,32 +147,35 @@ void TrackerClient::fetchPeerList()
|
||||
if (!trackerId.isEmpty())
|
||||
query += "&trackerid=" + trackerId;
|
||||
|
||||
http.setHost(url.host(), url.port() == -1 ? 80 : url.port());
|
||||
if (!url.userName().isEmpty())
|
||||
http.setUser(url.userName(), url.password());
|
||||
http.get(query);
|
||||
QNetworkRequest req(url);
|
||||
if (!url.userName().isEmpty()) {
|
||||
uname = url.userName();
|
||||
pwd = url.password();
|
||||
connect(&http, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), this, SLOT(provideAuthentication(QNetworkReply*,QAuthenticator*)));
|
||||
}
|
||||
http.get(req);
|
||||
}
|
||||
|
||||
void TrackerClient::httpRequestDone(bool error)
|
||||
void TrackerClient::httpRequestDone(QNetworkReply *reply)
|
||||
{
|
||||
reply->deleteLater();
|
||||
if (lastTrackerRequest) {
|
||||
emit stopped();
|
||||
return;
|
||||
}
|
||||
|
||||
if (error) {
|
||||
emit connectionError(http.error());
|
||||
if (reply->error() != QNetworkReply::NoError) {
|
||||
emit connectionError(reply->error());
|
||||
return;
|
||||
}
|
||||
|
||||
QByteArray response = http.readAll();
|
||||
http.abort();
|
||||
QByteArray response = reply->readAll();
|
||||
reply->abort();
|
||||
|
||||
BencodeParser parser;
|
||||
if (!parser.parse(response)) {
|
||||
qWarning("Error parsing bencode response from tracker: %s",
|
||||
qPrintable(parser.errorString()));
|
||||
http.abort();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -234,3 +236,10 @@ void TrackerClient::httpRequestDone(bool error)
|
||||
emit peerListUpdated(peers);
|
||||
}
|
||||
}
|
||||
|
||||
void TrackerClient::provideAuthentication(QNetworkReply *reply, QAuthenticator *auth)
|
||||
{
|
||||
Q_UNUSED(reply);
|
||||
auth->setUser(uname);
|
||||
auth->setPassword(pwd);
|
||||
}
|
||||
|
@ -45,7 +45,9 @@
|
||||
#include <QList>
|
||||
#include <QObject>
|
||||
#include <QHostAddress>
|
||||
#include <QHttp>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkReply>
|
||||
#include <QAuthenticator>
|
||||
|
||||
#include "metainfo.h"
|
||||
#include "torrentclient.h"
|
||||
@ -64,7 +66,7 @@ public:
|
||||
void startSeeding();
|
||||
|
||||
signals:
|
||||
void connectionError(QHttp::Error error);
|
||||
void connectionError(QNetworkReply::NetworkError error);
|
||||
|
||||
void failure(const QString &reason);
|
||||
void warning(const QString &message);
|
||||
@ -80,20 +82,23 @@ protected:
|
||||
|
||||
private slots:
|
||||
void fetchPeerList();
|
||||
void httpRequestDone(bool error);
|
||||
void httpRequestDone(QNetworkReply *reply);
|
||||
void provideAuthentication(QNetworkReply *reply, QAuthenticator *auth);
|
||||
|
||||
private:
|
||||
TorrentClient *torrentDownloader;
|
||||
|
||||
int requestInterval;
|
||||
int requestIntervalTimer;
|
||||
QHttp http;
|
||||
QNetworkAccessManager http;
|
||||
MetaInfo metaInfo;
|
||||
QByteArray trackerId;
|
||||
QList<TorrentPeer> peers;
|
||||
qint64 uploadedBytes;
|
||||
qint64 downloadedBytes;
|
||||
qint64 length;
|
||||
QString uname;
|
||||
QString pwd;
|
||||
|
||||
bool firstTrackerRequest;
|
||||
bool lastTrackerRequest;
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
HEADERS += \
|
||||
access/qftp.h \
|
||||
access/qhttp.h \
|
||||
access/qhttpheader_p.h \
|
||||
access/qhttpnetworkheader_p.h \
|
||||
access/qhttpnetworkrequest_p.h \
|
||||
access/qhttpnetworkreply_p.h \
|
||||
@ -39,7 +39,7 @@ HEADERS += \
|
||||
|
||||
SOURCES += \
|
||||
access/qftp.cpp \
|
||||
access/qhttp.cpp \
|
||||
access/qhttpheader.cpp \
|
||||
access/qhttpnetworkheader.cpp \
|
||||
access/qhttpnetworkrequest.cpp \
|
||||
access/qhttpnetworkreply.cpp \
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,311 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the QtNetwork module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QHTTP_H
|
||||
#define QHTTP_H
|
||||
|
||||
#include <QtCore/qobject.h>
|
||||
#include <QtCore/qstringlist.h>
|
||||
#include <QtCore/qmap.h>
|
||||
#include <QtCore/qpair.h>
|
||||
#include <QtCore/qscopedpointer.h>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QT_MODULE(Network)
|
||||
|
||||
#ifndef QT_NO_HTTP
|
||||
|
||||
class QTcpSocket;
|
||||
class QTimerEvent;
|
||||
class QIODevice;
|
||||
class QAuthenticator;
|
||||
class QNetworkProxy;
|
||||
class QSslError;
|
||||
|
||||
class QHttpPrivate;
|
||||
|
||||
class QHttpHeaderPrivate;
|
||||
class Q_NETWORK_EXPORT QHttpHeader
|
||||
{
|
||||
public:
|
||||
QHttpHeader();
|
||||
QHttpHeader(const QHttpHeader &header);
|
||||
QHttpHeader(const QString &str);
|
||||
virtual ~QHttpHeader();
|
||||
|
||||
QHttpHeader &operator=(const QHttpHeader &h);
|
||||
|
||||
void setValue(const QString &key, const QString &value);
|
||||
void setValues(const QList<QPair<QString, QString> > &values);
|
||||
void addValue(const QString &key, const QString &value);
|
||||
QList<QPair<QString, QString> > values() const;
|
||||
bool hasKey(const QString &key) const;
|
||||
QStringList keys() const;
|
||||
QString value(const QString &key) const;
|
||||
QStringList allValues(const QString &key) const;
|
||||
void removeValue(const QString &key);
|
||||
void removeAllValues(const QString &key);
|
||||
|
||||
// ### Qt 5: change to qint64
|
||||
bool hasContentLength() const;
|
||||
uint contentLength() const;
|
||||
void setContentLength(int len);
|
||||
|
||||
bool hasContentType() const;
|
||||
QString contentType() const;
|
||||
void setContentType(const QString &type);
|
||||
|
||||
virtual QString toString() const;
|
||||
bool isValid() const;
|
||||
|
||||
virtual int majorVersion() const = 0;
|
||||
virtual int minorVersion() const = 0;
|
||||
|
||||
protected:
|
||||
virtual bool parseLine(const QString &line, int number);
|
||||
bool parse(const QString &str);
|
||||
void setValid(bool);
|
||||
|
||||
QHttpHeader(QHttpHeaderPrivate &dd, const QString &str = QString());
|
||||
QHttpHeader(QHttpHeaderPrivate &dd, const QHttpHeader &header);
|
||||
QScopedPointer<QHttpHeaderPrivate> d_ptr;
|
||||
|
||||
private:
|
||||
Q_DECLARE_PRIVATE(QHttpHeader)
|
||||
};
|
||||
|
||||
class QHttpResponseHeaderPrivate;
|
||||
class Q_NETWORK_EXPORT QHttpResponseHeader : public QHttpHeader
|
||||
{
|
||||
public:
|
||||
QHttpResponseHeader();
|
||||
QHttpResponseHeader(const QHttpResponseHeader &header);
|
||||
QHttpResponseHeader(const QString &str);
|
||||
QHttpResponseHeader(int code, const QString &text = QString(), int majorVer = 1, int minorVer = 1);
|
||||
QHttpResponseHeader &operator=(const QHttpResponseHeader &header);
|
||||
|
||||
void setStatusLine(int code, const QString &text = QString(), int majorVer = 1, int minorVer = 1);
|
||||
|
||||
int statusCode() const;
|
||||
QString reasonPhrase() const;
|
||||
|
||||
int majorVersion() const;
|
||||
int minorVersion() const;
|
||||
|
||||
QString toString() const;
|
||||
|
||||
protected:
|
||||
bool parseLine(const QString &line, int number);
|
||||
|
||||
private:
|
||||
Q_DECLARE_PRIVATE(QHttpResponseHeader)
|
||||
friend class QHttpPrivate;
|
||||
};
|
||||
|
||||
class QHttpRequestHeaderPrivate;
|
||||
class Q_NETWORK_EXPORT QHttpRequestHeader : public QHttpHeader
|
||||
{
|
||||
public:
|
||||
QHttpRequestHeader();
|
||||
QHttpRequestHeader(const QString &method, const QString &path, int majorVer = 1, int minorVer = 1);
|
||||
QHttpRequestHeader(const QHttpRequestHeader &header);
|
||||
QHttpRequestHeader(const QString &str);
|
||||
QHttpRequestHeader &operator=(const QHttpRequestHeader &header);
|
||||
|
||||
void setRequest(const QString &method, const QString &path, int majorVer = 1, int minorVer = 1);
|
||||
|
||||
QString method() const;
|
||||
QString path() const;
|
||||
|
||||
int majorVersion() const;
|
||||
int minorVersion() const;
|
||||
|
||||
QString toString() const;
|
||||
|
||||
protected:
|
||||
bool parseLine(const QString &line, int number);
|
||||
|
||||
private:
|
||||
Q_DECLARE_PRIVATE(QHttpRequestHeader)
|
||||
};
|
||||
|
||||
class Q_NETWORK_EXPORT QHttp : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum ConnectionMode {
|
||||
ConnectionModeHttp,
|
||||
ConnectionModeHttps
|
||||
};
|
||||
|
||||
explicit QHttp(QObject *parent = 0);
|
||||
QHttp(const QString &hostname, quint16 port = 80, QObject *parent = 0);
|
||||
QHttp(const QString &hostname, ConnectionMode mode, quint16 port = 0, QObject *parent = 0);
|
||||
virtual ~QHttp();
|
||||
|
||||
enum State {
|
||||
Unconnected,
|
||||
HostLookup,
|
||||
Connecting,
|
||||
Sending,
|
||||
Reading,
|
||||
Connected,
|
||||
Closing
|
||||
};
|
||||
enum Error {
|
||||
NoError,
|
||||
UnknownError,
|
||||
HostNotFound,
|
||||
ConnectionRefused,
|
||||
UnexpectedClose,
|
||||
InvalidResponseHeader,
|
||||
WrongContentLength,
|
||||
Aborted,
|
||||
AuthenticationRequiredError,
|
||||
ProxyAuthenticationRequiredError
|
||||
};
|
||||
|
||||
int setHost(const QString &hostname, quint16 port = 80);
|
||||
int setHost(const QString &hostname, ConnectionMode mode, quint16 port = 0);
|
||||
|
||||
int setSocket(QTcpSocket *socket);
|
||||
int setUser(const QString &username, const QString &password = QString());
|
||||
|
||||
#ifndef QT_NO_NETWORKPROXY
|
||||
int setProxy(const QString &host, int port,
|
||||
const QString &username = QString(),
|
||||
const QString &password = QString());
|
||||
int setProxy(const QNetworkProxy &proxy);
|
||||
#endif
|
||||
|
||||
int get(const QString &path, QIODevice *to=0);
|
||||
int post(const QString &path, QIODevice *data, QIODevice *to=0 );
|
||||
int post(const QString &path, const QByteArray &data, QIODevice *to=0);
|
||||
int head(const QString &path);
|
||||
int request(const QHttpRequestHeader &header, QIODevice *device=0, QIODevice *to=0);
|
||||
int request(const QHttpRequestHeader &header, const QByteArray &data, QIODevice *to=0);
|
||||
|
||||
int closeConnection();
|
||||
int close();
|
||||
|
||||
qint64 bytesAvailable() const;
|
||||
qint64 read(char *data, qint64 maxlen);
|
||||
QByteArray readAll();
|
||||
|
||||
int currentId() const;
|
||||
QIODevice *currentSourceDevice() const;
|
||||
QIODevice *currentDestinationDevice() const;
|
||||
QHttpRequestHeader currentRequest() const;
|
||||
QHttpResponseHeader lastResponse() const;
|
||||
bool hasPendingRequests() const;
|
||||
void clearPendingRequests();
|
||||
|
||||
State state() const;
|
||||
|
||||
Error error() const;
|
||||
QString errorString() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
void abort();
|
||||
|
||||
#ifndef QT_NO_OPENSSL
|
||||
void ignoreSslErrors();
|
||||
#endif
|
||||
|
||||
Q_SIGNALS:
|
||||
void stateChanged(int);
|
||||
void responseHeaderReceived(const QHttpResponseHeader &resp);
|
||||
void readyRead(const QHttpResponseHeader &resp);
|
||||
|
||||
// ### Qt 5: change to qint64
|
||||
void dataSendProgress(int, int);
|
||||
void dataReadProgress(int, int);
|
||||
|
||||
void requestStarted(int);
|
||||
void requestFinished(int, bool);
|
||||
void done(bool);
|
||||
|
||||
#ifndef QT_NO_NETWORKPROXY
|
||||
void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *);
|
||||
#endif
|
||||
void authenticationRequired(const QString &hostname, quint16 port, QAuthenticator *);
|
||||
|
||||
#ifndef QT_NO_OPENSSL
|
||||
void sslErrors(const QList<QSslError> &errors);
|
||||
#endif
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(QHttp)
|
||||
Q_DECLARE_PRIVATE(QHttp)
|
||||
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_startNextRequest())
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_slotReadyRead())
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_slotConnected())
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_slotError(QAbstractSocket::SocketError))
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_slotClosed())
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_slotBytesWritten(qint64 numBytes))
|
||||
#ifndef QT_NO_OPENSSL
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_slotEncryptedBytesWritten(qint64 numBytes))
|
||||
#endif
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_slotDoFinished())
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_slotSendRequest())
|
||||
Q_PRIVATE_SLOT(d_func(), void _q_continuePost())
|
||||
|
||||
friend class QHttpNormalRequest;
|
||||
friend class QHttpSetHostRequest;
|
||||
friend class QHttpSetSocketRequest;
|
||||
friend class QHttpSetUserRequest;
|
||||
friend class QHttpSetProxyRequest;
|
||||
friend class QHttpCloseRequest;
|
||||
friend class QHttpPGHRequest;
|
||||
};
|
||||
|
||||
#endif // QT_NO_HTTP
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // QHTTP_H
|
770
src/network/access/qhttpheader.cpp
Normal file
770
src/network/access/qhttpheader.cpp
Normal file
@ -0,0 +1,770 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the QtNetwork module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
//#define QHTTP_DEBUG
|
||||
|
||||
#include <qplatformdefs.h>
|
||||
#include "qhttpheader_p.h"
|
||||
|
||||
#ifndef QT_NO_HTTP
|
||||
# include "private/qobject_p.h"
|
||||
# include "qtcpsocket.h"
|
||||
# include "qsslsocket.h"
|
||||
# include "qtextstream.h"
|
||||
# include "qmap.h"
|
||||
# include "qlist.h"
|
||||
# include "qstring.h"
|
||||
# include "qstringlist.h"
|
||||
# include "qbuffer.h"
|
||||
# include "private/qringbuffer_p.h"
|
||||
# include "qcoreevent.h"
|
||||
# include "qurl.h"
|
||||
# include "qnetworkproxy.h"
|
||||
# include "qauthenticator.h"
|
||||
# include "qauthenticator_p.h"
|
||||
# include "qdebug.h"
|
||||
# include "qtimer.h"
|
||||
#endif
|
||||
|
||||
#ifndef QT_NO_HTTP
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QHttpHeaderPrivate
|
||||
{
|
||||
Q_DECLARE_PUBLIC(QHttpHeader)
|
||||
public:
|
||||
inline virtual ~QHttpHeaderPrivate() {}
|
||||
|
||||
QList<QPair<QString, QString> > values;
|
||||
bool valid;
|
||||
QHttpHeader *q_ptr;
|
||||
};
|
||||
|
||||
/****************************************************
|
||||
*
|
||||
* QHttpHeader
|
||||
*
|
||||
****************************************************/
|
||||
|
||||
/*!
|
||||
\class QHttpHeader
|
||||
\obsolete
|
||||
\brief The QHttpHeader class contains header information for HTTP.
|
||||
|
||||
\ingroup network
|
||||
\inmodule QtNetwork
|
||||
|
||||
In most cases you should use the more specialized derivatives of
|
||||
this class, QHttpResponseHeader and QHttpRequestHeader, rather
|
||||
than directly using QHttpHeader.
|
||||
|
||||
QHttpHeader provides the HTTP header fields. A HTTP header field
|
||||
consists of a name followed by a colon, a single space, and the
|
||||
field value. (See RFC 1945.) Field names are case-insensitive. A
|
||||
typical header field looks like this:
|
||||
\snippet doc/src/snippets/code/src_network_access_qhttp.cpp 0
|
||||
|
||||
In the API the header field name is called the "key" and the
|
||||
content is called the "value". You can get and set a header
|
||||
field's value by using its key with value() and setValue(), e.g.
|
||||
\snippet doc/src/snippets/code/src_network_access_qhttp.cpp 1
|
||||
|
||||
Some fields are so common that getters and setters are provided
|
||||
for them as a convenient alternative to using \l value() and
|
||||
\l setValue(), e.g. contentLength() and contentType(),
|
||||
setContentLength() and setContentType().
|
||||
|
||||
Each header key has a \e single value associated with it. If you
|
||||
set the value for a key which already exists the previous value
|
||||
will be discarded.
|
||||
|
||||
\sa QHttpRequestHeader QHttpResponseHeader
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn int QHttpHeader::majorVersion() const
|
||||
|
||||
Returns the major protocol-version of the HTTP header.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn int QHttpHeader::minorVersion() const
|
||||
|
||||
Returns the minor protocol-version of the HTTP header.
|
||||
*/
|
||||
|
||||
/*!
|
||||
Constructs an empty HTTP header.
|
||||
*/
|
||||
QHttpHeader::QHttpHeader()
|
||||
: d_ptr(new QHttpHeaderPrivate)
|
||||
{
|
||||
Q_D(QHttpHeader);
|
||||
d->q_ptr = this;
|
||||
d->valid = true;
|
||||
}
|
||||
|
||||
/*!
|
||||
Constructs a copy of \a header.
|
||||
*/
|
||||
QHttpHeader::QHttpHeader(const QHttpHeader &header)
|
||||
: d_ptr(new QHttpHeaderPrivate)
|
||||
{
|
||||
Q_D(QHttpHeader);
|
||||
d->q_ptr = this;
|
||||
d->valid = header.d_func()->valid;
|
||||
d->values = header.d_func()->values;
|
||||
}
|
||||
|
||||
/*!
|
||||
Constructs a HTTP header for \a str.
|
||||
|
||||
This constructor parses the string \a str for header fields and
|
||||
adds this information. The \a str should consist of one or more
|
||||
"\r\n" delimited lines; each of these lines should have the format
|
||||
key, colon, space, value.
|
||||
*/
|
||||
QHttpHeader::QHttpHeader(const QString &str)
|
||||
: d_ptr(new QHttpHeaderPrivate)
|
||||
{
|
||||
Q_D(QHttpHeader);
|
||||
d->q_ptr = this;
|
||||
d->valid = true;
|
||||
parse(str);
|
||||
}
|
||||
|
||||
/*! \internal
|
||||
*/
|
||||
QHttpHeader::QHttpHeader(QHttpHeaderPrivate &dd, const QString &str)
|
||||
: d_ptr(&dd)
|
||||
{
|
||||
Q_D(QHttpHeader);
|
||||
d->q_ptr = this;
|
||||
d->valid = true;
|
||||
if (!str.isEmpty())
|
||||
parse(str);
|
||||
}
|
||||
|
||||
/*! \internal
|
||||
*/
|
||||
QHttpHeader::QHttpHeader(QHttpHeaderPrivate &dd, const QHttpHeader &header)
|
||||
: d_ptr(&dd)
|
||||
{
|
||||
Q_D(QHttpHeader);
|
||||
d->q_ptr = this;
|
||||
d->valid = header.d_func()->valid;
|
||||
d->values = header.d_func()->values;
|
||||
}
|
||||
/*!
|
||||
Destructor.
|
||||
*/
|
||||
QHttpHeader::~QHttpHeader()
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
Assigns \a h and returns a reference to this http header.
|
||||
*/
|
||||
QHttpHeader &QHttpHeader::operator=(const QHttpHeader &h)
|
||||
{
|
||||
Q_D(QHttpHeader);
|
||||
d->values = h.d_func()->values;
|
||||
d->valid = h.d_func()->valid;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns true if the HTTP header is valid; otherwise returns false.
|
||||
|
||||
A QHttpHeader is invalid if it was created by parsing a malformed string.
|
||||
*/
|
||||
bool QHttpHeader::isValid() const
|
||||
{
|
||||
Q_D(const QHttpHeader);
|
||||
return d->valid;
|
||||
}
|
||||
|
||||
/*! \internal
|
||||
Parses the HTTP header string \a str for header fields and adds
|
||||
the keys/values it finds. If the string is not parsed successfully
|
||||
the QHttpHeader becomes \link isValid() invalid\endlink.
|
||||
|
||||
Returns true if \a str was successfully parsed; otherwise returns false.
|
||||
|
||||
\sa toString()
|
||||
*/
|
||||
bool QHttpHeader::parse(const QString &str)
|
||||
{
|
||||
Q_D(QHttpHeader);
|
||||
QStringList lst;
|
||||
int pos = str.indexOf(QLatin1Char('\n'));
|
||||
if (pos > 0 && str.at(pos - 1) == QLatin1Char('\r'))
|
||||
lst = str.trimmed().split(QLatin1String("\r\n"));
|
||||
else
|
||||
lst = str.trimmed().split(QLatin1String("\n"));
|
||||
lst.removeAll(QString()); // No empties
|
||||
|
||||
if (lst.isEmpty())
|
||||
return true;
|
||||
|
||||
QStringList lines;
|
||||
QStringList::Iterator it = lst.begin();
|
||||
for (; it != lst.end(); ++it) {
|
||||
if (!(*it).isEmpty()) {
|
||||
if ((*it)[0].isSpace()) {
|
||||
if (!lines.isEmpty()) {
|
||||
lines.last() += QLatin1Char(' ');
|
||||
lines.last() += (*it).trimmed();
|
||||
}
|
||||
} else {
|
||||
lines.append((*it));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int number = 0;
|
||||
it = lines.begin();
|
||||
for (; it != lines.end(); ++it) {
|
||||
if (!parseLine(*it, number++)) {
|
||||
d->valid = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/*! \internal
|
||||
*/
|
||||
void QHttpHeader::setValid(bool v)
|
||||
{
|
||||
Q_D(QHttpHeader);
|
||||
d->valid = v;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the first value for the entry with the given \a key. If no entry
|
||||
has this \a key, an empty string is returned.
|
||||
|
||||
\sa setValue() removeValue() hasKey() keys()
|
||||
*/
|
||||
QString QHttpHeader::value(const QString &key) const
|
||||
{
|
||||
Q_D(const QHttpHeader);
|
||||
QString lowercaseKey = key.toLower();
|
||||
QList<QPair<QString, QString> >::ConstIterator it = d->values.constBegin();
|
||||
while (it != d->values.constEnd()) {
|
||||
if ((*it).first.toLower() == lowercaseKey)
|
||||
return (*it).second;
|
||||
++it;
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns all the entries with the given \a key. If no entry
|
||||
has this \a key, an empty string list is returned.
|
||||
*/
|
||||
QStringList QHttpHeader::allValues(const QString &key) const
|
||||
{
|
||||
Q_D(const QHttpHeader);
|
||||
QString lowercaseKey = key.toLower();
|
||||
QStringList valueList;
|
||||
QList<QPair<QString, QString> >::ConstIterator it = d->values.constBegin();
|
||||
while (it != d->values.constEnd()) {
|
||||
if ((*it).first.toLower() == lowercaseKey)
|
||||
valueList.append((*it).second);
|
||||
++it;
|
||||
}
|
||||
return valueList;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns a list of the keys in the HTTP header.
|
||||
|
||||
\sa hasKey()
|
||||
*/
|
||||
QStringList QHttpHeader::keys() const
|
||||
{
|
||||
Q_D(const QHttpHeader);
|
||||
QStringList keyList;
|
||||
QSet<QString> seenKeys;
|
||||
QList<QPair<QString, QString> >::ConstIterator it = d->values.constBegin();
|
||||
while (it != d->values.constEnd()) {
|
||||
const QString &key = (*it).first;
|
||||
QString lowercaseKey = key.toLower();
|
||||
if (!seenKeys.contains(lowercaseKey)) {
|
||||
keyList.append(key);
|
||||
seenKeys.insert(lowercaseKey);
|
||||
}
|
||||
++it;
|
||||
}
|
||||
return keyList;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns true if the HTTP header has an entry with the given \a
|
||||
key; otherwise returns false.
|
||||
|
||||
\sa value() setValue() keys()
|
||||
*/
|
||||
bool QHttpHeader::hasKey(const QString &key) const
|
||||
{
|
||||
Q_D(const QHttpHeader);
|
||||
QString lowercaseKey = key.toLower();
|
||||
QList<QPair<QString, QString> >::ConstIterator it = d->values.constBegin();
|
||||
while (it != d->values.constEnd()) {
|
||||
if ((*it).first.toLower() == lowercaseKey)
|
||||
return true;
|
||||
++it;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the value of the entry with the \a key to \a value.
|
||||
|
||||
If no entry with \a key exists, a new entry with the given \a key
|
||||
and \a value is created. If an entry with the \a key already
|
||||
exists, the first value is discarded and replaced with the given
|
||||
\a value.
|
||||
|
||||
\sa value() hasKey() removeValue()
|
||||
*/
|
||||
void QHttpHeader::setValue(const QString &key, const QString &value)
|
||||
{
|
||||
Q_D(QHttpHeader);
|
||||
QString lowercaseKey = key.toLower();
|
||||
QList<QPair<QString, QString> >::Iterator it = d->values.begin();
|
||||
while (it != d->values.end()) {
|
||||
if ((*it).first.toLower() == lowercaseKey) {
|
||||
(*it).second = value;
|
||||
return;
|
||||
}
|
||||
++it;
|
||||
}
|
||||
// not found so add
|
||||
addValue(key, value);
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the header entries to be the list of key value pairs in \a values.
|
||||
*/
|
||||
void QHttpHeader::setValues(const QList<QPair<QString, QString> > &values)
|
||||
{
|
||||
Q_D(QHttpHeader);
|
||||
d->values = values;
|
||||
}
|
||||
|
||||
/*!
|
||||
Adds a new entry with the \a key and \a value.
|
||||
*/
|
||||
void QHttpHeader::addValue(const QString &key, const QString &value)
|
||||
{
|
||||
Q_D(QHttpHeader);
|
||||
d->values.append(qMakePair(key, value));
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns all the entries in the header.
|
||||
*/
|
||||
QList<QPair<QString, QString> > QHttpHeader::values() const
|
||||
{
|
||||
Q_D(const QHttpHeader);
|
||||
return d->values;
|
||||
}
|
||||
|
||||
/*!
|
||||
Removes the entry with the key \a key from the HTTP header.
|
||||
|
||||
\sa value() setValue()
|
||||
*/
|
||||
void QHttpHeader::removeValue(const QString &key)
|
||||
{
|
||||
Q_D(QHttpHeader);
|
||||
QString lowercaseKey = key.toLower();
|
||||
QList<QPair<QString, QString> >::Iterator it = d->values.begin();
|
||||
while (it != d->values.end()) {
|
||||
if ((*it).first.toLower() == lowercaseKey) {
|
||||
d->values.erase(it);
|
||||
return;
|
||||
}
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
Removes all the entries with the key \a key from the HTTP header.
|
||||
*/
|
||||
void QHttpHeader::removeAllValues(const QString &key)
|
||||
{
|
||||
Q_D(QHttpHeader);
|
||||
QString lowercaseKey = key.toLower();
|
||||
QList<QPair<QString, QString> >::Iterator it = d->values.begin();
|
||||
while (it != d->values.end()) {
|
||||
if ((*it).first.toLower() == lowercaseKey) {
|
||||
it = d->values.erase(it);
|
||||
continue;
|
||||
}
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
/*! \internal
|
||||
Parses the single HTTP header line \a line which has the format
|
||||
key, colon, space, value, and adds key/value to the headers. The
|
||||
linenumber is \a number. Returns true if the line was successfully
|
||||
parsed and the key/value added; otherwise returns false.
|
||||
|
||||
\sa parse()
|
||||
*/
|
||||
bool QHttpHeader::parseLine(const QString &line, int)
|
||||
{
|
||||
int i = line.indexOf(QLatin1Char(':'));
|
||||
if (i == -1)
|
||||
return false;
|
||||
|
||||
addValue(line.left(i).trimmed(), line.mid(i + 1).trimmed());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns a string representation of the HTTP header.
|
||||
|
||||
The string is suitable for use by the constructor that takes a
|
||||
QString. It consists of lines with the format: key, colon, space,
|
||||
value, "\r\n".
|
||||
*/
|
||||
QString QHttpHeader::toString() const
|
||||
{
|
||||
Q_D(const QHttpHeader);
|
||||
if (!isValid())
|
||||
return QLatin1String("");
|
||||
|
||||
QString ret = QLatin1String("");
|
||||
|
||||
QList<QPair<QString, QString> >::ConstIterator it = d->values.constBegin();
|
||||
while (it != d->values.constEnd()) {
|
||||
ret += (*it).first + QLatin1String(": ") + (*it).second + QLatin1String("\r\n");
|
||||
++it;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns true if the header has an entry for the special HTTP
|
||||
header field \c content-length; otherwise returns false.
|
||||
|
||||
\sa contentLength() setContentLength()
|
||||
*/
|
||||
bool QHttpHeader::hasContentLength() const
|
||||
{
|
||||
return hasKey(QLatin1String("content-length"));
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the value of the special HTTP header field \c
|
||||
content-length.
|
||||
|
||||
\sa setContentLength() hasContentLength()
|
||||
*/
|
||||
uint QHttpHeader::contentLength() const
|
||||
{
|
||||
return value(QLatin1String("content-length")).toUInt();
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the value of the special HTTP header field \c content-length
|
||||
to \a len.
|
||||
|
||||
\sa contentLength() hasContentLength()
|
||||
*/
|
||||
void QHttpHeader::setContentLength(int len)
|
||||
{
|
||||
setValue(QLatin1String("content-length"), QString::number(len));
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns true if the header has an entry for the special HTTP
|
||||
header field \c content-type; otherwise returns false.
|
||||
|
||||
\sa contentType() setContentType()
|
||||
*/
|
||||
bool QHttpHeader::hasContentType() const
|
||||
{
|
||||
return hasKey(QLatin1String("content-type"));
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the value of the special HTTP header field \c content-type.
|
||||
|
||||
\sa setContentType() hasContentType()
|
||||
*/
|
||||
QString QHttpHeader::contentType() const
|
||||
{
|
||||
QString type = value(QLatin1String("content-type"));
|
||||
if (type.isEmpty())
|
||||
return QString();
|
||||
|
||||
int pos = type.indexOf(QLatin1Char(';'));
|
||||
if (pos == -1)
|
||||
return type;
|
||||
|
||||
return type.left(pos).trimmed();
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the value of the special HTTP header field \c content-type to
|
||||
\a type.
|
||||
|
||||
\sa contentType() hasContentType()
|
||||
*/
|
||||
void QHttpHeader::setContentType(const QString &type)
|
||||
{
|
||||
setValue(QLatin1String("content-type"), type);
|
||||
}
|
||||
|
||||
class QHttpResponseHeaderPrivate : public QHttpHeaderPrivate
|
||||
{
|
||||
Q_DECLARE_PUBLIC(QHttpResponseHeader)
|
||||
public:
|
||||
int statCode;
|
||||
QString reasonPhr;
|
||||
int majVer;
|
||||
int minVer;
|
||||
};
|
||||
|
||||
/****************************************************
|
||||
*
|
||||
* QHttpResponseHeader
|
||||
*
|
||||
****************************************************/
|
||||
|
||||
/*!
|
||||
\class QHttpResponseHeader
|
||||
\obsolete
|
||||
\brief The QHttpResponseHeader class contains response header information for HTTP.
|
||||
|
||||
\ingroup network
|
||||
\inmodule QtNetwork
|
||||
|
||||
HTTP responses have a status code that indicates the status of the
|
||||
response. This code is a 3-digit integer result code (for details
|
||||
see to RFC 1945). In addition to the status code, you can also
|
||||
specify a human-readable text that describes the reason for the
|
||||
code ("reason phrase"). This class allows you to get the status
|
||||
code and the reason phrase.
|
||||
|
||||
\sa QHttpRequestHeader, {HTTP Example}
|
||||
*/
|
||||
|
||||
/*!
|
||||
Constructs an empty HTTP response header.
|
||||
*/
|
||||
QHttpResponseHeader::QHttpResponseHeader()
|
||||
: QHttpHeader(*new QHttpResponseHeaderPrivate)
|
||||
{
|
||||
setValid(false);
|
||||
}
|
||||
|
||||
/*!
|
||||
Constructs a copy of \a header.
|
||||
*/
|
||||
QHttpResponseHeader::QHttpResponseHeader(const QHttpResponseHeader &header)
|
||||
: QHttpHeader(*new QHttpResponseHeaderPrivate, header)
|
||||
{
|
||||
Q_D(QHttpResponseHeader);
|
||||
d->statCode = header.d_func()->statCode;
|
||||
d->reasonPhr = header.d_func()->reasonPhr;
|
||||
d->majVer = header.d_func()->majVer;
|
||||
d->minVer = header.d_func()->minVer;
|
||||
}
|
||||
|
||||
/*!
|
||||
Copies the contents of \a header into this QHttpResponseHeader.
|
||||
*/
|
||||
QHttpResponseHeader &QHttpResponseHeader::operator=(const QHttpResponseHeader &header)
|
||||
{
|
||||
Q_D(QHttpResponseHeader);
|
||||
QHttpHeader::operator=(header);
|
||||
d->statCode = header.d_func()->statCode;
|
||||
d->reasonPhr = header.d_func()->reasonPhr;
|
||||
d->majVer = header.d_func()->majVer;
|
||||
d->minVer = header.d_func()->minVer;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*!
|
||||
Constructs a HTTP response header from the string \a str. The
|
||||
string is parsed and the information is set. The \a str should
|
||||
consist of one or more "\r\n" delimited lines; the first line should be the
|
||||
status-line (format: HTTP-version, space, status-code, space,
|
||||
reason-phrase); each of remaining lines should have the format key, colon,
|
||||
space, value.
|
||||
*/
|
||||
QHttpResponseHeader::QHttpResponseHeader(const QString &str)
|
||||
: QHttpHeader(*new QHttpResponseHeaderPrivate)
|
||||
{
|
||||
parse(str);
|
||||
}
|
||||
|
||||
/*!
|
||||
\since 4.1
|
||||
|
||||
Constructs a QHttpResponseHeader, setting the status code to \a code, the
|
||||
reason phrase to \a text and the protocol-version to \a majorVer and \a
|
||||
minorVer.
|
||||
|
||||
\sa statusCode() reasonPhrase() majorVersion() minorVersion()
|
||||
*/
|
||||
QHttpResponseHeader::QHttpResponseHeader(int code, const QString &text, int majorVer, int minorVer)
|
||||
: QHttpHeader(*new QHttpResponseHeaderPrivate)
|
||||
{
|
||||
setStatusLine(code, text, majorVer, minorVer);
|
||||
}
|
||||
|
||||
/*!
|
||||
\since 4.1
|
||||
|
||||
Sets the status code to \a code, the reason phrase to \a text and
|
||||
the protocol-version to \a majorVer and \a minorVer.
|
||||
|
||||
\sa statusCode() reasonPhrase() majorVersion() minorVersion()
|
||||
*/
|
||||
void QHttpResponseHeader::setStatusLine(int code, const QString &text, int majorVer, int minorVer)
|
||||
{
|
||||
Q_D(QHttpResponseHeader);
|
||||
setValid(true);
|
||||
d->statCode = code;
|
||||
d->reasonPhr = text;
|
||||
d->majVer = majorVer;
|
||||
d->minVer = minorVer;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the status code of the HTTP response header.
|
||||
|
||||
\sa reasonPhrase() majorVersion() minorVersion()
|
||||
*/
|
||||
int QHttpResponseHeader::statusCode() const
|
||||
{
|
||||
Q_D(const QHttpResponseHeader);
|
||||
return d->statCode;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the reason phrase of the HTTP response header.
|
||||
|
||||
\sa statusCode() majorVersion() minorVersion()
|
||||
*/
|
||||
QString QHttpResponseHeader::reasonPhrase() const
|
||||
{
|
||||
Q_D(const QHttpResponseHeader);
|
||||
return d->reasonPhr;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the major protocol-version of the HTTP response header.
|
||||
|
||||
\sa minorVersion() statusCode() reasonPhrase()
|
||||
*/
|
||||
int QHttpResponseHeader::majorVersion() const
|
||||
{
|
||||
Q_D(const QHttpResponseHeader);
|
||||
return d->majVer;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the minor protocol-version of the HTTP response header.
|
||||
|
||||
\sa majorVersion() statusCode() reasonPhrase()
|
||||
*/
|
||||
int QHttpResponseHeader::minorVersion() const
|
||||
{
|
||||
Q_D(const QHttpResponseHeader);
|
||||
return d->minVer;
|
||||
}
|
||||
|
||||
/*! \internal
|
||||
*/
|
||||
bool QHttpResponseHeader::parseLine(const QString &line, int number)
|
||||
{
|
||||
Q_D(QHttpResponseHeader);
|
||||
if (number != 0)
|
||||
return QHttpHeader::parseLine(line, number);
|
||||
|
||||
QString l = line.simplified();
|
||||
if (l.length() < 10)
|
||||
return false;
|
||||
|
||||
if (l.left(5) == QLatin1String("HTTP/") && l[5].isDigit() && l[6] == QLatin1Char('.') &&
|
||||
l[7].isDigit() && l[8] == QLatin1Char(' ') && l[9].isDigit()) {
|
||||
d->majVer = l[5].toLatin1() - '0';
|
||||
d->minVer = l[7].toLatin1() - '0';
|
||||
|
||||
int pos = l.indexOf(QLatin1Char(' '), 9);
|
||||
if (pos != -1) {
|
||||
d->reasonPhr = l.mid(pos + 1);
|
||||
d->statCode = l.mid(9, pos - 9).toInt();
|
||||
} else {
|
||||
d->statCode = l.mid(9).toInt();
|
||||
d->reasonPhr.clear();
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*! \reimp
|
||||
*/
|
||||
QString QHttpResponseHeader::toString() const
|
||||
{
|
||||
Q_D(const QHttpResponseHeader);
|
||||
QString ret(QLatin1String("HTTP/%1.%2 %3 %4\r\n%5\r\n"));
|
||||
return ret.arg(d->majVer).arg(d->minVer).arg(d->statCode).arg(d->reasonPhr).arg(QHttpHeader::toString());
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif
|
147
src/network/access/qhttpheader_p.h
Normal file
147
src/network/access/qhttpheader_p.h
Normal file
@ -0,0 +1,147 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the QtNetwork module of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QHTTP_H
|
||||
#define QHTTP_H
|
||||
|
||||
#include <QtCore/qobject.h>
|
||||
#include <QtCore/qstringlist.h>
|
||||
#include <QtCore/qmap.h>
|
||||
#include <QtCore/qpair.h>
|
||||
#include <QtCore/qscopedpointer.h>
|
||||
|
||||
QT_BEGIN_HEADER
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QT_MODULE(Network)
|
||||
|
||||
#ifndef QT_NO_HTTP
|
||||
|
||||
#if 0
|
||||
#pragma qt_class(QHttp)
|
||||
#endif
|
||||
|
||||
class QHttpHeaderPrivate;
|
||||
class QHttpHeader
|
||||
{
|
||||
public:
|
||||
QHttpHeader();
|
||||
QHttpHeader(const QHttpHeader &header);
|
||||
QHttpHeader(const QString &str);
|
||||
virtual ~QHttpHeader();
|
||||
|
||||
QHttpHeader &operator=(const QHttpHeader &h);
|
||||
|
||||
void setValue(const QString &key, const QString &value);
|
||||
void setValues(const QList<QPair<QString, QString> > &values);
|
||||
void addValue(const QString &key, const QString &value);
|
||||
QList<QPair<QString, QString> > values() const;
|
||||
bool hasKey(const QString &key) const;
|
||||
QStringList keys() const;
|
||||
QString value(const QString &key) const;
|
||||
QStringList allValues(const QString &key) const;
|
||||
void removeValue(const QString &key);
|
||||
void removeAllValues(const QString &key);
|
||||
|
||||
// ### Qt 5: change to qint64
|
||||
bool hasContentLength() const;
|
||||
uint contentLength() const;
|
||||
void setContentLength(int len);
|
||||
|
||||
bool hasContentType() const;
|
||||
QString contentType() const;
|
||||
void setContentType(const QString &type);
|
||||
|
||||
virtual QString toString() const;
|
||||
bool isValid() const;
|
||||
|
||||
virtual int majorVersion() const = 0;
|
||||
virtual int minorVersion() const = 0;
|
||||
|
||||
protected:
|
||||
virtual bool parseLine(const QString &line, int number);
|
||||
bool parse(const QString &str);
|
||||
void setValid(bool);
|
||||
|
||||
QHttpHeader(QHttpHeaderPrivate &dd, const QString &str = QString());
|
||||
QHttpHeader(QHttpHeaderPrivate &dd, const QHttpHeader &header);
|
||||
QScopedPointer<QHttpHeaderPrivate> d_ptr;
|
||||
|
||||
private:
|
||||
Q_DECLARE_PRIVATE(QHttpHeader)
|
||||
};
|
||||
|
||||
class QHttpResponseHeaderPrivate;
|
||||
class QHttpResponseHeader : public QHttpHeader
|
||||
{
|
||||
public:
|
||||
QHttpResponseHeader();
|
||||
QHttpResponseHeader(const QHttpResponseHeader &header);
|
||||
QHttpResponseHeader(const QString &str);
|
||||
QHttpResponseHeader(int code, const QString &text = QString(), int majorVer = 1, int minorVer = 1);
|
||||
QHttpResponseHeader &operator=(const QHttpResponseHeader &header);
|
||||
|
||||
void setStatusLine(int code, const QString &text = QString(), int majorVer = 1, int minorVer = 1);
|
||||
|
||||
int statusCode() const;
|
||||
QString reasonPhrase() const;
|
||||
|
||||
int majorVersion() const;
|
||||
int minorVersion() const;
|
||||
|
||||
QString toString() const;
|
||||
|
||||
protected:
|
||||
bool parseLine(const QString &line, int number);
|
||||
|
||||
private:
|
||||
Q_DECLARE_PRIVATE(QHttpResponseHeader)
|
||||
friend class QHttpPrivate;
|
||||
};
|
||||
|
||||
#endif // QT_NO_HTTP
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
QT_END_HEADER
|
||||
|
||||
#endif // QHTTP_H
|
@ -53,7 +53,6 @@
|
||||
|
||||
#include <qbuffer.h>
|
||||
#include <qpair.h>
|
||||
#include <qhttp.h>
|
||||
#include <qdebug.h>
|
||||
|
||||
#ifndef QT_NO_HTTP
|
||||
|
@ -45,7 +45,7 @@
|
||||
#include <qhash.h>
|
||||
#include <qbytearray.h>
|
||||
#include <qcryptographichash.h>
|
||||
#include <qhttp.h>
|
||||
#include <private/qhttpheader_p.h>
|
||||
#include <qiodevice.h>
|
||||
#include <qdatastream.h>
|
||||
#include <qendian.h>
|
||||
|
@ -43,7 +43,7 @@
|
||||
#include "qtcpsocket.h"
|
||||
#include "qhostaddress.h"
|
||||
#include "qurl.h"
|
||||
#include "qhttp.h"
|
||||
#include "private/qhttpheader_p.h"
|
||||
#include "qelapsedtimer.h"
|
||||
#include "qnetworkinterface.h"
|
||||
|
||||
|
@ -398,10 +398,8 @@ QT_CLASS_LIB(QXmlStreamWriter, QtXml, qxmlstream.h)
|
||||
QT_CLASS_LIB(QNetworkCacheMetaData, QtNetwork, qabstractnetworkcache.h)
|
||||
QT_CLASS_LIB(QAbstractNetworkCache, QtNetwork, qabstractnetworkcache.h)
|
||||
QT_CLASS_LIB(QFtp, QtNetwork, qftp.h)
|
||||
QT_CLASS_LIB(QHttpHeader, QtNetwork, qhttp.h)
|
||||
QT_CLASS_LIB(QHttpResponseHeader, QtNetwork, qhttp.h)
|
||||
QT_CLASS_LIB(QHttpRequestHeader, QtNetwork, qhttp.h)
|
||||
QT_CLASS_LIB(QHttp, QtNetwork, qhttp.h)
|
||||
QT_CLASS_LIB(QHttpHeader, QtNetwork, qhttpheader_p.h)
|
||||
QT_CLASS_LIB(QHttpResponseHeader, QtNetwork, qhttpheader_p.h)
|
||||
QT_CLASS_LIB(QNetworkAccessManager, QtNetwork, qnetworkaccessmanager.h)
|
||||
QT_CLASS_LIB(QNetworkCookie, QtNetwork, qnetworkcookie.h)
|
||||
QT_CLASS_LIB(QNetworkCookieJar, QtNetwork, qnetworkcookiejar.h)
|
||||
|
@ -10,7 +10,6 @@ SUBDIRS=\
|
||||
qnetworkcachemetadata \
|
||||
qftp \
|
||||
qhttpnetworkreply \
|
||||
qhttp \
|
||||
qabstractnetworkcache \
|
||||
|
||||
!contains(QT_CONFIG, private_tests): SUBDIRS -= \
|
||||
|
@ -1 +0,0 @@
|
||||
rfc3252.txt -crlf
|
1
tests/auto/network/access/qhttp/.gitignore
vendored
1
tests/auto/network/access/qhttp/.gitignore
vendored
@ -1 +0,0 @@
|
||||
tst_qhttp
|
@ -1,114 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the test suite of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
// Use if you need
|
||||
|
||||
class DummyHttpServer : public QTcpServer
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
DummyHttpServer() : phase(Header)
|
||||
{ listen(); }
|
||||
|
||||
protected:
|
||||
enum {
|
||||
Header,
|
||||
Data1,
|
||||
Data2,
|
||||
Close
|
||||
} phase;
|
||||
void incomingConnection(int socketDescriptor)
|
||||
{
|
||||
QSslSocket *socket = new QSslSocket(this);
|
||||
socket->setSocketDescriptor(socketDescriptor, QAbstractSocket::ConnectedState);
|
||||
socket->ignoreSslErrors();
|
||||
socket->startServerEncryption();
|
||||
connect(socket, SIGNAL(readyRead()), SLOT(handleReadyRead()));
|
||||
}
|
||||
|
||||
public slots:
|
||||
void handleReadyRead()
|
||||
{
|
||||
QTcpSocket *socket = static_cast<QTcpSocket *>(sender());
|
||||
socket->readAll();
|
||||
if (phase != Header)
|
||||
return;
|
||||
|
||||
phase = Data1;
|
||||
static const char header[] =
|
||||
"HTTP/1.0 200 OK\r\n"
|
||||
"Date: Fri, 07 Sep 2007 12:33:18 GMT\r\n"
|
||||
"Server: Apache\r\n"
|
||||
"Expires:\r\n"
|
||||
"Cache-Control:\r\n"
|
||||
"Pragma:\r\n"
|
||||
"Last-Modified: Thu, 06 Sep 2007 08:52:06 +0000\r\n"
|
||||
"Etag: a700f59a6ccb1ad39af68d998aa36fb1\r\n"
|
||||
"Vary: Accept-Encoding\r\n"
|
||||
"Content-Length: 6560\r\n"
|
||||
"Connection: close\r\n"
|
||||
"Content-Type: text/html; charset=utf-8\r\n"
|
||||
"\r\n";
|
||||
|
||||
|
||||
socket->write(header, sizeof header - 1);
|
||||
connect(socket, SIGNAL(bytesWritten(qint64)), SLOT(handleBytesWritten()), Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
void handleBytesWritten()
|
||||
{
|
||||
QTcpSocket *socket = static_cast<QTcpSocket *>(sender());
|
||||
if (socket->bytesToWrite() != 0)
|
||||
return;
|
||||
|
||||
if (phase == Data1) {
|
||||
QByteArray data(4096, 'a');
|
||||
socket->write(data);
|
||||
phase = Data2;
|
||||
} else if (phase == Data2) {
|
||||
QByteArray data(2464, 'a');
|
||||
socket->write(data);
|
||||
phase = Close;
|
||||
} else {
|
||||
//socket->disconnectFromHost();
|
||||
//socket->deleteLater();
|
||||
}
|
||||
}
|
||||
};
|
@ -1,23 +0,0 @@
|
||||
CONFIG += testcase
|
||||
TARGET = tst_qhttp
|
||||
SOURCES += tst_qhttp.cpp
|
||||
|
||||
|
||||
QT = core network testlib
|
||||
|
||||
wince*: {
|
||||
webFiles.files = webserver/*
|
||||
webFiles.path = webserver
|
||||
cgi.files = webserver/cgi-bin/*
|
||||
cgi.path = webserver/cgi-bin
|
||||
addFiles.files = rfc3252.txt testhtml
|
||||
addFiles.path = .
|
||||
DEPLOYMENT += addFiles webFiles cgi
|
||||
DEFINES += SRCDIR=\\\"\\\"
|
||||
} else:vxworks*: {
|
||||
DEFINES += SRCDIR=\\\"\\\"
|
||||
} else {
|
||||
DEFINES += SRCDIR=\\\"$$PWD/\\\"
|
||||
}
|
||||
|
||||
CONFIG+=insignificant_test
|
@ -1,899 +0,0 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Network Working Group H. Kennedy
|
||||
Request for Comments: 3252 Mimezine
|
||||
Category: Informational 1 April 2002
|
||||
|
||||
|
||||
Binary Lexical Octet Ad-hoc Transport
|
||||
|
||||
Status of this Memo
|
||||
|
||||
This memo provides information for the Internet community. It does
|
||||
not specify an Internet standard of any kind. Distribution of this
|
||||
memo is unlimited.
|
||||
|
||||
Copyright Notice
|
||||
|
||||
Copyright (C) The Internet Society (2002). All Rights Reserved.
|
||||
|
||||
Abstract
|
||||
|
||||
This document defines a reformulation of IP and two transport layer
|
||||
protocols (TCP and UDP) as XML applications.
|
||||
|
||||
1. Introduction
|
||||
|
||||
1.1. Overview
|
||||
|
||||
This document describes the Binary Lexical Octet Ad-hoc Transport
|
||||
(BLOAT): a reformulation of a widely-deployed network-layer protocol
|
||||
(IP [RFC791]), and two associated transport layer protocols (TCP
|
||||
[RFC793] and UDP [RFC768]) as XML [XML] applications. It also
|
||||
describes methods for transporting BLOAT over Ethernet and IEEE 802
|
||||
networks as well as encapsulating BLOAT in IP for gatewaying BLOAT
|
||||
across the public Internet.
|
||||
|
||||
1.2. Motivation
|
||||
|
||||
The wild popularity of XML as a basis for application-level protocols
|
||||
such as the Blocks Extensible Exchange Protocol [RFC3080], the Simple
|
||||
Object Access Protocol [SOAP], and Jabber [JABBER] prompted
|
||||
investigation into the possibility of extending the use of XML in the
|
||||
protocol stack. Using XML at both the transport and network layer in
|
||||
addition to the application layer would provide for an amazing amount
|
||||
of power and flexibility while removing dependencies on proprietary
|
||||
and hard-to-understand binary protocols. This protocol unification
|
||||
would also allow applications to use a single XML parser for all
|
||||
aspects of their operation, eliminating developer time spent figuring
|
||||
out the intricacies of each new protocol, and moving the hard work of
|
||||
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 1]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
parsing to the XML toolset. The use of XML also mitigates concerns
|
||||
over "network vs. host" byte ordering which is at the root of many
|
||||
network application bugs.
|
||||
|
||||
1.3. Relation to Existing Protocols
|
||||
|
||||
The reformulations specified in this RFC follow as closely as
|
||||
possible the spirit of the RFCs on which they are based, and so MAY
|
||||
contain elements or attributes that would not be needed in a pure
|
||||
reworking (e.g. length attributes, which are implicit in XML.)
|
||||
|
||||
The layering of network and transport protocols are maintained in
|
||||
this RFC despite the optimizations that could be made if the line
|
||||
were somewhat blurred (i.e. merging TCP and IP into a single, larger
|
||||
element in the DTD) in order to foster future use of this protocol as
|
||||
a basis for reformulating other protocols (such as ICMP.)
|
||||
|
||||
Other than the encoding, the behavioral aspects of each of the
|
||||
existing protocols remain unchanged. Routing, address spaces, TCP
|
||||
congestion control, etc. behave as specified in the extant standards.
|
||||
Adapting to new standards and experimental algorithm heuristics for
|
||||
improving performance will become much easier once the move to BLOAT
|
||||
has been completed.
|
||||
|
||||
1.4. Requirement Levels
|
||||
|
||||
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
|
||||
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
|
||||
document are to be interpreted as described in BCP 14, RFC 2119
|
||||
[RFC2119].
|
||||
|
||||
2. IPoXML
|
||||
|
||||
This protocol MUST be implemented to be compliant with this RFC.
|
||||
IPoXML is the root protocol REQUIRED for effective use of TCPoXML
|
||||
(section 3.) and higher-level application protocols.
|
||||
|
||||
The DTD for this document type can be found in section 7.1.
|
||||
|
||||
The routing of IPoXML can be easily implemented on hosts with an XML
|
||||
parser, as the regular structure lends itself handily to parsing and
|
||||
validation of the document/datagram and then processing the
|
||||
destination address, TTL, and checksum before sending it on to its
|
||||
next-hop.
|
||||
|
||||
The reformulation of IPv4 was chosen over IPv6 [RFC2460] due to the
|
||||
wider deployment of IPv4 and the fact that implementing IPv6 as XML
|
||||
would have exceeded the 1500 byte Ethernet MTU.
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 2]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
All BLOAT implementations MUST use - and specify - the UTF-8 encoding
|
||||
of RFC 2279 [RFC2279]. All BLOAT document/datagrams MUST be well-
|
||||
formed and include the XMLDecl.
|
||||
|
||||
2.1. IP Description
|
||||
|
||||
A number of items have changed (for the better) from the original IP
|
||||
specification. Bit-masks, where present have been converted into
|
||||
human-readable values. IP addresses are listed in their dotted-
|
||||
decimal notation [RFC1123]. Length and checksum values are present
|
||||
as decimal integers.
|
||||
|
||||
To calculate the length and checksum fields of the IP element, a
|
||||
canonicalized form of the element MUST be used. The canonical form
|
||||
SHALL have no whitespace (including newline characters) between
|
||||
elements and only one space character between attributes. There
|
||||
SHALL NOT be a space following the last attribute in an element.
|
||||
|
||||
An iterative method SHOULD be used to calculate checksums, as the
|
||||
length field will vary based on the size of the checksum.
|
||||
|
||||
The payload element bears special attention. Due to the character
|
||||
set restrictions of XML, the payload of IP datagrams (which MAY
|
||||
contain arbitrary data) MUST be encoded for transport. This RFC
|
||||
REQUIRES the contents of the payload to be encoded in the base-64
|
||||
encoding of RFC 2045 [RFC2045], but removes the requirement that the
|
||||
encoded output MUST be wrapped on 76-character lines.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 3]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
2.2. Example Datagram
|
||||
|
||||
The following is an example IPoXML datagram with an empty payload:
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE ip PUBLIC "-//IETF//DTD BLOAT 1.0 IP//EN" "bloat.dtd">
|
||||
<ip>
|
||||
<header length="474">
|
||||
<version value="4"/>
|
||||
<tos precedence="Routine" delay="Normal" throughput="Normal"
|
||||
relibility="Normal" reserved="0"/>
|
||||
<total.length value="461"/>
|
||||
<id value="1"/>
|
||||
<flags reserved="0" df="dont" mf="last"/>
|
||||
<offset value="0"/>
|
||||
<ttl value="255"/>
|
||||
<protocol value="6"/>
|
||||
<checksum value="8707"/>
|
||||
<source address="10.0.0.22"/>
|
||||
<destination address="10.0.0.1"/>
|
||||
<options>
|
||||
<end copied="0" class="0" number="0"/>
|
||||
</options>
|
||||
<padding pad="0"/>
|
||||
</header>
|
||||
<payload>
|
||||
</payload>
|
||||
</ip>
|
||||
|
||||
3. TCPoXML
|
||||
|
||||
This protocol MUST be implemented to be compliant with this RFC. The
|
||||
DTD for this document type can be found in section 7.2.
|
||||
|
||||
3.1. TCP Description
|
||||
|
||||
A number of items have changed from the original TCP specification.
|
||||
Bit-masks, where present have been converted into human-readable
|
||||
values. Length and checksum and port values are present as decimal
|
||||
integers.
|
||||
|
||||
To calculate the length and checksum fields of the TCP element, a
|
||||
canonicalized form of the element MUST be used as in section 2.1.
|
||||
|
||||
An iterative method SHOULD be used to calculate checksums as in
|
||||
section 2.1.
|
||||
|
||||
The payload element MUST be encoded as in section 2.1.
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 4]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
The TCP offset element was expanded to a maximum of 255 from 16 to
|
||||
allow for the increased size of the header in XML.
|
||||
|
||||
TCPoXML datagrams encapsulated by IPoXML MAY omit the <?xml?> header
|
||||
as well as the <!DOCTYPE> declaration.
|
||||
|
||||
3.2. Example Datagram
|
||||
|
||||
The following is an example TCPoXML datagram with an empty payload:
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE tcp PUBLIC "-//IETF//DTD BLOAT 1.0 TCP//EN" "bloat.dtd">
|
||||
<tcp>
|
||||
<tcp.header>
|
||||
<src port="31415"/>
|
||||
<dest port="42424"/>
|
||||
<sequence number="322622954"/>
|
||||
<acknowledgement number="689715995"/>
|
||||
<offset number=""/>
|
||||
<reserved value="0"/>
|
||||
<control syn="1" ack="1"/>
|
||||
<window size="1"/>
|
||||
<urgent pointer="0"/>
|
||||
<checksum value="2988"/>
|
||||
<tcp.options>
|
||||
<tcp.end kind="0"/>
|
||||
</tcp.options>
|
||||
<padding pad="0"/>
|
||||
</tcp.header>
|
||||
<payload>
|
||||
</payload>
|
||||
</tcp>
|
||||
|
||||
4. UDPoXML
|
||||
|
||||
This protocol MUST be implemented to be compliant with this RFC. The
|
||||
DTD for this document type can be found in section 7.3.
|
||||
|
||||
4.1. UDP Description
|
||||
|
||||
A number of items have changed from the original UDP specification.
|
||||
Bit-masks, where present have been converted into human-readable
|
||||
values. Length and checksum and port values are present as decimal
|
||||
integers.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 5]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
To calculate the length and checksum fields of the UDP element, a
|
||||
canonicalized form of the element MUST be used as in section 2.1. An
|
||||
iterative method SHOULD be used to calculate checksums as in section
|
||||
2.1.
|
||||
|
||||
The payload element MUST be encoded as in section 2.1.
|
||||
|
||||
UDPoXML datagrams encapsulated by IPoXML MAY omit the <?xml?> header
|
||||
as well as the <!DOCTYPE> declaration.
|
||||
|
||||
4.2. Example Datagram
|
||||
|
||||
The following is an example UDPoXML datagram with an empty payload:
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE udp PUBLIC "-//IETF//DTD BLOAT 1.0 UDP//EN" "bloat.dtd">
|
||||
<udp>
|
||||
<udp.header>
|
||||
<src port="31415"/>
|
||||
<dest port="42424"/>
|
||||
<udp.length value="143"/>
|
||||
<checksum value="2988"/>
|
||||
</udp.header>
|
||||
<payload>
|
||||
</payload>
|
||||
</udp>
|
||||
|
||||
5. Network Transport
|
||||
|
||||
This document provides for the transmission of BLOAT datagrams over
|
||||
two common families of physical layer transport. Future RFCs will
|
||||
address additional transports as routing vendors catch up to the
|
||||
specification, and we begin to see BLOAT routed across the Internet
|
||||
backbone.
|
||||
|
||||
5.1. Ethernet
|
||||
|
||||
BLOAT is encapsulated in Ethernet datagrams as in [RFC894] with the
|
||||
exception that the type field of the Ethernet frame MUST contain the
|
||||
value 0xBEEF. The first 5 octets of the Ethernet frame payload will
|
||||
be 0x3c 3f 78 6d 6c ("<?xml".)
|
||||
|
||||
5.2. IEEE 802
|
||||
|
||||
BLOAT is encapsulated in IEEE 802 Networks as in [RFC1042] except
|
||||
that the protocol type code for IPoXML is 0xBEEF.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 6]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
6. Gatewaying over IP
|
||||
|
||||
In order to facilitate the gradual introduction of BLOAT into the
|
||||
public Internet, BLOAT MAY be encapsulated in IP as in [RFC2003] to
|
||||
gateway between networks that run BLOAT natively on their LANs.
|
||||
|
||||
7. DTDs
|
||||
|
||||
The Transport DTDs (7.2. and 7.3.) build on the definitions in the
|
||||
Network DTD (7.1.)
|
||||
|
||||
The DTDs are referenced by their PubidLiteral and SystemLiteral (from
|
||||
[XML]) although it is understood that most IPoXML implementations
|
||||
will not need to pull down the DTD, as it will normally be embedded
|
||||
in the implementation, and presents something of a catch-22 if you
|
||||
need to load part of your network protocol over the network.
|
||||
|
||||
7.1. IPoXML DTD
|
||||
|
||||
<!--
|
||||
DTD for IP over XML.
|
||||
Refer to this DTD as:
|
||||
|
||||
<!DOCTYPE ip PUBLIC "-//IETF//DTD BLOAT 1.0 IP//EN" "bloat.dtd">
|
||||
-->
|
||||
<!--
|
||||
DTD data types:
|
||||
|
||||
Digits [0..9]+
|
||||
|
||||
Precedence "NetworkControl | InternetworkControl |
|
||||
CRITIC | FlashOverride | Flash | Immediate |
|
||||
Priority | Routine"
|
||||
|
||||
IP4Addr "dotted-decimal" notation of [RFC1123]
|
||||
|
||||
Class [0..3]
|
||||
|
||||
Sec "Unclassified | Confidential | EFTO | MMMM | PROG |
|
||||
Restricted | Secret | Top Secret | Reserved"
|
||||
|
||||
Compartments [0..65535]
|
||||
|
||||
Handling [0..65535]
|
||||
|
||||
TCC [0..16777216]
|
||||
|
||||
-->
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 7]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
<!ENTITY % Digits "CDATA">
|
||||
<!ENTITY % Precedence "CDATA">
|
||||
<!ENTITY % IP4Addr "CDATA">
|
||||
<!ENTITY % Class "CDATA">
|
||||
<!ENTITY % Sec "CDATA">
|
||||
<!ENTITY % Compartments "CDATA">
|
||||
<!ENTITY % Handling "CDATA">
|
||||
<!ENTITY % TCC "CDATA">
|
||||
|
||||
<!ELEMENT ip (header, payload)>
|
||||
|
||||
<!ELEMENT header (version, tos, total.length, id, flags, offset, ttl,
|
||||
protocol, checksum, source, destination, options,
|
||||
padding)>
|
||||
<!-- length of header in 32-bit words -->
|
||||
<!ATTLIST header
|
||||
length %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT version EMPTY>
|
||||
<!-- ip version. SHOULD be "4" -->
|
||||
<!ATTLIST version
|
||||
value %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT tos EMPTY>
|
||||
<!ATTLIST tos
|
||||
precedence %Precedence; #REQUIRED
|
||||
delay (normal | low) #REQUIRED
|
||||
throughput (normal | high) #REQUIRED
|
||||
relibility (normal | high) #REQUIRED
|
||||
reserved CDATA #FIXED "0">
|
||||
|
||||
<!ELEMENT total.length EMPTY>
|
||||
<!--
|
||||
total length of datagram (header and payload) in octets, MUST be
|
||||
less than 65,535 (and SHOULD be less than 1024 for IPoXML on local
|
||||
ethernets).
|
||||
-->
|
||||
<!ATTLIST total.length
|
||||
value %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT id EMPTY>
|
||||
<!-- 0 <= id <= 65,535 -->
|
||||
<!ATTLIST id
|
||||
value %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT flags EMPTY>
|
||||
<!-- df = don't fragment, mf = more fragments -->
|
||||
<!ATTLIST flags
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 8]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
reserved CDATA #FIXED "0"
|
||||
df (may|dont) #REQUIRED
|
||||
mf (last|more) #REQUIRED>
|
||||
|
||||
<!ELEMENT offset EMPTY>
|
||||
<!-- 0 <= offset <= 8192 measured in 8 octet (64-bit) chunks -->
|
||||
<!ATTLIST offset
|
||||
value %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT ttl EMPTY>
|
||||
<!-- 0 <= ttl <= 255 -->
|
||||
<!ATTLIST ttl
|
||||
value %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT protocol EMPTY>
|
||||
<!-- 0 <= protocol <= 255 (per IANA) -->
|
||||
<!ATTLIST protocol
|
||||
value %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT checksum EMPTY>
|
||||
<!-- 0 <= checksum <= 65535 (over header only) -->
|
||||
<!ATTLIST checksum
|
||||
value %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT source EMPTY>
|
||||
<!ATTLIST source
|
||||
address %IP4Addr; #REQUIRED>
|
||||
|
||||
<!ELEMENT destination EMPTY>
|
||||
<!ATTLIST destination
|
||||
address %IP4Addr; #REQUIRED>
|
||||
|
||||
<!ELEMENT options ( end | noop | security | loose | strict | record
|
||||
| stream | timestamp )*>
|
||||
|
||||
<!ELEMENT end EMPTY>
|
||||
<!ATTLIST end
|
||||
copied (0|1) #REQUIRED
|
||||
class CDATA #FIXED "0"
|
||||
number CDATA #FIXED "0">
|
||||
|
||||
<!ELEMENT noop EMPTY>
|
||||
<!ATTLIST noop
|
||||
copied (0|1) #REQUIRED
|
||||
class CDATA #FIXED "0"
|
||||
number CDATA #FIXED "1">
|
||||
|
||||
<!ELEMENT security EMPTY>
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 9]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
<!ATTLIST security
|
||||
copied CDATA #FIXED "1"
|
||||
class CDATA #FIXED "0"
|
||||
number CDATA #FIXED "2"
|
||||
length CDATA #FIXED "11"
|
||||
security %Sec; #REQUIRED
|
||||
compartments %Compartments; #REQUIRED
|
||||
handling %Handling; #REQUIRED
|
||||
tcc %TCC; #REQUIRED>
|
||||
<!ELEMENT loose (hop)+>
|
||||
<!ATTLIST loose
|
||||
copied CDATA #FIXED "1"
|
||||
class CDATA #FIXED "0"
|
||||
number CDATA #FIXED "3"
|
||||
length %Digits; #REQUIRED
|
||||
pointer %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT hop EMPTY>
|
||||
<!ATTLIST hop
|
||||
address %IP4Addr; #REQUIRED>
|
||||
|
||||
<!ELEMENT strict (hop)+>
|
||||
<!ATTLIST strict
|
||||
copied CDATA #FIXED "1"
|
||||
class CDATA #FIXED "0"
|
||||
number CDATA #FIXED "9"
|
||||
length %Digits; #REQUIRED
|
||||
pointer %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT record (hop)+>
|
||||
<!ATTLIST record
|
||||
copied CDATA #FIXED "0"
|
||||
class CDATA #FIXED "0"
|
||||
number CDATA #FIXED "7"
|
||||
length %Digits; #REQUIRED
|
||||
pointer %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT stream EMPTY>
|
||||
<!-- 0 <= id <= 65,535 -->
|
||||
<!ATTLIST stream
|
||||
copied CDATA #FIXED "1"
|
||||
class CDATA #FIXED "0"
|
||||
number CDATA #FIXED "8"
|
||||
length CDATA #FIXED "4"
|
||||
id %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT timestamp (tstamp)+>
|
||||
<!-- 0 <= oflw <=15 -->
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 10]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
<!ATTLIST timestamp
|
||||
copied CDATA #FIXED "0"
|
||||
class CDATA #FIXED "2"
|
||||
number CDATA #FIXED "4"
|
||||
length %Digits; #REQUIRED
|
||||
pointer %Digits; #REQUIRED
|
||||
oflw %Digits; #REQUIRED
|
||||
flag (0 | 1 | 3) #REQUIRED>
|
||||
|
||||
<!ELEMENT tstamp EMPTY>
|
||||
<!ATTLIST tstamp
|
||||
time %Digits; #REQUIRED
|
||||
address %IP4Addr; #IMPLIED>
|
||||
<!--
|
||||
padding to bring header to 32-bit boundary.
|
||||
pad MUST be "0"*
|
||||
-->
|
||||
<!ELEMENT padding EMPTY>
|
||||
<!ATTLIST padding
|
||||
pad CDATA #REQUIRED>
|
||||
|
||||
<!-- payload MUST be encoded as base-64 [RFC2045], as modified
|
||||
by section 2.1 of this RFC -->
|
||||
<!ELEMENT payload (CDATA)>
|
||||
|
||||
7.2. TCPoXML DTD
|
||||
|
||||
<!--
|
||||
DTD for TCP over XML.
|
||||
Refer to this DTD as:
|
||||
|
||||
<!DOCTYPE tcp PUBLIC "-//IETF//DTD BLOAT 1.0 TCP//EN" "bloat.dtd">
|
||||
-->
|
||||
|
||||
<!-- the pseudoheader is only included for checksum calculations -->
|
||||
<!ELEMENT tcp (tcp.pseudoheader?, tcp.header, payload)>
|
||||
|
||||
<!ELEMENT tcp.header (src, dest, sequence, acknowledgement, offset,
|
||||
reserved, control, window, checksum, urgent,
|
||||
tcp.options, padding)>
|
||||
|
||||
<!ELEMENT src EMPTY>
|
||||
<!-- 0 <= port <= 65,535 -->
|
||||
<!ATTLIST src
|
||||
port %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT dest EMPTY>
|
||||
<!-- 0 <= port <= 65,535 -->
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 11]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
<!ATTLIST dest
|
||||
port %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT sequence EMPTY>
|
||||
<!-- 0 <= number <= 4294967295 -->
|
||||
<!ATTLIST sequence
|
||||
number %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT acknowledgement EMPTY>
|
||||
<!-- 0 <= number <= 4294967295 -->
|
||||
<!ATTLIST acknowledgement
|
||||
number %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT offset EMPTY>
|
||||
<!-- 0 <= number <= 255 -->
|
||||
<!ATTLIST offset
|
||||
number %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT reserved EMPTY>
|
||||
<!ATTLIST reserved
|
||||
value CDATA #FIXED "0">
|
||||
|
||||
<!ELEMENT control EMPTY>
|
||||
<!ATTLIST control
|
||||
urg (0|1) #IMPLIED
|
||||
ack (0|1) #IMPLIED
|
||||
psh (0|1) #IMPLIED
|
||||
rst (0|1) #IMPLIED
|
||||
syn (0|1) #IMPLIED
|
||||
fin (0|1) #IMPLIED>
|
||||
|
||||
<!ELEMENT window EMPTY>
|
||||
<!-- 0 <= size <= 65,535 -->
|
||||
<!ATTLIST window
|
||||
size %Digits; #REQUIRED>
|
||||
|
||||
<!--
|
||||
checksum as in ip, but with
|
||||
the following pseudo-header added into the tcp element:
|
||||
-->
|
||||
<!ELEMENT tcp.pseudoheader (source, destination, protocol,
|
||||
tcp.length)>
|
||||
|
||||
<!--
|
||||
tcp header + data length in octets. does not include the size of
|
||||
|
||||
the pseudoheader.
|
||||
-->
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 12]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
<!ELEMENT tcp.length EMPTY>
|
||||
<!ATTLIST tcp.length
|
||||
value %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT urgent EMPTY>
|
||||
<!-- 0 <= pointer <= 65,535 -->
|
||||
<!ATTLIST urgent
|
||||
pointer %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT tcp.options (tcp.end | tcp.noop | tcp.mss)+>
|
||||
|
||||
<!ELEMENT tcp.end EMPTY>
|
||||
<!ATTLIST tcp.end
|
||||
kind CDATA #FIXED "0">
|
||||
|
||||
<!ELEMENT tcp.noop EMPTY>
|
||||
<!ATTLIST tcp.noop
|
||||
kind CDATA #FIXED "1">
|
||||
|
||||
<!ELEMENT tcp.mss EMPTY>
|
||||
<!ATTLIST tcp.mss
|
||||
kind CDATA #FIXED "2"
|
||||
length CDATA #FIXED "4"
|
||||
size %Digits; #REQUIRED>
|
||||
|
||||
7.3. UDPoXML DTD
|
||||
|
||||
<!--
|
||||
DTD for UDP over XML.
|
||||
Refer to this DTD as:
|
||||
|
||||
<!DOCTYPE udp PUBLIC "-//IETF//DTD BLOAT 1.0 UDP//EN" "bloat.dtd">
|
||||
-->
|
||||
|
||||
<!ELEMENT udp (udp.pseudoheader?, udp.header, payload)>
|
||||
|
||||
<!ELEMENT udp.header (src, dest, udp.length, checksum)>
|
||||
|
||||
<!ELEMENT udp.pseudoheader (source, destination, protocol,
|
||||
udp.length)>
|
||||
|
||||
<!--
|
||||
udp header + data length in octets. does not include the size of
|
||||
the pseudoheader.
|
||||
-->
|
||||
<!ELEMENT udp.length EMPTY>
|
||||
<!ATTLIST udp.length
|
||||
value %Digits; #REQUIRED>
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 13]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
8. Security Considerations
|
||||
|
||||
XML, as a subset of SGML, has the same security considerations as
|
||||
specified in SGML Media Types [RFC1874]. Security considerations
|
||||
that apply to IP, TCP and UDP also likely apply to BLOAT as it does
|
||||
not attempt to correct for issues not related to message format.
|
||||
|
||||
9. References
|
||||
|
||||
[JABBER] Miller, J., "Jabber", draft-miller-jabber-00.txt,
|
||||
February 2002. (Work in Progress)
|
||||
|
||||
[RFC768] Postel, J., "User Datagram Protocol", STD 6, RFC 768,
|
||||
August 1980.
|
||||
|
||||
[RFC791] Postel, J., "Internet Protocol", STD 5, RFC 791,
|
||||
September 1981.
|
||||
|
||||
[RFC793] Postel, J., "Transmission Control Protocol", STD 7, RFC
|
||||
793, September 1981.
|
||||
|
||||
[RFC894] Hornig, C., "Standard for the Transmission of IP
|
||||
Datagrams over Ethernet Networks.", RFC 894, April 1984.
|
||||
|
||||
[RFC1042] Postel, J. and J. Reynolds, "Standard for the
|
||||
Transmission of IP Datagrams Over IEEE 802 Networks", STD
|
||||
43, RFC 1042, February 1988.
|
||||
|
||||
[RFC1123] Braden, R., "Requirements for Internet Hosts -
|
||||
Application and Support", RFC 1123, October 1989.
|
||||
|
||||
[RFC1874] Levinson, E., "SGML Media Types", RFC 1874, December
|
||||
1995.
|
||||
|
||||
[RFC2003] Perkins, C., "IP Encapsulation within IP", RFC 2003,
|
||||
October 1996.
|
||||
|
||||
[RFC2045] Freed, N. and N. Borenstein, "Multipurpose Internet Mail
|
||||
Extensions (MIME) Part One: Format of Internet Message
|
||||
Bodies", RFC 2045, November 1996.
|
||||
|
||||
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
|
||||
Requirement Levels", BCP 14, RFC 2119, March 1997.
|
||||
|
||||
[RFC2279] Yergeau, F., "UTF-8, a transformation format of ISO
|
||||
10646", RFC 2279, January 1998.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 14]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
[RFC2460] Deering, S. and R. Hinden, "Internet Protocol, Version 6
|
||||
(IPv6) Specification", RFC 2460, December 1998.
|
||||
|
||||
[RFC3080] Rose, M., "The Blocks Extensible Exchange Protocol Core",
|
||||
RFC 3080, March 2001.
|
||||
|
||||
[SOAP] Box, D., Ehnebuske, D., Kakivaya, G., Layman, A.,
|
||||
Mendelsohn, N., Nielsen, H. F., Thatte, S. Winer, D.,
|
||||
"Simple Object Access Protocol (SOAP) 1.1" World Wide Web
|
||||
Consortium Note, May 2000 http://www.w3.org/TR/SOAP/
|
||||
|
||||
[XML] Bray, T., Paoli, J., Sperberg-McQueen, C. M., "Extensible
|
||||
Markup Language (XML)" World Wide Web Consortium
|
||||
Recommendation REC- xml-19980210.
|
||||
http://www.w3.org/TR/1998/REC-xml-19980210
|
||||
|
||||
10. Author's Address
|
||||
|
||||
Hugh Kennedy
|
||||
Mimezine
|
||||
1060 West Addison
|
||||
Chicago, IL 60613
|
||||
USA
|
||||
|
||||
EMail: kennedyh@engin.umich.edu
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 15]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
11. Full Copyright Statement
|
||||
|
||||
Copyright (C) The Internet Society (2002). All Rights Reserved.
|
||||
|
||||
This document and translations of it may be copied and furnished to
|
||||
others, and derivative works that comment on or otherwise explain it
|
||||
or assist in its implementation may be prepared, copied, published
|
||||
and distributed, in whole or in part, without restriction of any
|
||||
kind, provided that the above copyright notice and this paragraph are
|
||||
included on all such copies and derivative works. However, this
|
||||
document itself may not be modified in any way, such as by removing
|
||||
the copyright notice or references to the Internet Society or other
|
||||
Internet organizations, except as needed for the purpose of
|
||||
developing Internet standards in which case the procedures for
|
||||
copyrights defined in the Internet Standards process must be
|
||||
followed, or as required to translate it into languages other than
|
||||
English.
|
||||
|
||||
The limited permissions granted above are perpetual and will not be
|
||||
revoked by the Internet Society or its successors or assigns.
|
||||
|
||||
This document and the information contained herein is provided on an
|
||||
"AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
|
||||
TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
|
||||
BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
|
||||
HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
Acknowledgement
|
||||
|
||||
Funding for the RFC Editor function is currently provided by the
|
||||
Internet Society.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 16]
|
||||
|
@ -1,8 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Test</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Test</h1>
|
||||
</body>
|
||||
</html>
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "Content-type: text/plain";
|
||||
echo
|
||||
cat testfile
|
||||
echo "no file retrieved" > testfile
|
@ -1,5 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "Content-type: text/plain";
|
||||
echo
|
||||
cat ../rfc3252
|
@ -1,6 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "Content-type: text/plain";
|
||||
echo
|
||||
echo "file stored under 'testfile'"
|
||||
cat > testfile
|
@ -1,899 +0,0 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Network Working Group H. Kennedy
|
||||
Request for Comments: 3252 Mimezine
|
||||
Category: Informational 1 April 2002
|
||||
|
||||
|
||||
Binary Lexical Octet Ad-hoc Transport
|
||||
|
||||
Status of this Memo
|
||||
|
||||
This memo provides information for the Internet community. It does
|
||||
not specify an Internet standard of any kind. Distribution of this
|
||||
memo is unlimited.
|
||||
|
||||
Copyright Notice
|
||||
|
||||
Copyright (C) The Internet Society (2002). All Rights Reserved.
|
||||
|
||||
Abstract
|
||||
|
||||
This document defines a reformulation of IP and two transport layer
|
||||
protocols (TCP and UDP) as XML applications.
|
||||
|
||||
1. Introduction
|
||||
|
||||
1.1. Overview
|
||||
|
||||
This document describes the Binary Lexical Octet Ad-hoc Transport
|
||||
(BLOAT): a reformulation of a widely-deployed network-layer protocol
|
||||
(IP [RFC791]), and two associated transport layer protocols (TCP
|
||||
[RFC793] and UDP [RFC768]) as XML [XML] applications. It also
|
||||
describes methods for transporting BLOAT over Ethernet and IEEE 802
|
||||
networks as well as encapsulating BLOAT in IP for gatewaying BLOAT
|
||||
across the public Internet.
|
||||
|
||||
1.2. Motivation
|
||||
|
||||
The wild popularity of XML as a basis for application-level protocols
|
||||
such as the Blocks Extensible Exchange Protocol [RFC3080], the Simple
|
||||
Object Access Protocol [SOAP], and Jabber [JABBER] prompted
|
||||
investigation into the possibility of extending the use of XML in the
|
||||
protocol stack. Using XML at both the transport and network layer in
|
||||
addition to the application layer would provide for an amazing amount
|
||||
of power and flexibility while removing dependencies on proprietary
|
||||
and hard-to-understand binary protocols. This protocol unification
|
||||
would also allow applications to use a single XML parser for all
|
||||
aspects of their operation, eliminating developer time spent figuring
|
||||
out the intricacies of each new protocol, and moving the hard work of
|
||||
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 1]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
parsing to the XML toolset. The use of XML also mitigates concerns
|
||||
over "network vs. host" byte ordering which is at the root of many
|
||||
network application bugs.
|
||||
|
||||
1.3. Relation to Existing Protocols
|
||||
|
||||
The reformulations specified in this RFC follow as closely as
|
||||
possible the spirit of the RFCs on which they are based, and so MAY
|
||||
contain elements or attributes that would not be needed in a pure
|
||||
reworking (e.g. length attributes, which are implicit in XML.)
|
||||
|
||||
The layering of network and transport protocols are maintained in
|
||||
this RFC despite the optimizations that could be made if the line
|
||||
were somewhat blurred (i.e. merging TCP and IP into a single, larger
|
||||
element in the DTD) in order to foster future use of this protocol as
|
||||
a basis for reformulating other protocols (such as ICMP.)
|
||||
|
||||
Other than the encoding, the behavioral aspects of each of the
|
||||
existing protocols remain unchanged. Routing, address spaces, TCP
|
||||
congestion control, etc. behave as specified in the extant standards.
|
||||
Adapting to new standards and experimental algorithm heuristics for
|
||||
improving performance will become much easier once the move to BLOAT
|
||||
has been completed.
|
||||
|
||||
1.4. Requirement Levels
|
||||
|
||||
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
|
||||
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
|
||||
document are to be interpreted as described in BCP 14, RFC 2119
|
||||
[RFC2119].
|
||||
|
||||
2. IPoXML
|
||||
|
||||
This protocol MUST be implemented to be compliant with this RFC.
|
||||
IPoXML is the root protocol REQUIRED for effective use of TCPoXML
|
||||
(section 3.) and higher-level application protocols.
|
||||
|
||||
The DTD for this document type can be found in section 7.1.
|
||||
|
||||
The routing of IPoXML can be easily implemented on hosts with an XML
|
||||
parser, as the regular structure lends itself handily to parsing and
|
||||
validation of the document/datagram and then processing the
|
||||
destination address, TTL, and checksum before sending it on to its
|
||||
next-hop.
|
||||
|
||||
The reformulation of IPv4 was chosen over IPv6 [RFC2460] due to the
|
||||
wider deployment of IPv4 and the fact that implementing IPv6 as XML
|
||||
would have exceeded the 1500 byte Ethernet MTU.
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 2]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
All BLOAT implementations MUST use - and specify - the UTF-8 encoding
|
||||
of RFC 2279 [RFC2279]. All BLOAT document/datagrams MUST be well-
|
||||
formed and include the XMLDecl.
|
||||
|
||||
2.1. IP Description
|
||||
|
||||
A number of items have changed (for the better) from the original IP
|
||||
specification. Bit-masks, where present have been converted into
|
||||
human-readable values. IP addresses are listed in their dotted-
|
||||
decimal notation [RFC1123]. Length and checksum values are present
|
||||
as decimal integers.
|
||||
|
||||
To calculate the length and checksum fields of the IP element, a
|
||||
canonicalized form of the element MUST be used. The canonical form
|
||||
SHALL have no whitespace (including newline characters) between
|
||||
elements and only one space character between attributes. There
|
||||
SHALL NOT be a space following the last attribute in an element.
|
||||
|
||||
An iterative method SHOULD be used to calculate checksums, as the
|
||||
length field will vary based on the size of the checksum.
|
||||
|
||||
The payload element bears special attention. Due to the character
|
||||
set restrictions of XML, the payload of IP datagrams (which MAY
|
||||
contain arbitrary data) MUST be encoded for transport. This RFC
|
||||
REQUIRES the contents of the payload to be encoded in the base-64
|
||||
encoding of RFC 2045 [RFC2045], but removes the requirement that the
|
||||
encoded output MUST be wrapped on 76-character lines.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 3]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
2.2. Example Datagram
|
||||
|
||||
The following is an example IPoXML datagram with an empty payload:
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE ip PUBLIC "-//IETF//DTD BLOAT 1.0 IP//EN" "bloat.dtd">
|
||||
<ip>
|
||||
<header length="474">
|
||||
<version value="4"/>
|
||||
<tos precedence="Routine" delay="Normal" throughput="Normal"
|
||||
relibility="Normal" reserved="0"/>
|
||||
<total.length value="461"/>
|
||||
<id value="1"/>
|
||||
<flags reserved="0" df="dont" mf="last"/>
|
||||
<offset value="0"/>
|
||||
<ttl value="255"/>
|
||||
<protocol value="6"/>
|
||||
<checksum value="8707"/>
|
||||
<source address="10.0.0.22"/>
|
||||
<destination address="10.0.0.1"/>
|
||||
<options>
|
||||
<end copied="0" class="0" number="0"/>
|
||||
</options>
|
||||
<padding pad="0"/>
|
||||
</header>
|
||||
<payload>
|
||||
</payload>
|
||||
</ip>
|
||||
|
||||
3. TCPoXML
|
||||
|
||||
This protocol MUST be implemented to be compliant with this RFC. The
|
||||
DTD for this document type can be found in section 7.2.
|
||||
|
||||
3.1. TCP Description
|
||||
|
||||
A number of items have changed from the original TCP specification.
|
||||
Bit-masks, where present have been converted into human-readable
|
||||
values. Length and checksum and port values are present as decimal
|
||||
integers.
|
||||
|
||||
To calculate the length and checksum fields of the TCP element, a
|
||||
canonicalized form of the element MUST be used as in section 2.1.
|
||||
|
||||
An iterative method SHOULD be used to calculate checksums as in
|
||||
section 2.1.
|
||||
|
||||
The payload element MUST be encoded as in section 2.1.
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 4]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
The TCP offset element was expanded to a maximum of 255 from 16 to
|
||||
allow for the increased size of the header in XML.
|
||||
|
||||
TCPoXML datagrams encapsulated by IPoXML MAY omit the <?xml?> header
|
||||
as well as the <!DOCTYPE> declaration.
|
||||
|
||||
3.2. Example Datagram
|
||||
|
||||
The following is an example TCPoXML datagram with an empty payload:
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE tcp PUBLIC "-//IETF//DTD BLOAT 1.0 TCP//EN" "bloat.dtd">
|
||||
<tcp>
|
||||
<tcp.header>
|
||||
<src port="31415"/>
|
||||
<dest port="42424"/>
|
||||
<sequence number="322622954"/>
|
||||
<acknowledgement number="689715995"/>
|
||||
<offset number=""/>
|
||||
<reserved value="0"/>
|
||||
<control syn="1" ack="1"/>
|
||||
<window size="1"/>
|
||||
<urgent pointer="0"/>
|
||||
<checksum value="2988"/>
|
||||
<tcp.options>
|
||||
<tcp.end kind="0"/>
|
||||
</tcp.options>
|
||||
<padding pad="0"/>
|
||||
</tcp.header>
|
||||
<payload>
|
||||
</payload>
|
||||
</tcp>
|
||||
|
||||
4. UDPoXML
|
||||
|
||||
This protocol MUST be implemented to be compliant with this RFC. The
|
||||
DTD for this document type can be found in section 7.3.
|
||||
|
||||
4.1. UDP Description
|
||||
|
||||
A number of items have changed from the original UDP specification.
|
||||
Bit-masks, where present have been converted into human-readable
|
||||
values. Length and checksum and port values are present as decimal
|
||||
integers.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 5]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
To calculate the length and checksum fields of the UDP element, a
|
||||
canonicalized form of the element MUST be used as in section 2.1. An
|
||||
iterative method SHOULD be used to calculate checksums as in section
|
||||
2.1.
|
||||
|
||||
The payload element MUST be encoded as in section 2.1.
|
||||
|
||||
UDPoXML datagrams encapsulated by IPoXML MAY omit the <?xml?> header
|
||||
as well as the <!DOCTYPE> declaration.
|
||||
|
||||
4.2. Example Datagram
|
||||
|
||||
The following is an example UDPoXML datagram with an empty payload:
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE udp PUBLIC "-//IETF//DTD BLOAT 1.0 UDP//EN" "bloat.dtd">
|
||||
<udp>
|
||||
<udp.header>
|
||||
<src port="31415"/>
|
||||
<dest port="42424"/>
|
||||
<udp.length value="143"/>
|
||||
<checksum value="2988"/>
|
||||
</udp.header>
|
||||
<payload>
|
||||
</payload>
|
||||
</udp>
|
||||
|
||||
5. Network Transport
|
||||
|
||||
This document provides for the transmission of BLOAT datagrams over
|
||||
two common families of physical layer transport. Future RFCs will
|
||||
address additional transports as routing vendors catch up to the
|
||||
specification, and we begin to see BLOAT routed across the Internet
|
||||
backbone.
|
||||
|
||||
5.1. Ethernet
|
||||
|
||||
BLOAT is encapsulated in Ethernet datagrams as in [RFC894] with the
|
||||
exception that the type field of the Ethernet frame MUST contain the
|
||||
value 0xBEEF. The first 5 octets of the Ethernet frame payload will
|
||||
be 0x3c 3f 78 6d 6c ("<?xml".)
|
||||
|
||||
5.2. IEEE 802
|
||||
|
||||
BLOAT is encapsulated in IEEE 802 Networks as in [RFC1042] except
|
||||
that the protocol type code for IPoXML is 0xBEEF.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 6]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
6. Gatewaying over IP
|
||||
|
||||
In order to facilitate the gradual introduction of BLOAT into the
|
||||
public Internet, BLOAT MAY be encapsulated in IP as in [RFC2003] to
|
||||
gateway between networks that run BLOAT natively on their LANs.
|
||||
|
||||
7. DTDs
|
||||
|
||||
The Transport DTDs (7.2. and 7.3.) build on the definitions in the
|
||||
Network DTD (7.1.)
|
||||
|
||||
The DTDs are referenced by their PubidLiteral and SystemLiteral (from
|
||||
[XML]) although it is understood that most IPoXML implementations
|
||||
will not need to pull down the DTD, as it will normally be embedded
|
||||
in the implementation, and presents something of a catch-22 if you
|
||||
need to load part of your network protocol over the network.
|
||||
|
||||
7.1. IPoXML DTD
|
||||
|
||||
<!--
|
||||
DTD for IP over XML.
|
||||
Refer to this DTD as:
|
||||
|
||||
<!DOCTYPE ip PUBLIC "-//IETF//DTD BLOAT 1.0 IP//EN" "bloat.dtd">
|
||||
-->
|
||||
<!--
|
||||
DTD data types:
|
||||
|
||||
Digits [0..9]+
|
||||
|
||||
Precedence "NetworkControl | InternetworkControl |
|
||||
CRITIC | FlashOverride | Flash | Immediate |
|
||||
Priority | Routine"
|
||||
|
||||
IP4Addr "dotted-decimal" notation of [RFC1123]
|
||||
|
||||
Class [0..3]
|
||||
|
||||
Sec "Unclassified | Confidential | EFTO | MMMM | PROG |
|
||||
Restricted | Secret | Top Secret | Reserved"
|
||||
|
||||
Compartments [0..65535]
|
||||
|
||||
Handling [0..65535]
|
||||
|
||||
TCC [0..16777216]
|
||||
|
||||
-->
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 7]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
<!ENTITY % Digits "CDATA">
|
||||
<!ENTITY % Precedence "CDATA">
|
||||
<!ENTITY % IP4Addr "CDATA">
|
||||
<!ENTITY % Class "CDATA">
|
||||
<!ENTITY % Sec "CDATA">
|
||||
<!ENTITY % Compartments "CDATA">
|
||||
<!ENTITY % Handling "CDATA">
|
||||
<!ENTITY % TCC "CDATA">
|
||||
|
||||
<!ELEMENT ip (header, payload)>
|
||||
|
||||
<!ELEMENT header (version, tos, total.length, id, flags, offset, ttl,
|
||||
protocol, checksum, source, destination, options,
|
||||
padding)>
|
||||
<!-- length of header in 32-bit words -->
|
||||
<!ATTLIST header
|
||||
length %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT version EMPTY>
|
||||
<!-- ip version. SHOULD be "4" -->
|
||||
<!ATTLIST version
|
||||
value %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT tos EMPTY>
|
||||
<!ATTLIST tos
|
||||
precedence %Precedence; #REQUIRED
|
||||
delay (normal | low) #REQUIRED
|
||||
throughput (normal | high) #REQUIRED
|
||||
relibility (normal | high) #REQUIRED
|
||||
reserved CDATA #FIXED "0">
|
||||
|
||||
<!ELEMENT total.length EMPTY>
|
||||
<!--
|
||||
total length of datagram (header and payload) in octets, MUST be
|
||||
less than 65,535 (and SHOULD be less than 1024 for IPoXML on local
|
||||
ethernets).
|
||||
-->
|
||||
<!ATTLIST total.length
|
||||
value %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT id EMPTY>
|
||||
<!-- 0 <= id <= 65,535 -->
|
||||
<!ATTLIST id
|
||||
value %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT flags EMPTY>
|
||||
<!-- df = don't fragment, mf = more fragments -->
|
||||
<!ATTLIST flags
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 8]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
reserved CDATA #FIXED "0"
|
||||
df (may|dont) #REQUIRED
|
||||
mf (last|more) #REQUIRED>
|
||||
|
||||
<!ELEMENT offset EMPTY>
|
||||
<!-- 0 <= offset <= 8192 measured in 8 octet (64-bit) chunks -->
|
||||
<!ATTLIST offset
|
||||
value %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT ttl EMPTY>
|
||||
<!-- 0 <= ttl <= 255 -->
|
||||
<!ATTLIST ttl
|
||||
value %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT protocol EMPTY>
|
||||
<!-- 0 <= protocol <= 255 (per IANA) -->
|
||||
<!ATTLIST protocol
|
||||
value %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT checksum EMPTY>
|
||||
<!-- 0 <= checksum <= 65535 (over header only) -->
|
||||
<!ATTLIST checksum
|
||||
value %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT source EMPTY>
|
||||
<!ATTLIST source
|
||||
address %IP4Addr; #REQUIRED>
|
||||
|
||||
<!ELEMENT destination EMPTY>
|
||||
<!ATTLIST destination
|
||||
address %IP4Addr; #REQUIRED>
|
||||
|
||||
<!ELEMENT options ( end | noop | security | loose | strict | record
|
||||
| stream | timestamp )*>
|
||||
|
||||
<!ELEMENT end EMPTY>
|
||||
<!ATTLIST end
|
||||
copied (0|1) #REQUIRED
|
||||
class CDATA #FIXED "0"
|
||||
number CDATA #FIXED "0">
|
||||
|
||||
<!ELEMENT noop EMPTY>
|
||||
<!ATTLIST noop
|
||||
copied (0|1) #REQUIRED
|
||||
class CDATA #FIXED "0"
|
||||
number CDATA #FIXED "1">
|
||||
|
||||
<!ELEMENT security EMPTY>
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 9]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
<!ATTLIST security
|
||||
copied CDATA #FIXED "1"
|
||||
class CDATA #FIXED "0"
|
||||
number CDATA #FIXED "2"
|
||||
length CDATA #FIXED "11"
|
||||
security %Sec; #REQUIRED
|
||||
compartments %Compartments; #REQUIRED
|
||||
handling %Handling; #REQUIRED
|
||||
tcc %TCC; #REQUIRED>
|
||||
<!ELEMENT loose (hop)+>
|
||||
<!ATTLIST loose
|
||||
copied CDATA #FIXED "1"
|
||||
class CDATA #FIXED "0"
|
||||
number CDATA #FIXED "3"
|
||||
length %Digits; #REQUIRED
|
||||
pointer %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT hop EMPTY>
|
||||
<!ATTLIST hop
|
||||
address %IP4Addr; #REQUIRED>
|
||||
|
||||
<!ELEMENT strict (hop)+>
|
||||
<!ATTLIST strict
|
||||
copied CDATA #FIXED "1"
|
||||
class CDATA #FIXED "0"
|
||||
number CDATA #FIXED "9"
|
||||
length %Digits; #REQUIRED
|
||||
pointer %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT record (hop)+>
|
||||
<!ATTLIST record
|
||||
copied CDATA #FIXED "0"
|
||||
class CDATA #FIXED "0"
|
||||
number CDATA #FIXED "7"
|
||||
length %Digits; #REQUIRED
|
||||
pointer %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT stream EMPTY>
|
||||
<!-- 0 <= id <= 65,535 -->
|
||||
<!ATTLIST stream
|
||||
copied CDATA #FIXED "1"
|
||||
class CDATA #FIXED "0"
|
||||
number CDATA #FIXED "8"
|
||||
length CDATA #FIXED "4"
|
||||
id %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT timestamp (tstamp)+>
|
||||
<!-- 0 <= oflw <=15 -->
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 10]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
<!ATTLIST timestamp
|
||||
copied CDATA #FIXED "0"
|
||||
class CDATA #FIXED "2"
|
||||
number CDATA #FIXED "4"
|
||||
length %Digits; #REQUIRED
|
||||
pointer %Digits; #REQUIRED
|
||||
oflw %Digits; #REQUIRED
|
||||
flag (0 | 1 | 3) #REQUIRED>
|
||||
|
||||
<!ELEMENT tstamp EMPTY>
|
||||
<!ATTLIST tstamp
|
||||
time %Digits; #REQUIRED
|
||||
address %IP4Addr; #IMPLIED>
|
||||
<!--
|
||||
padding to bring header to 32-bit boundary.
|
||||
pad MUST be "0"*
|
||||
-->
|
||||
<!ELEMENT padding EMPTY>
|
||||
<!ATTLIST padding
|
||||
pad CDATA #REQUIRED>
|
||||
|
||||
<!-- payload MUST be encoded as base-64 [RFC2045], as modified
|
||||
by section 2.1 of this RFC -->
|
||||
<!ELEMENT payload (CDATA)>
|
||||
|
||||
7.2. TCPoXML DTD
|
||||
|
||||
<!--
|
||||
DTD for TCP over XML.
|
||||
Refer to this DTD as:
|
||||
|
||||
<!DOCTYPE tcp PUBLIC "-//IETF//DTD BLOAT 1.0 TCP//EN" "bloat.dtd">
|
||||
-->
|
||||
|
||||
<!-- the pseudoheader is only included for checksum calculations -->
|
||||
<!ELEMENT tcp (tcp.pseudoheader?, tcp.header, payload)>
|
||||
|
||||
<!ELEMENT tcp.header (src, dest, sequence, acknowledgement, offset,
|
||||
reserved, control, window, checksum, urgent,
|
||||
tcp.options, padding)>
|
||||
|
||||
<!ELEMENT src EMPTY>
|
||||
<!-- 0 <= port <= 65,535 -->
|
||||
<!ATTLIST src
|
||||
port %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT dest EMPTY>
|
||||
<!-- 0 <= port <= 65,535 -->
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 11]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
<!ATTLIST dest
|
||||
port %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT sequence EMPTY>
|
||||
<!-- 0 <= number <= 4294967295 -->
|
||||
<!ATTLIST sequence
|
||||
number %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT acknowledgement EMPTY>
|
||||
<!-- 0 <= number <= 4294967295 -->
|
||||
<!ATTLIST acknowledgement
|
||||
number %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT offset EMPTY>
|
||||
<!-- 0 <= number <= 255 -->
|
||||
<!ATTLIST offset
|
||||
number %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT reserved EMPTY>
|
||||
<!ATTLIST reserved
|
||||
value CDATA #FIXED "0">
|
||||
|
||||
<!ELEMENT control EMPTY>
|
||||
<!ATTLIST control
|
||||
urg (0|1) #IMPLIED
|
||||
ack (0|1) #IMPLIED
|
||||
psh (0|1) #IMPLIED
|
||||
rst (0|1) #IMPLIED
|
||||
syn (0|1) #IMPLIED
|
||||
fin (0|1) #IMPLIED>
|
||||
|
||||
<!ELEMENT window EMPTY>
|
||||
<!-- 0 <= size <= 65,535 -->
|
||||
<!ATTLIST window
|
||||
size %Digits; #REQUIRED>
|
||||
|
||||
<!--
|
||||
checksum as in ip, but with
|
||||
the following pseudo-header added into the tcp element:
|
||||
-->
|
||||
<!ELEMENT tcp.pseudoheader (source, destination, protocol,
|
||||
tcp.length)>
|
||||
|
||||
<!--
|
||||
tcp header + data length in octets. does not include the size of
|
||||
|
||||
the pseudoheader.
|
||||
-->
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 12]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
<!ELEMENT tcp.length EMPTY>
|
||||
<!ATTLIST tcp.length
|
||||
value %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT urgent EMPTY>
|
||||
<!-- 0 <= pointer <= 65,535 -->
|
||||
<!ATTLIST urgent
|
||||
pointer %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT tcp.options (tcp.end | tcp.noop | tcp.mss)+>
|
||||
|
||||
<!ELEMENT tcp.end EMPTY>
|
||||
<!ATTLIST tcp.end
|
||||
kind CDATA #FIXED "0">
|
||||
|
||||
<!ELEMENT tcp.noop EMPTY>
|
||||
<!ATTLIST tcp.noop
|
||||
kind CDATA #FIXED "1">
|
||||
|
||||
<!ELEMENT tcp.mss EMPTY>
|
||||
<!ATTLIST tcp.mss
|
||||
kind CDATA #FIXED "2"
|
||||
length CDATA #FIXED "4"
|
||||
size %Digits; #REQUIRED>
|
||||
|
||||
7.3. UDPoXML DTD
|
||||
|
||||
<!--
|
||||
DTD for UDP over XML.
|
||||
Refer to this DTD as:
|
||||
|
||||
<!DOCTYPE udp PUBLIC "-//IETF//DTD BLOAT 1.0 UDP//EN" "bloat.dtd">
|
||||
-->
|
||||
|
||||
<!ELEMENT udp (udp.pseudoheader?, udp.header, payload)>
|
||||
|
||||
<!ELEMENT udp.header (src, dest, udp.length, checksum)>
|
||||
|
||||
<!ELEMENT udp.pseudoheader (source, destination, protocol,
|
||||
udp.length)>
|
||||
|
||||
<!--
|
||||
udp header + data length in octets. does not include the size of
|
||||
the pseudoheader.
|
||||
-->
|
||||
<!ELEMENT udp.length EMPTY>
|
||||
<!ATTLIST udp.length
|
||||
value %Digits; #REQUIRED>
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 13]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
8. Security Considerations
|
||||
|
||||
XML, as a subset of SGML, has the same security considerations as
|
||||
specified in SGML Media Types [RFC1874]. Security considerations
|
||||
that apply to IP, TCP and UDP also likely apply to BLOAT as it does
|
||||
not attempt to correct for issues not related to message format.
|
||||
|
||||
9. References
|
||||
|
||||
[JABBER] Miller, J., "Jabber", draft-miller-jabber-00.txt,
|
||||
February 2002. (Work in Progress)
|
||||
|
||||
[RFC768] Postel, J., "User Datagram Protocol", STD 6, RFC 768,
|
||||
August 1980.
|
||||
|
||||
[RFC791] Postel, J., "Internet Protocol", STD 5, RFC 791,
|
||||
September 1981.
|
||||
|
||||
[RFC793] Postel, J., "Transmission Control Protocol", STD 7, RFC
|
||||
793, September 1981.
|
||||
|
||||
[RFC894] Hornig, C., "Standard for the Transmission of IP
|
||||
Datagrams over Ethernet Networks.", RFC 894, April 1984.
|
||||
|
||||
[RFC1042] Postel, J. and J. Reynolds, "Standard for the
|
||||
Transmission of IP Datagrams Over IEEE 802 Networks", STD
|
||||
43, RFC 1042, February 1988.
|
||||
|
||||
[RFC1123] Braden, R., "Requirements for Internet Hosts -
|
||||
Application and Support", RFC 1123, October 1989.
|
||||
|
||||
[RFC1874] Levinson, E., "SGML Media Types", RFC 1874, December
|
||||
1995.
|
||||
|
||||
[RFC2003] Perkins, C., "IP Encapsulation within IP", RFC 2003,
|
||||
October 1996.
|
||||
|
||||
[RFC2045] Freed, N. and N. Borenstein, "Multipurpose Internet Mail
|
||||
Extensions (MIME) Part One: Format of Internet Message
|
||||
Bodies", RFC 2045, November 1996.
|
||||
|
||||
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
|
||||
Requirement Levels", BCP 14, RFC 2119, March 1997.
|
||||
|
||||
[RFC2279] Yergeau, F., "UTF-8, a transformation format of ISO
|
||||
10646", RFC 2279, January 1998.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 14]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
[RFC2460] Deering, S. and R. Hinden, "Internet Protocol, Version 6
|
||||
(IPv6) Specification", RFC 2460, December 1998.
|
||||
|
||||
[RFC3080] Rose, M., "The Blocks Extensible Exchange Protocol Core",
|
||||
RFC 3080, March 2001.
|
||||
|
||||
[SOAP] Box, D., Ehnebuske, D., Kakivaya, G., Layman, A.,
|
||||
Mendelsohn, N., Nielsen, H. F., Thatte, S. Winer, D.,
|
||||
"Simple Object Access Protocol (SOAP) 1.1" World Wide Web
|
||||
Consortium Note, May 2000 http://www.w3.org/TR/SOAP/
|
||||
|
||||
[XML] Bray, T., Paoli, J., Sperberg-McQueen, C. M., "Extensible
|
||||
Markup Language (XML)" World Wide Web Consortium
|
||||
Recommendation REC- xml-19980210.
|
||||
http://www.w3.org/TR/1998/REC-xml-19980210
|
||||
|
||||
10. Author's Address
|
||||
|
||||
Hugh Kennedy
|
||||
Mimezine
|
||||
1060 West Addison
|
||||
Chicago, IL 60613
|
||||
USA
|
||||
|
||||
EMail: kennedyh@engin.umich.edu
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 15]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
11. Full Copyright Statement
|
||||
|
||||
Copyright (C) The Internet Society (2002). All Rights Reserved.
|
||||
|
||||
This document and translations of it may be copied and furnished to
|
||||
others, and derivative works that comment on or otherwise explain it
|
||||
or assist in its implementation may be prepared, copied, published
|
||||
and distributed, in whole or in part, without restriction of any
|
||||
kind, provided that the above copyright notice and this paragraph are
|
||||
included on all such copies and derivative works. However, this
|
||||
document itself may not be modified in any way, such as by removing
|
||||
the copyright notice or references to the Internet Society or other
|
||||
Internet organizations, except as needed for the purpose of
|
||||
developing Internet standards in which case the procedures for
|
||||
copyrights defined in the Internet Standards process must be
|
||||
followed, or as required to translate it into languages other than
|
||||
English.
|
||||
|
||||
The limited permissions granted above are perpetual and will not be
|
||||
revoked by the Internet Society or its successors or assigns.
|
||||
|
||||
This document and the information contained herein is provided on an
|
||||
"AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
|
||||
TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
|
||||
BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
|
||||
HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
Acknowledgement
|
||||
|
||||
Funding for the RFC Editor function is currently provided by the
|
||||
Internet Society.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 16]
|
||||
|
@ -1,899 +0,0 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Network Working Group H. Kennedy
|
||||
Request for Comments: 3252 Mimezine
|
||||
Category: Informational 1 April 2002
|
||||
|
||||
|
||||
Binary Lexical Octet Ad-hoc Transport
|
||||
|
||||
Status of this Memo
|
||||
|
||||
This memo provides information for the Internet community. It does
|
||||
not specify an Internet standard of any kind. Distribution of this
|
||||
memo is unlimited.
|
||||
|
||||
Copyright Notice
|
||||
|
||||
Copyright (C) The Internet Society (2002). All Rights Reserved.
|
||||
|
||||
Abstract
|
||||
|
||||
This document defines a reformulation of IP and two transport layer
|
||||
protocols (TCP and UDP) as XML applications.
|
||||
|
||||
1. Introduction
|
||||
|
||||
1.1. Overview
|
||||
|
||||
This document describes the Binary Lexical Octet Ad-hoc Transport
|
||||
(BLOAT): a reformulation of a widely-deployed network-layer protocol
|
||||
(IP [RFC791]), and two associated transport layer protocols (TCP
|
||||
[RFC793] and UDP [RFC768]) as XML [XML] applications. It also
|
||||
describes methods for transporting BLOAT over Ethernet and IEEE 802
|
||||
networks as well as encapsulating BLOAT in IP for gatewaying BLOAT
|
||||
across the public Internet.
|
||||
|
||||
1.2. Motivation
|
||||
|
||||
The wild popularity of XML as a basis for application-level protocols
|
||||
such as the Blocks Extensible Exchange Protocol [RFC3080], the Simple
|
||||
Object Access Protocol [SOAP], and Jabber [JABBER] prompted
|
||||
investigation into the possibility of extending the use of XML in the
|
||||
protocol stack. Using XML at both the transport and network layer in
|
||||
addition to the application layer would provide for an amazing amount
|
||||
of power and flexibility while removing dependencies on proprietary
|
||||
and hard-to-understand binary protocols. This protocol unification
|
||||
would also allow applications to use a single XML parser for all
|
||||
aspects of their operation, eliminating developer time spent figuring
|
||||
out the intricacies of each new protocol, and moving the hard work of
|
||||
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 1]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
parsing to the XML toolset. The use of XML also mitigates concerns
|
||||
over "network vs. host" byte ordering which is at the root of many
|
||||
network application bugs.
|
||||
|
||||
1.3. Relation to Existing Protocols
|
||||
|
||||
The reformulations specified in this RFC follow as closely as
|
||||
possible the spirit of the RFCs on which they are based, and so MAY
|
||||
contain elements or attributes that would not be needed in a pure
|
||||
reworking (e.g. length attributes, which are implicit in XML.)
|
||||
|
||||
The layering of network and transport protocols are maintained in
|
||||
this RFC despite the optimizations that could be made if the line
|
||||
were somewhat blurred (i.e. merging TCP and IP into a single, larger
|
||||
element in the DTD) in order to foster future use of this protocol as
|
||||
a basis for reformulating other protocols (such as ICMP.)
|
||||
|
||||
Other than the encoding, the behavioral aspects of each of the
|
||||
existing protocols remain unchanged. Routing, address spaces, TCP
|
||||
congestion control, etc. behave as specified in the extant standards.
|
||||
Adapting to new standards and experimental algorithm heuristics for
|
||||
improving performance will become much easier once the move to BLOAT
|
||||
has been completed.
|
||||
|
||||
1.4. Requirement Levels
|
||||
|
||||
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
|
||||
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
|
||||
document are to be interpreted as described in BCP 14, RFC 2119
|
||||
[RFC2119].
|
||||
|
||||
2. IPoXML
|
||||
|
||||
This protocol MUST be implemented to be compliant with this RFC.
|
||||
IPoXML is the root protocol REQUIRED for effective use of TCPoXML
|
||||
(section 3.) and higher-level application protocols.
|
||||
|
||||
The DTD for this document type can be found in section 7.1.
|
||||
|
||||
The routing of IPoXML can be easily implemented on hosts with an XML
|
||||
parser, as the regular structure lends itself handily to parsing and
|
||||
validation of the document/datagram and then processing the
|
||||
destination address, TTL, and checksum before sending it on to its
|
||||
next-hop.
|
||||
|
||||
The reformulation of IPv4 was chosen over IPv6 [RFC2460] due to the
|
||||
wider deployment of IPv4 and the fact that implementing IPv6 as XML
|
||||
would have exceeded the 1500 byte Ethernet MTU.
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 2]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
All BLOAT implementations MUST use - and specify - the UTF-8 encoding
|
||||
of RFC 2279 [RFC2279]. All BLOAT document/datagrams MUST be well-
|
||||
formed and include the XMLDecl.
|
||||
|
||||
2.1. IP Description
|
||||
|
||||
A number of items have changed (for the better) from the original IP
|
||||
specification. Bit-masks, where present have been converted into
|
||||
human-readable values. IP addresses are listed in their dotted-
|
||||
decimal notation [RFC1123]. Length and checksum values are present
|
||||
as decimal integers.
|
||||
|
||||
To calculate the length and checksum fields of the IP element, a
|
||||
canonicalized form of the element MUST be used. The canonical form
|
||||
SHALL have no whitespace (including newline characters) between
|
||||
elements and only one space character between attributes. There
|
||||
SHALL NOT be a space following the last attribute in an element.
|
||||
|
||||
An iterative method SHOULD be used to calculate checksums, as the
|
||||
length field will vary based on the size of the checksum.
|
||||
|
||||
The payload element bears special attention. Due to the character
|
||||
set restrictions of XML, the payload of IP datagrams (which MAY
|
||||
contain arbitrary data) MUST be encoded for transport. This RFC
|
||||
REQUIRES the contents of the payload to be encoded in the base-64
|
||||
encoding of RFC 2045 [RFC2045], but removes the requirement that the
|
||||
encoded output MUST be wrapped on 76-character lines.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 3]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
2.2. Example Datagram
|
||||
|
||||
The following is an example IPoXML datagram with an empty payload:
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE ip PUBLIC "-//IETF//DTD BLOAT 1.0 IP//EN" "bloat.dtd">
|
||||
<ip>
|
||||
<header length="474">
|
||||
<version value="4"/>
|
||||
<tos precedence="Routine" delay="Normal" throughput="Normal"
|
||||
relibility="Normal" reserved="0"/>
|
||||
<total.length value="461"/>
|
||||
<id value="1"/>
|
||||
<flags reserved="0" df="dont" mf="last"/>
|
||||
<offset value="0"/>
|
||||
<ttl value="255"/>
|
||||
<protocol value="6"/>
|
||||
<checksum value="8707"/>
|
||||
<source address="10.0.0.22"/>
|
||||
<destination address="10.0.0.1"/>
|
||||
<options>
|
||||
<end copied="0" class="0" number="0"/>
|
||||
</options>
|
||||
<padding pad="0"/>
|
||||
</header>
|
||||
<payload>
|
||||
</payload>
|
||||
</ip>
|
||||
|
||||
3. TCPoXML
|
||||
|
||||
This protocol MUST be implemented to be compliant with this RFC. The
|
||||
DTD for this document type can be found in section 7.2.
|
||||
|
||||
3.1. TCP Description
|
||||
|
||||
A number of items have changed from the original TCP specification.
|
||||
Bit-masks, where present have been converted into human-readable
|
||||
values. Length and checksum and port values are present as decimal
|
||||
integers.
|
||||
|
||||
To calculate the length and checksum fields of the TCP element, a
|
||||
canonicalized form of the element MUST be used as in section 2.1.
|
||||
|
||||
An iterative method SHOULD be used to calculate checksums as in
|
||||
section 2.1.
|
||||
|
||||
The payload element MUST be encoded as in section 2.1.
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 4]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
The TCP offset element was expanded to a maximum of 255 from 16 to
|
||||
allow for the increased size of the header in XML.
|
||||
|
||||
TCPoXML datagrams encapsulated by IPoXML MAY omit the <?xml?> header
|
||||
as well as the <!DOCTYPE> declaration.
|
||||
|
||||
3.2. Example Datagram
|
||||
|
||||
The following is an example TCPoXML datagram with an empty payload:
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE tcp PUBLIC "-//IETF//DTD BLOAT 1.0 TCP//EN" "bloat.dtd">
|
||||
<tcp>
|
||||
<tcp.header>
|
||||
<src port="31415"/>
|
||||
<dest port="42424"/>
|
||||
<sequence number="322622954"/>
|
||||
<acknowledgement number="689715995"/>
|
||||
<offset number=""/>
|
||||
<reserved value="0"/>
|
||||
<control syn="1" ack="1"/>
|
||||
<window size="1"/>
|
||||
<urgent pointer="0"/>
|
||||
<checksum value="2988"/>
|
||||
<tcp.options>
|
||||
<tcp.end kind="0"/>
|
||||
</tcp.options>
|
||||
<padding pad="0"/>
|
||||
</tcp.header>
|
||||
<payload>
|
||||
</payload>
|
||||
</tcp>
|
||||
|
||||
4. UDPoXML
|
||||
|
||||
This protocol MUST be implemented to be compliant with this RFC. The
|
||||
DTD for this document type can be found in section 7.3.
|
||||
|
||||
4.1. UDP Description
|
||||
|
||||
A number of items have changed from the original UDP specification.
|
||||
Bit-masks, where present have been converted into human-readable
|
||||
values. Length and checksum and port values are present as decimal
|
||||
integers.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 5]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
To calculate the length and checksum fields of the UDP element, a
|
||||
canonicalized form of the element MUST be used as in section 2.1. An
|
||||
iterative method SHOULD be used to calculate checksums as in section
|
||||
2.1.
|
||||
|
||||
The payload element MUST be encoded as in section 2.1.
|
||||
|
||||
UDPoXML datagrams encapsulated by IPoXML MAY omit the <?xml?> header
|
||||
as well as the <!DOCTYPE> declaration.
|
||||
|
||||
4.2. Example Datagram
|
||||
|
||||
The following is an example UDPoXML datagram with an empty payload:
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE udp PUBLIC "-//IETF//DTD BLOAT 1.0 UDP//EN" "bloat.dtd">
|
||||
<udp>
|
||||
<udp.header>
|
||||
<src port="31415"/>
|
||||
<dest port="42424"/>
|
||||
<udp.length value="143"/>
|
||||
<checksum value="2988"/>
|
||||
</udp.header>
|
||||
<payload>
|
||||
</payload>
|
||||
</udp>
|
||||
|
||||
5. Network Transport
|
||||
|
||||
This document provides for the transmission of BLOAT datagrams over
|
||||
two common families of physical layer transport. Future RFCs will
|
||||
address additional transports as routing vendors catch up to the
|
||||
specification, and we begin to see BLOAT routed across the Internet
|
||||
backbone.
|
||||
|
||||
5.1. Ethernet
|
||||
|
||||
BLOAT is encapsulated in Ethernet datagrams as in [RFC894] with the
|
||||
exception that the type field of the Ethernet frame MUST contain the
|
||||
value 0xBEEF. The first 5 octets of the Ethernet frame payload will
|
||||
be 0x3c 3f 78 6d 6c ("<?xml".)
|
||||
|
||||
5.2. IEEE 802
|
||||
|
||||
BLOAT is encapsulated in IEEE 802 Networks as in [RFC1042] except
|
||||
that the protocol type code for IPoXML is 0xBEEF.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 6]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
6. Gatewaying over IP
|
||||
|
||||
In order to facilitate the gradual introduction of BLOAT into the
|
||||
public Internet, BLOAT MAY be encapsulated in IP as in [RFC2003] to
|
||||
gateway between networks that run BLOAT natively on their LANs.
|
||||
|
||||
7. DTDs
|
||||
|
||||
The Transport DTDs (7.2. and 7.3.) build on the definitions in the
|
||||
Network DTD (7.1.)
|
||||
|
||||
The DTDs are referenced by their PubidLiteral and SystemLiteral (from
|
||||
[XML]) although it is understood that most IPoXML implementations
|
||||
will not need to pull down the DTD, as it will normally be embedded
|
||||
in the implementation, and presents something of a catch-22 if you
|
||||
need to load part of your network protocol over the network.
|
||||
|
||||
7.1. IPoXML DTD
|
||||
|
||||
<!--
|
||||
DTD for IP over XML.
|
||||
Refer to this DTD as:
|
||||
|
||||
<!DOCTYPE ip PUBLIC "-//IETF//DTD BLOAT 1.0 IP//EN" "bloat.dtd">
|
||||
-->
|
||||
<!--
|
||||
DTD data types:
|
||||
|
||||
Digits [0..9]+
|
||||
|
||||
Precedence "NetworkControl | InternetworkControl |
|
||||
CRITIC | FlashOverride | Flash | Immediate |
|
||||
Priority | Routine"
|
||||
|
||||
IP4Addr "dotted-decimal" notation of [RFC1123]
|
||||
|
||||
Class [0..3]
|
||||
|
||||
Sec "Unclassified | Confidential | EFTO | MMMM | PROG |
|
||||
Restricted | Secret | Top Secret | Reserved"
|
||||
|
||||
Compartments [0..65535]
|
||||
|
||||
Handling [0..65535]
|
||||
|
||||
TCC [0..16777216]
|
||||
|
||||
-->
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 7]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
<!ENTITY % Digits "CDATA">
|
||||
<!ENTITY % Precedence "CDATA">
|
||||
<!ENTITY % IP4Addr "CDATA">
|
||||
<!ENTITY % Class "CDATA">
|
||||
<!ENTITY % Sec "CDATA">
|
||||
<!ENTITY % Compartments "CDATA">
|
||||
<!ENTITY % Handling "CDATA">
|
||||
<!ENTITY % TCC "CDATA">
|
||||
|
||||
<!ELEMENT ip (header, payload)>
|
||||
|
||||
<!ELEMENT header (version, tos, total.length, id, flags, offset, ttl,
|
||||
protocol, checksum, source, destination, options,
|
||||
padding)>
|
||||
<!-- length of header in 32-bit words -->
|
||||
<!ATTLIST header
|
||||
length %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT version EMPTY>
|
||||
<!-- ip version. SHOULD be "4" -->
|
||||
<!ATTLIST version
|
||||
value %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT tos EMPTY>
|
||||
<!ATTLIST tos
|
||||
precedence %Precedence; #REQUIRED
|
||||
delay (normal | low) #REQUIRED
|
||||
throughput (normal | high) #REQUIRED
|
||||
relibility (normal | high) #REQUIRED
|
||||
reserved CDATA #FIXED "0">
|
||||
|
||||
<!ELEMENT total.length EMPTY>
|
||||
<!--
|
||||
total length of datagram (header and payload) in octets, MUST be
|
||||
less than 65,535 (and SHOULD be less than 1024 for IPoXML on local
|
||||
ethernets).
|
||||
-->
|
||||
<!ATTLIST total.length
|
||||
value %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT id EMPTY>
|
||||
<!-- 0 <= id <= 65,535 -->
|
||||
<!ATTLIST id
|
||||
value %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT flags EMPTY>
|
||||
<!-- df = don't fragment, mf = more fragments -->
|
||||
<!ATTLIST flags
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 8]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
reserved CDATA #FIXED "0"
|
||||
df (may|dont) #REQUIRED
|
||||
mf (last|more) #REQUIRED>
|
||||
|
||||
<!ELEMENT offset EMPTY>
|
||||
<!-- 0 <= offset <= 8192 measured in 8 octet (64-bit) chunks -->
|
||||
<!ATTLIST offset
|
||||
value %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT ttl EMPTY>
|
||||
<!-- 0 <= ttl <= 255 -->
|
||||
<!ATTLIST ttl
|
||||
value %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT protocol EMPTY>
|
||||
<!-- 0 <= protocol <= 255 (per IANA) -->
|
||||
<!ATTLIST protocol
|
||||
value %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT checksum EMPTY>
|
||||
<!-- 0 <= checksum <= 65535 (over header only) -->
|
||||
<!ATTLIST checksum
|
||||
value %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT source EMPTY>
|
||||
<!ATTLIST source
|
||||
address %IP4Addr; #REQUIRED>
|
||||
|
||||
<!ELEMENT destination EMPTY>
|
||||
<!ATTLIST destination
|
||||
address %IP4Addr; #REQUIRED>
|
||||
|
||||
<!ELEMENT options ( end | noop | security | loose | strict | record
|
||||
| stream | timestamp )*>
|
||||
|
||||
<!ELEMENT end EMPTY>
|
||||
<!ATTLIST end
|
||||
copied (0|1) #REQUIRED
|
||||
class CDATA #FIXED "0"
|
||||
number CDATA #FIXED "0">
|
||||
|
||||
<!ELEMENT noop EMPTY>
|
||||
<!ATTLIST noop
|
||||
copied (0|1) #REQUIRED
|
||||
class CDATA #FIXED "0"
|
||||
number CDATA #FIXED "1">
|
||||
|
||||
<!ELEMENT security EMPTY>
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 9]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
<!ATTLIST security
|
||||
copied CDATA #FIXED "1"
|
||||
class CDATA #FIXED "0"
|
||||
number CDATA #FIXED "2"
|
||||
length CDATA #FIXED "11"
|
||||
security %Sec; #REQUIRED
|
||||
compartments %Compartments; #REQUIRED
|
||||
handling %Handling; #REQUIRED
|
||||
tcc %TCC; #REQUIRED>
|
||||
<!ELEMENT loose (hop)+>
|
||||
<!ATTLIST loose
|
||||
copied CDATA #FIXED "1"
|
||||
class CDATA #FIXED "0"
|
||||
number CDATA #FIXED "3"
|
||||
length %Digits; #REQUIRED
|
||||
pointer %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT hop EMPTY>
|
||||
<!ATTLIST hop
|
||||
address %IP4Addr; #REQUIRED>
|
||||
|
||||
<!ELEMENT strict (hop)+>
|
||||
<!ATTLIST strict
|
||||
copied CDATA #FIXED "1"
|
||||
class CDATA #FIXED "0"
|
||||
number CDATA #FIXED "9"
|
||||
length %Digits; #REQUIRED
|
||||
pointer %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT record (hop)+>
|
||||
<!ATTLIST record
|
||||
copied CDATA #FIXED "0"
|
||||
class CDATA #FIXED "0"
|
||||
number CDATA #FIXED "7"
|
||||
length %Digits; #REQUIRED
|
||||
pointer %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT stream EMPTY>
|
||||
<!-- 0 <= id <= 65,535 -->
|
||||
<!ATTLIST stream
|
||||
copied CDATA #FIXED "1"
|
||||
class CDATA #FIXED "0"
|
||||
number CDATA #FIXED "8"
|
||||
length CDATA #FIXED "4"
|
||||
id %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT timestamp (tstamp)+>
|
||||
<!-- 0 <= oflw <=15 -->
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 10]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
<!ATTLIST timestamp
|
||||
copied CDATA #FIXED "0"
|
||||
class CDATA #FIXED "2"
|
||||
number CDATA #FIXED "4"
|
||||
length %Digits; #REQUIRED
|
||||
pointer %Digits; #REQUIRED
|
||||
oflw %Digits; #REQUIRED
|
||||
flag (0 | 1 | 3) #REQUIRED>
|
||||
|
||||
<!ELEMENT tstamp EMPTY>
|
||||
<!ATTLIST tstamp
|
||||
time %Digits; #REQUIRED
|
||||
address %IP4Addr; #IMPLIED>
|
||||
<!--
|
||||
padding to bring header to 32-bit boundary.
|
||||
pad MUST be "0"*
|
||||
-->
|
||||
<!ELEMENT padding EMPTY>
|
||||
<!ATTLIST padding
|
||||
pad CDATA #REQUIRED>
|
||||
|
||||
<!-- payload MUST be encoded as base-64 [RFC2045], as modified
|
||||
by section 2.1 of this RFC -->
|
||||
<!ELEMENT payload (CDATA)>
|
||||
|
||||
7.2. TCPoXML DTD
|
||||
|
||||
<!--
|
||||
DTD for TCP over XML.
|
||||
Refer to this DTD as:
|
||||
|
||||
<!DOCTYPE tcp PUBLIC "-//IETF//DTD BLOAT 1.0 TCP//EN" "bloat.dtd">
|
||||
-->
|
||||
|
||||
<!-- the pseudoheader is only included for checksum calculations -->
|
||||
<!ELEMENT tcp (tcp.pseudoheader?, tcp.header, payload)>
|
||||
|
||||
<!ELEMENT tcp.header (src, dest, sequence, acknowledgement, offset,
|
||||
reserved, control, window, checksum, urgent,
|
||||
tcp.options, padding)>
|
||||
|
||||
<!ELEMENT src EMPTY>
|
||||
<!-- 0 <= port <= 65,535 -->
|
||||
<!ATTLIST src
|
||||
port %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT dest EMPTY>
|
||||
<!-- 0 <= port <= 65,535 -->
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 11]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
<!ATTLIST dest
|
||||
port %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT sequence EMPTY>
|
||||
<!-- 0 <= number <= 4294967295 -->
|
||||
<!ATTLIST sequence
|
||||
number %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT acknowledgement EMPTY>
|
||||
<!-- 0 <= number <= 4294967295 -->
|
||||
<!ATTLIST acknowledgement
|
||||
number %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT offset EMPTY>
|
||||
<!-- 0 <= number <= 255 -->
|
||||
<!ATTLIST offset
|
||||
number %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT reserved EMPTY>
|
||||
<!ATTLIST reserved
|
||||
value CDATA #FIXED "0">
|
||||
|
||||
<!ELEMENT control EMPTY>
|
||||
<!ATTLIST control
|
||||
urg (0|1) #IMPLIED
|
||||
ack (0|1) #IMPLIED
|
||||
psh (0|1) #IMPLIED
|
||||
rst (0|1) #IMPLIED
|
||||
syn (0|1) #IMPLIED
|
||||
fin (0|1) #IMPLIED>
|
||||
|
||||
<!ELEMENT window EMPTY>
|
||||
<!-- 0 <= size <= 65,535 -->
|
||||
<!ATTLIST window
|
||||
size %Digits; #REQUIRED>
|
||||
|
||||
<!--
|
||||
checksum as in ip, but with
|
||||
the following pseudo-header added into the tcp element:
|
||||
-->
|
||||
<!ELEMENT tcp.pseudoheader (source, destination, protocol,
|
||||
tcp.length)>
|
||||
|
||||
<!--
|
||||
tcp header + data length in octets. does not include the size of
|
||||
|
||||
the pseudoheader.
|
||||
-->
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 12]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
<!ELEMENT tcp.length EMPTY>
|
||||
<!ATTLIST tcp.length
|
||||
value %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT urgent EMPTY>
|
||||
<!-- 0 <= pointer <= 65,535 -->
|
||||
<!ATTLIST urgent
|
||||
pointer %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT tcp.options (tcp.end | tcp.noop | tcp.mss)+>
|
||||
|
||||
<!ELEMENT tcp.end EMPTY>
|
||||
<!ATTLIST tcp.end
|
||||
kind CDATA #FIXED "0">
|
||||
|
||||
<!ELEMENT tcp.noop EMPTY>
|
||||
<!ATTLIST tcp.noop
|
||||
kind CDATA #FIXED "1">
|
||||
|
||||
<!ELEMENT tcp.mss EMPTY>
|
||||
<!ATTLIST tcp.mss
|
||||
kind CDATA #FIXED "2"
|
||||
length CDATA #FIXED "4"
|
||||
size %Digits; #REQUIRED>
|
||||
|
||||
7.3. UDPoXML DTD
|
||||
|
||||
<!--
|
||||
DTD for UDP over XML.
|
||||
Refer to this DTD as:
|
||||
|
||||
<!DOCTYPE udp PUBLIC "-//IETF//DTD BLOAT 1.0 UDP//EN" "bloat.dtd">
|
||||
-->
|
||||
|
||||
<!ELEMENT udp (udp.pseudoheader?, udp.header, payload)>
|
||||
|
||||
<!ELEMENT udp.header (src, dest, udp.length, checksum)>
|
||||
|
||||
<!ELEMENT udp.pseudoheader (source, destination, protocol,
|
||||
udp.length)>
|
||||
|
||||
<!--
|
||||
udp header + data length in octets. does not include the size of
|
||||
the pseudoheader.
|
||||
-->
|
||||
<!ELEMENT udp.length EMPTY>
|
||||
<!ATTLIST udp.length
|
||||
value %Digits; #REQUIRED>
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 13]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
8. Security Considerations
|
||||
|
||||
XML, as a subset of SGML, has the same security considerations as
|
||||
specified in SGML Media Types [RFC1874]. Security considerations
|
||||
that apply to IP, TCP and UDP also likely apply to BLOAT as it does
|
||||
not attempt to correct for issues not related to message format.
|
||||
|
||||
9. References
|
||||
|
||||
[JABBER] Miller, J., "Jabber", draft-miller-jabber-00.txt,
|
||||
February 2002. (Work in Progress)
|
||||
|
||||
[RFC768] Postel, J., "User Datagram Protocol", STD 6, RFC 768,
|
||||
August 1980.
|
||||
|
||||
[RFC791] Postel, J., "Internet Protocol", STD 5, RFC 791,
|
||||
September 1981.
|
||||
|
||||
[RFC793] Postel, J., "Transmission Control Protocol", STD 7, RFC
|
||||
793, September 1981.
|
||||
|
||||
[RFC894] Hornig, C., "Standard for the Transmission of IP
|
||||
Datagrams over Ethernet Networks.", RFC 894, April 1984.
|
||||
|
||||
[RFC1042] Postel, J. and J. Reynolds, "Standard for the
|
||||
Transmission of IP Datagrams Over IEEE 802 Networks", STD
|
||||
43, RFC 1042, February 1988.
|
||||
|
||||
[RFC1123] Braden, R., "Requirements for Internet Hosts -
|
||||
Application and Support", RFC 1123, October 1989.
|
||||
|
||||
[RFC1874] Levinson, E., "SGML Media Types", RFC 1874, December
|
||||
1995.
|
||||
|
||||
[RFC2003] Perkins, C., "IP Encapsulation within IP", RFC 2003,
|
||||
October 1996.
|
||||
|
||||
[RFC2045] Freed, N. and N. Borenstein, "Multipurpose Internet Mail
|
||||
Extensions (MIME) Part One: Format of Internet Message
|
||||
Bodies", RFC 2045, November 1996.
|
||||
|
||||
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
|
||||
Requirement Levels", BCP 14, RFC 2119, March 1997.
|
||||
|
||||
[RFC2279] Yergeau, F., "UTF-8, a transformation format of ISO
|
||||
10646", RFC 2279, January 1998.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 14]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
[RFC2460] Deering, S. and R. Hinden, "Internet Protocol, Version 6
|
||||
(IPv6) Specification", RFC 2460, December 1998.
|
||||
|
||||
[RFC3080] Rose, M., "The Blocks Extensible Exchange Protocol Core",
|
||||
RFC 3080, March 2001.
|
||||
|
||||
[SOAP] Box, D., Ehnebuske, D., Kakivaya, G., Layman, A.,
|
||||
Mendelsohn, N., Nielsen, H. F., Thatte, S. Winer, D.,
|
||||
"Simple Object Access Protocol (SOAP) 1.1" World Wide Web
|
||||
Consortium Note, May 2000 http://www.w3.org/TR/SOAP/
|
||||
|
||||
[XML] Bray, T., Paoli, J., Sperberg-McQueen, C. M., "Extensible
|
||||
Markup Language (XML)" World Wide Web Consortium
|
||||
Recommendation REC- xml-19980210.
|
||||
http://www.w3.org/TR/1998/REC-xml-19980210
|
||||
|
||||
10. Author's Address
|
||||
|
||||
Hugh Kennedy
|
||||
Mimezine
|
||||
1060 West Addison
|
||||
Chicago, IL 60613
|
||||
USA
|
||||
|
||||
EMail: kennedyh@engin.umich.edu
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 15]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
11. Full Copyright Statement
|
||||
|
||||
Copyright (C) The Internet Society (2002). All Rights Reserved.
|
||||
|
||||
This document and translations of it may be copied and furnished to
|
||||
others, and derivative works that comment on or otherwise explain it
|
||||
or assist in its implementation may be prepared, copied, published
|
||||
and distributed, in whole or in part, without restriction of any
|
||||
kind, provided that the above copyright notice and this paragraph are
|
||||
included on all such copies and derivative works. However, this
|
||||
document itself may not be modified in any way, such as by removing
|
||||
the copyright notice or references to the Internet Society or other
|
||||
Internet organizations, except as needed for the purpose of
|
||||
developing Internet standards in which case the procedures for
|
||||
copyrights defined in the Internet Standards process must be
|
||||
followed, or as required to translate it into languages other than
|
||||
English.
|
||||
|
||||
The limited permissions granted above are perpetual and will not be
|
||||
revoked by the Internet Society or its successors or assigns.
|
||||
|
||||
This document and the information contained herein is provided on an
|
||||
"AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
|
||||
TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
|
||||
BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
|
||||
HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
Acknowledgement
|
||||
|
||||
Funding for the RFC Editor function is currently provided by the
|
||||
Internet Society.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 16]
|
||||
|
@ -1,899 +0,0 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Network Working Group H. Kennedy
|
||||
Request for Comments: 3252 Mimezine
|
||||
Category: Informational 1 April 2002
|
||||
|
||||
|
||||
Binary Lexical Octet Ad-hoc Transport
|
||||
|
||||
Status of this Memo
|
||||
|
||||
This memo provides information for the Internet community. It does
|
||||
not specify an Internet standard of any kind. Distribution of this
|
||||
memo is unlimited.
|
||||
|
||||
Copyright Notice
|
||||
|
||||
Copyright (C) The Internet Society (2002). All Rights Reserved.
|
||||
|
||||
Abstract
|
||||
|
||||
This document defines a reformulation of IP and two transport layer
|
||||
protocols (TCP and UDP) as XML applications.
|
||||
|
||||
1. Introduction
|
||||
|
||||
1.1. Overview
|
||||
|
||||
This document describes the Binary Lexical Octet Ad-hoc Transport
|
||||
(BLOAT): a reformulation of a widely-deployed network-layer protocol
|
||||
(IP [RFC791]), and two associated transport layer protocols (TCP
|
||||
[RFC793] and UDP [RFC768]) as XML [XML] applications. It also
|
||||
describes methods for transporting BLOAT over Ethernet and IEEE 802
|
||||
networks as well as encapsulating BLOAT in IP for gatewaying BLOAT
|
||||
across the public Internet.
|
||||
|
||||
1.2. Motivation
|
||||
|
||||
The wild popularity of XML as a basis for application-level protocols
|
||||
such as the Blocks Extensible Exchange Protocol [RFC3080], the Simple
|
||||
Object Access Protocol [SOAP], and Jabber [JABBER] prompted
|
||||
investigation into the possibility of extending the use of XML in the
|
||||
protocol stack. Using XML at both the transport and network layer in
|
||||
addition to the application layer would provide for an amazing amount
|
||||
of power and flexibility while removing dependencies on proprietary
|
||||
and hard-to-understand binary protocols. This protocol unification
|
||||
would also allow applications to use a single XML parser for all
|
||||
aspects of their operation, eliminating developer time spent figuring
|
||||
out the intricacies of each new protocol, and moving the hard work of
|
||||
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 1]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
parsing to the XML toolset. The use of XML also mitigates concerns
|
||||
over "network vs. host" byte ordering which is at the root of many
|
||||
network application bugs.
|
||||
|
||||
1.3. Relation to Existing Protocols
|
||||
|
||||
The reformulations specified in this RFC follow as closely as
|
||||
possible the spirit of the RFCs on which they are based, and so MAY
|
||||
contain elements or attributes that would not be needed in a pure
|
||||
reworking (e.g. length attributes, which are implicit in XML.)
|
||||
|
||||
The layering of network and transport protocols are maintained in
|
||||
this RFC despite the optimizations that could be made if the line
|
||||
were somewhat blurred (i.e. merging TCP and IP into a single, larger
|
||||
element in the DTD) in order to foster future use of this protocol as
|
||||
a basis for reformulating other protocols (such as ICMP.)
|
||||
|
||||
Other than the encoding, the behavioral aspects of each of the
|
||||
existing protocols remain unchanged. Routing, address spaces, TCP
|
||||
congestion control, etc. behave as specified in the extant standards.
|
||||
Adapting to new standards and experimental algorithm heuristics for
|
||||
improving performance will become much easier once the move to BLOAT
|
||||
has been completed.
|
||||
|
||||
1.4. Requirement Levels
|
||||
|
||||
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
|
||||
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
|
||||
document are to be interpreted as described in BCP 14, RFC 2119
|
||||
[RFC2119].
|
||||
|
||||
2. IPoXML
|
||||
|
||||
This protocol MUST be implemented to be compliant with this RFC.
|
||||
IPoXML is the root protocol REQUIRED for effective use of TCPoXML
|
||||
(section 3.) and higher-level application protocols.
|
||||
|
||||
The DTD for this document type can be found in section 7.1.
|
||||
|
||||
The routing of IPoXML can be easily implemented on hosts with an XML
|
||||
parser, as the regular structure lends itself handily to parsing and
|
||||
validation of the document/datagram and then processing the
|
||||
destination address, TTL, and checksum before sending it on to its
|
||||
next-hop.
|
||||
|
||||
The reformulation of IPv4 was chosen over IPv6 [RFC2460] due to the
|
||||
wider deployment of IPv4 and the fact that implementing IPv6 as XML
|
||||
would have exceeded the 1500 byte Ethernet MTU.
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 2]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
All BLOAT implementations MUST use - and specify - the UTF-8 encoding
|
||||
of RFC 2279 [RFC2279]. All BLOAT document/datagrams MUST be well-
|
||||
formed and include the XMLDecl.
|
||||
|
||||
2.1. IP Description
|
||||
|
||||
A number of items have changed (for the better) from the original IP
|
||||
specification. Bit-masks, where present have been converted into
|
||||
human-readable values. IP addresses are listed in their dotted-
|
||||
decimal notation [RFC1123]. Length and checksum values are present
|
||||
as decimal integers.
|
||||
|
||||
To calculate the length and checksum fields of the IP element, a
|
||||
canonicalized form of the element MUST be used. The canonical form
|
||||
SHALL have no whitespace (including newline characters) between
|
||||
elements and only one space character between attributes. There
|
||||
SHALL NOT be a space following the last attribute in an element.
|
||||
|
||||
An iterative method SHOULD be used to calculate checksums, as the
|
||||
length field will vary based on the size of the checksum.
|
||||
|
||||
The payload element bears special attention. Due to the character
|
||||
set restrictions of XML, the payload of IP datagrams (which MAY
|
||||
contain arbitrary data) MUST be encoded for transport. This RFC
|
||||
REQUIRES the contents of the payload to be encoded in the base-64
|
||||
encoding of RFC 2045 [RFC2045], but removes the requirement that the
|
||||
encoded output MUST be wrapped on 76-character lines.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 3]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
2.2. Example Datagram
|
||||
|
||||
The following is an example IPoXML datagram with an empty payload:
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE ip PUBLIC "-//IETF//DTD BLOAT 1.0 IP//EN" "bloat.dtd">
|
||||
<ip>
|
||||
<header length="474">
|
||||
<version value="4"/>
|
||||
<tos precedence="Routine" delay="Normal" throughput="Normal"
|
||||
relibility="Normal" reserved="0"/>
|
||||
<total.length value="461"/>
|
||||
<id value="1"/>
|
||||
<flags reserved="0" df="dont" mf="last"/>
|
||||
<offset value="0"/>
|
||||
<ttl value="255"/>
|
||||
<protocol value="6"/>
|
||||
<checksum value="8707"/>
|
||||
<source address="10.0.0.22"/>
|
||||
<destination address="10.0.0.1"/>
|
||||
<options>
|
||||
<end copied="0" class="0" number="0"/>
|
||||
</options>
|
||||
<padding pad="0"/>
|
||||
</header>
|
||||
<payload>
|
||||
</payload>
|
||||
</ip>
|
||||
|
||||
3. TCPoXML
|
||||
|
||||
This protocol MUST be implemented to be compliant with this RFC. The
|
||||
DTD for this document type can be found in section 7.2.
|
||||
|
||||
3.1. TCP Description
|
||||
|
||||
A number of items have changed from the original TCP specification.
|
||||
Bit-masks, where present have been converted into human-readable
|
||||
values. Length and checksum and port values are present as decimal
|
||||
integers.
|
||||
|
||||
To calculate the length and checksum fields of the TCP element, a
|
||||
canonicalized form of the element MUST be used as in section 2.1.
|
||||
|
||||
An iterative method SHOULD be used to calculate checksums as in
|
||||
section 2.1.
|
||||
|
||||
The payload element MUST be encoded as in section 2.1.
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 4]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
The TCP offset element was expanded to a maximum of 255 from 16 to
|
||||
allow for the increased size of the header in XML.
|
||||
|
||||
TCPoXML datagrams encapsulated by IPoXML MAY omit the <?xml?> header
|
||||
as well as the <!DOCTYPE> declaration.
|
||||
|
||||
3.2. Example Datagram
|
||||
|
||||
The following is an example TCPoXML datagram with an empty payload:
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE tcp PUBLIC "-//IETF//DTD BLOAT 1.0 TCP//EN" "bloat.dtd">
|
||||
<tcp>
|
||||
<tcp.header>
|
||||
<src port="31415"/>
|
||||
<dest port="42424"/>
|
||||
<sequence number="322622954"/>
|
||||
<acknowledgement number="689715995"/>
|
||||
<offset number=""/>
|
||||
<reserved value="0"/>
|
||||
<control syn="1" ack="1"/>
|
||||
<window size="1"/>
|
||||
<urgent pointer="0"/>
|
||||
<checksum value="2988"/>
|
||||
<tcp.options>
|
||||
<tcp.end kind="0"/>
|
||||
</tcp.options>
|
||||
<padding pad="0"/>
|
||||
</tcp.header>
|
||||
<payload>
|
||||
</payload>
|
||||
</tcp>
|
||||
|
||||
4. UDPoXML
|
||||
|
||||
This protocol MUST be implemented to be compliant with this RFC. The
|
||||
DTD for this document type can be found in section 7.3.
|
||||
|
||||
4.1. UDP Description
|
||||
|
||||
A number of items have changed from the original UDP specification.
|
||||
Bit-masks, where present have been converted into human-readable
|
||||
values. Length and checksum and port values are present as decimal
|
||||
integers.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 5]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
To calculate the length and checksum fields of the UDP element, a
|
||||
canonicalized form of the element MUST be used as in section 2.1. An
|
||||
iterative method SHOULD be used to calculate checksums as in section
|
||||
2.1.
|
||||
|
||||
The payload element MUST be encoded as in section 2.1.
|
||||
|
||||
UDPoXML datagrams encapsulated by IPoXML MAY omit the <?xml?> header
|
||||
as well as the <!DOCTYPE> declaration.
|
||||
|
||||
4.2. Example Datagram
|
||||
|
||||
The following is an example UDPoXML datagram with an empty payload:
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE udp PUBLIC "-//IETF//DTD BLOAT 1.0 UDP//EN" "bloat.dtd">
|
||||
<udp>
|
||||
<udp.header>
|
||||
<src port="31415"/>
|
||||
<dest port="42424"/>
|
||||
<udp.length value="143"/>
|
||||
<checksum value="2988"/>
|
||||
</udp.header>
|
||||
<payload>
|
||||
</payload>
|
||||
</udp>
|
||||
|
||||
5. Network Transport
|
||||
|
||||
This document provides for the transmission of BLOAT datagrams over
|
||||
two common families of physical layer transport. Future RFCs will
|
||||
address additional transports as routing vendors catch up to the
|
||||
specification, and we begin to see BLOAT routed across the Internet
|
||||
backbone.
|
||||
|
||||
5.1. Ethernet
|
||||
|
||||
BLOAT is encapsulated in Ethernet datagrams as in [RFC894] with the
|
||||
exception that the type field of the Ethernet frame MUST contain the
|
||||
value 0xBEEF. The first 5 octets of the Ethernet frame payload will
|
||||
be 0x3c 3f 78 6d 6c ("<?xml".)
|
||||
|
||||
5.2. IEEE 802
|
||||
|
||||
BLOAT is encapsulated in IEEE 802 Networks as in [RFC1042] except
|
||||
that the protocol type code for IPoXML is 0xBEEF.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 6]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
6. Gatewaying over IP
|
||||
|
||||
In order to facilitate the gradual introduction of BLOAT into the
|
||||
public Internet, BLOAT MAY be encapsulated in IP as in [RFC2003] to
|
||||
gateway between networks that run BLOAT natively on their LANs.
|
||||
|
||||
7. DTDs
|
||||
|
||||
The Transport DTDs (7.2. and 7.3.) build on the definitions in the
|
||||
Network DTD (7.1.)
|
||||
|
||||
The DTDs are referenced by their PubidLiteral and SystemLiteral (from
|
||||
[XML]) although it is understood that most IPoXML implementations
|
||||
will not need to pull down the DTD, as it will normally be embedded
|
||||
in the implementation, and presents something of a catch-22 if you
|
||||
need to load part of your network protocol over the network.
|
||||
|
||||
7.1. IPoXML DTD
|
||||
|
||||
<!--
|
||||
DTD for IP over XML.
|
||||
Refer to this DTD as:
|
||||
|
||||
<!DOCTYPE ip PUBLIC "-//IETF//DTD BLOAT 1.0 IP//EN" "bloat.dtd">
|
||||
-->
|
||||
<!--
|
||||
DTD data types:
|
||||
|
||||
Digits [0..9]+
|
||||
|
||||
Precedence "NetworkControl | InternetworkControl |
|
||||
CRITIC | FlashOverride | Flash | Immediate |
|
||||
Priority | Routine"
|
||||
|
||||
IP4Addr "dotted-decimal" notation of [RFC1123]
|
||||
|
||||
Class [0..3]
|
||||
|
||||
Sec "Unclassified | Confidential | EFTO | MMMM | PROG |
|
||||
Restricted | Secret | Top Secret | Reserved"
|
||||
|
||||
Compartments [0..65535]
|
||||
|
||||
Handling [0..65535]
|
||||
|
||||
TCC [0..16777216]
|
||||
|
||||
-->
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 7]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
<!ENTITY % Digits "CDATA">
|
||||
<!ENTITY % Precedence "CDATA">
|
||||
<!ENTITY % IP4Addr "CDATA">
|
||||
<!ENTITY % Class "CDATA">
|
||||
<!ENTITY % Sec "CDATA">
|
||||
<!ENTITY % Compartments "CDATA">
|
||||
<!ENTITY % Handling "CDATA">
|
||||
<!ENTITY % TCC "CDATA">
|
||||
|
||||
<!ELEMENT ip (header, payload)>
|
||||
|
||||
<!ELEMENT header (version, tos, total.length, id, flags, offset, ttl,
|
||||
protocol, checksum, source, destination, options,
|
||||
padding)>
|
||||
<!-- length of header in 32-bit words -->
|
||||
<!ATTLIST header
|
||||
length %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT version EMPTY>
|
||||
<!-- ip version. SHOULD be "4" -->
|
||||
<!ATTLIST version
|
||||
value %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT tos EMPTY>
|
||||
<!ATTLIST tos
|
||||
precedence %Precedence; #REQUIRED
|
||||
delay (normal | low) #REQUIRED
|
||||
throughput (normal | high) #REQUIRED
|
||||
relibility (normal | high) #REQUIRED
|
||||
reserved CDATA #FIXED "0">
|
||||
|
||||
<!ELEMENT total.length EMPTY>
|
||||
<!--
|
||||
total length of datagram (header and payload) in octets, MUST be
|
||||
less than 65,535 (and SHOULD be less than 1024 for IPoXML on local
|
||||
ethernets).
|
||||
-->
|
||||
<!ATTLIST total.length
|
||||
value %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT id EMPTY>
|
||||
<!-- 0 <= id <= 65,535 -->
|
||||
<!ATTLIST id
|
||||
value %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT flags EMPTY>
|
||||
<!-- df = don't fragment, mf = more fragments -->
|
||||
<!ATTLIST flags
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 8]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
reserved CDATA #FIXED "0"
|
||||
df (may|dont) #REQUIRED
|
||||
mf (last|more) #REQUIRED>
|
||||
|
||||
<!ELEMENT offset EMPTY>
|
||||
<!-- 0 <= offset <= 8192 measured in 8 octet (64-bit) chunks -->
|
||||
<!ATTLIST offset
|
||||
value %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT ttl EMPTY>
|
||||
<!-- 0 <= ttl <= 255 -->
|
||||
<!ATTLIST ttl
|
||||
value %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT protocol EMPTY>
|
||||
<!-- 0 <= protocol <= 255 (per IANA) -->
|
||||
<!ATTLIST protocol
|
||||
value %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT checksum EMPTY>
|
||||
<!-- 0 <= checksum <= 65535 (over header only) -->
|
||||
<!ATTLIST checksum
|
||||
value %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT source EMPTY>
|
||||
<!ATTLIST source
|
||||
address %IP4Addr; #REQUIRED>
|
||||
|
||||
<!ELEMENT destination EMPTY>
|
||||
<!ATTLIST destination
|
||||
address %IP4Addr; #REQUIRED>
|
||||
|
||||
<!ELEMENT options ( end | noop | security | loose | strict | record
|
||||
| stream | timestamp )*>
|
||||
|
||||
<!ELEMENT end EMPTY>
|
||||
<!ATTLIST end
|
||||
copied (0|1) #REQUIRED
|
||||
class CDATA #FIXED "0"
|
||||
number CDATA #FIXED "0">
|
||||
|
||||
<!ELEMENT noop EMPTY>
|
||||
<!ATTLIST noop
|
||||
copied (0|1) #REQUIRED
|
||||
class CDATA #FIXED "0"
|
||||
number CDATA #FIXED "1">
|
||||
|
||||
<!ELEMENT security EMPTY>
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 9]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
<!ATTLIST security
|
||||
copied CDATA #FIXED "1"
|
||||
class CDATA #FIXED "0"
|
||||
number CDATA #FIXED "2"
|
||||
length CDATA #FIXED "11"
|
||||
security %Sec; #REQUIRED
|
||||
compartments %Compartments; #REQUIRED
|
||||
handling %Handling; #REQUIRED
|
||||
tcc %TCC; #REQUIRED>
|
||||
<!ELEMENT loose (hop)+>
|
||||
<!ATTLIST loose
|
||||
copied CDATA #FIXED "1"
|
||||
class CDATA #FIXED "0"
|
||||
number CDATA #FIXED "3"
|
||||
length %Digits; #REQUIRED
|
||||
pointer %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT hop EMPTY>
|
||||
<!ATTLIST hop
|
||||
address %IP4Addr; #REQUIRED>
|
||||
|
||||
<!ELEMENT strict (hop)+>
|
||||
<!ATTLIST strict
|
||||
copied CDATA #FIXED "1"
|
||||
class CDATA #FIXED "0"
|
||||
number CDATA #FIXED "9"
|
||||
length %Digits; #REQUIRED
|
||||
pointer %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT record (hop)+>
|
||||
<!ATTLIST record
|
||||
copied CDATA #FIXED "0"
|
||||
class CDATA #FIXED "0"
|
||||
number CDATA #FIXED "7"
|
||||
length %Digits; #REQUIRED
|
||||
pointer %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT stream EMPTY>
|
||||
<!-- 0 <= id <= 65,535 -->
|
||||
<!ATTLIST stream
|
||||
copied CDATA #FIXED "1"
|
||||
class CDATA #FIXED "0"
|
||||
number CDATA #FIXED "8"
|
||||
length CDATA #FIXED "4"
|
||||
id %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT timestamp (tstamp)+>
|
||||
<!-- 0 <= oflw <=15 -->
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 10]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
<!ATTLIST timestamp
|
||||
copied CDATA #FIXED "0"
|
||||
class CDATA #FIXED "2"
|
||||
number CDATA #FIXED "4"
|
||||
length %Digits; #REQUIRED
|
||||
pointer %Digits; #REQUIRED
|
||||
oflw %Digits; #REQUIRED
|
||||
flag (0 | 1 | 3) #REQUIRED>
|
||||
|
||||
<!ELEMENT tstamp EMPTY>
|
||||
<!ATTLIST tstamp
|
||||
time %Digits; #REQUIRED
|
||||
address %IP4Addr; #IMPLIED>
|
||||
<!--
|
||||
padding to bring header to 32-bit boundary.
|
||||
pad MUST be "0"*
|
||||
-->
|
||||
<!ELEMENT padding EMPTY>
|
||||
<!ATTLIST padding
|
||||
pad CDATA #REQUIRED>
|
||||
|
||||
<!-- payload MUST be encoded as base-64 [RFC2045], as modified
|
||||
by section 2.1 of this RFC -->
|
||||
<!ELEMENT payload (CDATA)>
|
||||
|
||||
7.2. TCPoXML DTD
|
||||
|
||||
<!--
|
||||
DTD for TCP over XML.
|
||||
Refer to this DTD as:
|
||||
|
||||
<!DOCTYPE tcp PUBLIC "-//IETF//DTD BLOAT 1.0 TCP//EN" "bloat.dtd">
|
||||
-->
|
||||
|
||||
<!-- the pseudoheader is only included for checksum calculations -->
|
||||
<!ELEMENT tcp (tcp.pseudoheader?, tcp.header, payload)>
|
||||
|
||||
<!ELEMENT tcp.header (src, dest, sequence, acknowledgement, offset,
|
||||
reserved, control, window, checksum, urgent,
|
||||
tcp.options, padding)>
|
||||
|
||||
<!ELEMENT src EMPTY>
|
||||
<!-- 0 <= port <= 65,535 -->
|
||||
<!ATTLIST src
|
||||
port %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT dest EMPTY>
|
||||
<!-- 0 <= port <= 65,535 -->
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 11]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
<!ATTLIST dest
|
||||
port %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT sequence EMPTY>
|
||||
<!-- 0 <= number <= 4294967295 -->
|
||||
<!ATTLIST sequence
|
||||
number %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT acknowledgement EMPTY>
|
||||
<!-- 0 <= number <= 4294967295 -->
|
||||
<!ATTLIST acknowledgement
|
||||
number %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT offset EMPTY>
|
||||
<!-- 0 <= number <= 255 -->
|
||||
<!ATTLIST offset
|
||||
number %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT reserved EMPTY>
|
||||
<!ATTLIST reserved
|
||||
value CDATA #FIXED "0">
|
||||
|
||||
<!ELEMENT control EMPTY>
|
||||
<!ATTLIST control
|
||||
urg (0|1) #IMPLIED
|
||||
ack (0|1) #IMPLIED
|
||||
psh (0|1) #IMPLIED
|
||||
rst (0|1) #IMPLIED
|
||||
syn (0|1) #IMPLIED
|
||||
fin (0|1) #IMPLIED>
|
||||
|
||||
<!ELEMENT window EMPTY>
|
||||
<!-- 0 <= size <= 65,535 -->
|
||||
<!ATTLIST window
|
||||
size %Digits; #REQUIRED>
|
||||
|
||||
<!--
|
||||
checksum as in ip, but with
|
||||
the following pseudo-header added into the tcp element:
|
||||
-->
|
||||
<!ELEMENT tcp.pseudoheader (source, destination, protocol,
|
||||
tcp.length)>
|
||||
|
||||
<!--
|
||||
tcp header + data length in octets. does not include the size of
|
||||
|
||||
the pseudoheader.
|
||||
-->
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 12]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
<!ELEMENT tcp.length EMPTY>
|
||||
<!ATTLIST tcp.length
|
||||
value %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT urgent EMPTY>
|
||||
<!-- 0 <= pointer <= 65,535 -->
|
||||
<!ATTLIST urgent
|
||||
pointer %Digits; #REQUIRED>
|
||||
|
||||
<!ELEMENT tcp.options (tcp.end | tcp.noop | tcp.mss)+>
|
||||
|
||||
<!ELEMENT tcp.end EMPTY>
|
||||
<!ATTLIST tcp.end
|
||||
kind CDATA #FIXED "0">
|
||||
|
||||
<!ELEMENT tcp.noop EMPTY>
|
||||
<!ATTLIST tcp.noop
|
||||
kind CDATA #FIXED "1">
|
||||
|
||||
<!ELEMENT tcp.mss EMPTY>
|
||||
<!ATTLIST tcp.mss
|
||||
kind CDATA #FIXED "2"
|
||||
length CDATA #FIXED "4"
|
||||
size %Digits; #REQUIRED>
|
||||
|
||||
7.3. UDPoXML DTD
|
||||
|
||||
<!--
|
||||
DTD for UDP over XML.
|
||||
Refer to this DTD as:
|
||||
|
||||
<!DOCTYPE udp PUBLIC "-//IETF//DTD BLOAT 1.0 UDP//EN" "bloat.dtd">
|
||||
-->
|
||||
|
||||
<!ELEMENT udp (udp.pseudoheader?, udp.header, payload)>
|
||||
|
||||
<!ELEMENT udp.header (src, dest, udp.length, checksum)>
|
||||
|
||||
<!ELEMENT udp.pseudoheader (source, destination, protocol,
|
||||
udp.length)>
|
||||
|
||||
<!--
|
||||
udp header + data length in octets. does not include the size of
|
||||
the pseudoheader.
|
||||
-->
|
||||
<!ELEMENT udp.length EMPTY>
|
||||
<!ATTLIST udp.length
|
||||
value %Digits; #REQUIRED>
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 13]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
8. Security Considerations
|
||||
|
||||
XML, as a subset of SGML, has the same security considerations as
|
||||
specified in SGML Media Types [RFC1874]. Security considerations
|
||||
that apply to IP, TCP and UDP also likely apply to BLOAT as it does
|
||||
not attempt to correct for issues not related to message format.
|
||||
|
||||
9. References
|
||||
|
||||
[JABBER] Miller, J., "Jabber", draft-miller-jabber-00.txt,
|
||||
February 2002. (Work in Progress)
|
||||
|
||||
[RFC768] Postel, J., "User Datagram Protocol", STD 6, RFC 768,
|
||||
August 1980.
|
||||
|
||||
[RFC791] Postel, J., "Internet Protocol", STD 5, RFC 791,
|
||||
September 1981.
|
||||
|
||||
[RFC793] Postel, J., "Transmission Control Protocol", STD 7, RFC
|
||||
793, September 1981.
|
||||
|
||||
[RFC894] Hornig, C., "Standard for the Transmission of IP
|
||||
Datagrams over Ethernet Networks.", RFC 894, April 1984.
|
||||
|
||||
[RFC1042] Postel, J. and J. Reynolds, "Standard for the
|
||||
Transmission of IP Datagrams Over IEEE 802 Networks", STD
|
||||
43, RFC 1042, February 1988.
|
||||
|
||||
[RFC1123] Braden, R., "Requirements for Internet Hosts -
|
||||
Application and Support", RFC 1123, October 1989.
|
||||
|
||||
[RFC1874] Levinson, E., "SGML Media Types", RFC 1874, December
|
||||
1995.
|
||||
|
||||
[RFC2003] Perkins, C., "IP Encapsulation within IP", RFC 2003,
|
||||
October 1996.
|
||||
|
||||
[RFC2045] Freed, N. and N. Borenstein, "Multipurpose Internet Mail
|
||||
Extensions (MIME) Part One: Format of Internet Message
|
||||
Bodies", RFC 2045, November 1996.
|
||||
|
||||
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
|
||||
Requirement Levels", BCP 14, RFC 2119, March 1997.
|
||||
|
||||
[RFC2279] Yergeau, F., "UTF-8, a transformation format of ISO
|
||||
10646", RFC 2279, January 1998.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 14]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
[RFC2460] Deering, S. and R. Hinden, "Internet Protocol, Version 6
|
||||
(IPv6) Specification", RFC 2460, December 1998.
|
||||
|
||||
[RFC3080] Rose, M., "The Blocks Extensible Exchange Protocol Core",
|
||||
RFC 3080, March 2001.
|
||||
|
||||
[SOAP] Box, D., Ehnebuske, D., Kakivaya, G., Layman, A.,
|
||||
Mendelsohn, N., Nielsen, H. F., Thatte, S. Winer, D.,
|
||||
"Simple Object Access Protocol (SOAP) 1.1" World Wide Web
|
||||
Consortium Note, May 2000 http://www.w3.org/TR/SOAP/
|
||||
|
||||
[XML] Bray, T., Paoli, J., Sperberg-McQueen, C. M., "Extensible
|
||||
Markup Language (XML)" World Wide Web Consortium
|
||||
Recommendation REC- xml-19980210.
|
||||
http://www.w3.org/TR/1998/REC-xml-19980210
|
||||
|
||||
10. Author's Address
|
||||
|
||||
Hugh Kennedy
|
||||
Mimezine
|
||||
1060 West Addison
|
||||
Chicago, IL 60613
|
||||
USA
|
||||
|
||||
EMail: kennedyh@engin.umich.edu
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 15]
|
||||
|
||||
RFC 3252 Binary Lexical Octet Ad-hoc Transport 1 April 2002
|
||||
|
||||
|
||||
11. Full Copyright Statement
|
||||
|
||||
Copyright (C) The Internet Society (2002). All Rights Reserved.
|
||||
|
||||
This document and translations of it may be copied and furnished to
|
||||
others, and derivative works that comment on or otherwise explain it
|
||||
or assist in its implementation may be prepared, copied, published
|
||||
and distributed, in whole or in part, without restriction of any
|
||||
kind, provided that the above copyright notice and this paragraph are
|
||||
included on all such copies and derivative works. However, this
|
||||
document itself may not be modified in any way, such as by removing
|
||||
the copyright notice or references to the Internet Society or other
|
||||
Internet organizations, except as needed for the purpose of
|
||||
developing Internet standards in which case the procedures for
|
||||
copyrights defined in the Internet Standards process must be
|
||||
followed, or as required to translate it into languages other than
|
||||
English.
|
||||
|
||||
The limited permissions granted above are perpetual and will not be
|
||||
revoked by the Internet Society or its successors or assigns.
|
||||
|
||||
This document and the information contained herein is provided on an
|
||||
"AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
|
||||
TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
|
||||
BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
|
||||
HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
Acknowledgement
|
||||
|
||||
Funding for the RFC Editor function is currently provided by the
|
||||
Internet Society.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Kennedy Informational [Page 16]
|
||||
|
@ -50,7 +50,6 @@
|
||||
#include <qhostinfo.h>
|
||||
#include <qhostaddress.h>
|
||||
#include <qtcpsocket.h>
|
||||
#include <qhttp.h>
|
||||
#include <qdebug.h>
|
||||
#include <qtcpserver.h>
|
||||
|
||||
|
@ -52,7 +52,6 @@
|
||||
#include <qhostinfo.h>
|
||||
#include <qhostaddress.h>
|
||||
#include <qtcpsocket.h>
|
||||
#include <qhttp.h>
|
||||
#include <qauthenticator.h>
|
||||
#include <qdebug.h>
|
||||
#include <qtcpserver.h>
|
||||
|
@ -41,7 +41,9 @@
|
||||
|
||||
|
||||
#include <QDomDocument>
|
||||
#include <QHttp>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkReply>
|
||||
#include <QNetworkRequest>
|
||||
#include <QTcpServer>
|
||||
#include <QTcpSocket>
|
||||
#include <QTimer>
|
||||
@ -116,13 +118,16 @@ class ServerAndClient : public QObject
|
||||
public:
|
||||
ServerAndClient(QEventLoop &ev) : success(false)
|
||||
, eventLoop(ev)
|
||||
, isBody(false)
|
||||
, bodyBytesRead(0)
|
||||
, bodyLength(-1)
|
||||
{
|
||||
setObjectName("serverAndClient");
|
||||
tcpServer = new QTcpServer(this);
|
||||
connect(tcpServer, SIGNAL(newConnection()), this, SLOT(newConnection()));
|
||||
tcpServer->listen(QHostAddress::LocalHost, 1088);
|
||||
httpClient = new QHttp(this);
|
||||
connect(httpClient, SIGNAL(requestFinished(int, bool)), SLOT(requestFinished(int, bool)));
|
||||
httpClient = new QNetworkAccessManager(this);
|
||||
connect(httpClient, SIGNAL(finished(QNetworkReply*)), SLOT(requestFinished(QNetworkReply*)));
|
||||
}
|
||||
|
||||
bool success;
|
||||
@ -132,25 +137,26 @@ public slots:
|
||||
void doIt()
|
||||
{
|
||||
QUrl url("http://127.0.0.1:1088");
|
||||
httpClient->setHost( url.host(), 1088);
|
||||
QHttpRequestHeader req_head("POST", url.path());
|
||||
req_head.setValue("host", url.host());
|
||||
req_head.setValue("user-agent", "xml-test");
|
||||
req_head.setValue("keep-alive", "false");
|
||||
QNetworkRequest req(url);
|
||||
req.setRawHeader("POST", url.path().toAscii());
|
||||
req.setRawHeader("user-agent", "xml-test");
|
||||
req.setRawHeader("keep-alive", "false");
|
||||
req.setRawHeader("host", url.host().toAscii());
|
||||
|
||||
QByteArray xmlrpc("<methodCall>\r\n\
|
||||
<methodName>SFD.GetVersion</methodName>\r\n\
|
||||
<params/>\r\n\
|
||||
</methodCall>");
|
||||
req_head.setContentLength(xmlrpc.size());
|
||||
req_head.setContentType("text/xml");
|
||||
req.setHeader(QNetworkRequest::ContentLengthHeader, xmlrpc.size());
|
||||
req.setHeader(QNetworkRequest::ContentTypeHeader, "text/xml");
|
||||
|
||||
httpClient->request(req_head, xmlrpc);
|
||||
httpClient->post(req, xmlrpc);
|
||||
}
|
||||
|
||||
void requestFinished(int, bool isError)
|
||||
void requestFinished(QNetworkReply *reply)
|
||||
{
|
||||
QVERIFY(!isError);
|
||||
QVERIFY(reply->error() == QNetworkReply::NoError);
|
||||
reply->deleteLater();
|
||||
}
|
||||
|
||||
private slots:
|
||||
@ -165,32 +171,43 @@ private slots:
|
||||
void readyRead()
|
||||
{
|
||||
QTcpSocket *const s = static_cast<QTcpSocket *>(sender());
|
||||
int bodyLength = -1;
|
||||
|
||||
while(s->canReadLine())
|
||||
while (s->bytesAvailable())
|
||||
{
|
||||
const QString line(s->readLine());
|
||||
|
||||
if(line.startsWith("content-length:"))
|
||||
if (line.startsWith("Content-Length:"))
|
||||
bodyLength = line.mid(15).toInt();
|
||||
|
||||
if(line == "\r\n")
|
||||
if (isBody)
|
||||
{
|
||||
body.append(line);
|
||||
bodyBytesRead += line.length();
|
||||
}
|
||||
else if (line == "\r\n")
|
||||
{
|
||||
isBody = true;
|
||||
if (bodyLength == -1)
|
||||
{
|
||||
qFatal("No length was specified in the header.");
|
||||
}
|
||||
|
||||
QDomDocument domDoc;
|
||||
success = domDoc.setContent(s->read(bodyLength));
|
||||
eventLoop.exit();
|
||||
}
|
||||
}
|
||||
|
||||
if (bodyBytesRead == bodyLength)
|
||||
{
|
||||
QDomDocument domDoc;
|
||||
success = domDoc.setContent(body);
|
||||
eventLoop.exit();
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
QByteArray body;
|
||||
int bodyBytesRead, bodyLength;
|
||||
bool isBody;
|
||||
QTcpServer *tcpServer;
|
||||
QHttp* httpClient;
|
||||
QNetworkAccessManager* httpClient;
|
||||
};
|
||||
|
||||
void tst_QXmlInputSource::waitForReadyIODevice() const
|
||||
|
Loading…
Reference in New Issue
Block a user