2011-08-04 20:32:01 +00:00
|
|
|
// Copyright 2011 Mark Cavage, Inc. All rights reserved.
|
|
|
|
|
|
|
|
var util = require('util');
|
|
|
|
|
|
|
|
var LDAPResult = require('./result');
|
|
|
|
var Protocol = require('../protocol');
|
|
|
|
|
|
|
|
|
2011-11-15 18:49:23 +00:00
|
|
|
|
2011-08-04 20:32:01 +00:00
|
|
|
///--- API
|
|
|
|
|
|
|
|
function CompareResponse(options) {
|
|
|
|
if (options) {
|
|
|
|
if (typeof(options) !== 'object')
|
|
|
|
throw new TypeError('options must be an object');
|
|
|
|
} else {
|
|
|
|
options = {};
|
|
|
|
}
|
|
|
|
|
|
|
|
options.protocolOp = Protocol.LDAP_REP_COMPARE;
|
|
|
|
LDAPResult.call(this, options);
|
|
|
|
}
|
|
|
|
util.inherits(CompareResponse, LDAPResult);
|
|
|
|
module.exports = CompareResponse;
|
2011-08-23 00:16:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
CompareResponse.prototype.end = function(matches) {
|
2011-09-22 00:35:19 +00:00
|
|
|
var status = 0x06;
|
|
|
|
if (typeof(matches) === 'boolean') {
|
2011-08-23 00:16:36 +00:00
|
|
|
if (!matches)
|
|
|
|
status = 0x05; // Compare false
|
2011-09-22 00:35:19 +00:00
|
|
|
} else {
|
|
|
|
status = matches;
|
2011-08-23 00:16:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return LDAPResult.prototype.end.call(this, status);
|
|
|
|
};
|