Esempio n. 1
0
Binlog.prototype.determinePacket = function(byte, parser) {
    /**
     * Peak into the buffer to locate the packet type.
     */
    var type = parser._buffer[parser._offset + 5];

    if(byte === 0x00) {
      /**
       * Check to see if we have a packet handler
       */
      if(type in this._parsers){
        console.log("Handling event: ", this._parsers[type].name);
        /**
         * Assign the meta data to the parser
         * @type {[type]}
         */
        parser._checksums = this._checksums;

        /**
         * Add a reference to the table map to the parser
         * so each packet can access them.
         */
        parser._maps = this._maps;

        /**
         * Return the Packet Class
         */
        return this._parsers[type];
      }
    }

    // Let the default handler handle it.
    return Sequences.Sequence.determinePacket(byte);
};