code: function(c) {
      var rval = 0;
  
      // get input buffer and its length
      var b = c.input;
      var len = b.length();
  
      // need at least 5 bytes to initialize a record
      if(len < 5) {
        rval = 5 - len;
      } else {
        // enough bytes for header
        // initialize record
        c.record = {
          type: b.getByte(),
          version: {
            major: b.getByte(),
            minor: b.getByte()
          },
          length: b.getInt16(),
          fragment: forge.util.createBuffer(),
          ready: false
        };
  
        // check record version
        var compatibleVersion = (c.record.version.major === c.version.major);
        if(compatibleVersion && c.session && c.session.version) {
          // session version already set, require same minor version
          compatibleVersion = (c.record.version.minor === c.version.minor);
        }
        if(!compatibleVersion) {
          c.error(c, {
            message: 'Incompatible TLS version.',
            send: true,
            alert: {
              level: tls.Alert.Level.fatal,
              description: tls.Alert.Description.protocol_version
            }
          });
        }
      }
  
      return rval;
    }
docs: Reads the record header and initializes the next record on the given
  connection.
  
  @param c the TLS connection with the next record.
  
  @return 0 if the input data could be processed, otherwise the
  number of bytes required for data to be processed.