2014-10-23 10:52:21 -04:00
|
|
|
var ClientConstants = require('../constants/client');
|
|
|
|
var Packet = require('../packets/packet');
|
|
|
|
var Charsets = require('../constants/charsets');
|
|
|
|
|
|
|
|
function SSLRequest(flags)
|
|
|
|
{
|
|
|
|
this.clientFlags = flags | ClientConstants.SSL;
|
|
|
|
}
|
|
|
|
|
|
|
|
SSLRequest.prototype.toPacket = function()
|
|
|
|
{
|
|
|
|
var length = 36;
|
2015-01-28 15:33:44 -05:00
|
|
|
var buffer = new Buffer(length);
|
|
|
|
var packet = new Packet(0, buffer, 0, length);
|
2014-10-23 10:52:21 -04:00
|
|
|
buffer.fill(0);
|
|
|
|
packet.offset = 4;
|
|
|
|
|
|
|
|
packet.writeInt32(this.clientFlags);
|
|
|
|
packet.writeInt32(0); // max packet size. todo: move to config
|
|
|
|
packet.writeInt8(Charsets.UTF8_GENERAL_CI);
|
|
|
|
return packet;
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = SSLRequest;
|