Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

del_request.js 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // Copyright 2011 Mark Cavage, Inc. All rights reserved.
  2. var assert = require('assert-plus');
  3. var util = require('util');
  4. var LDAPMessage = require('./message');
  5. var Protocol = require('../protocol');
  6. var lassert = require('../assert');
  7. ///--- API
  8. function DeleteRequest(options) {
  9. options = options || {};
  10. assert.object(options);
  11. lassert.optionalStringDN(options.entry);
  12. options.protocolOp = Protocol.LDAP_REQ_DELETE;
  13. LDAPMessage.call(this, options);
  14. this.entry = options.entry || null;
  15. }
  16. util.inherits(DeleteRequest, LDAPMessage);
  17. Object.defineProperties(DeleteRequest.prototype, {
  18. type: {
  19. get: function getType() { return 'DeleteRequest'; },
  20. configurable: false
  21. },
  22. _dn: {
  23. get: function getDN() { return this.entry; },
  24. configurable: false
  25. }
  26. });
  27. DeleteRequest.prototype._parse = function (ber, length) {
  28. assert.ok(ber);
  29. this.entry = ber.buffer.slice(0, length).toString('utf8');
  30. ber._offset += ber.length;
  31. return true;
  32. };
  33. DeleteRequest.prototype._toBer = function (ber) {
  34. assert.ok(ber);
  35. var buf = new Buffer(this.entry.toString());
  36. for (var i = 0; i < buf.length; i++)
  37. ber.writeByte(buf[i]);
  38. return ber;
  39. };
  40. DeleteRequest.prototype._json = function (j) {
  41. assert.ok(j);
  42. j.entry = this.entry;
  43. return j;
  44. };
  45. ///--- Exports
  46. module.exports = DeleteRequest;