Class: Mysql::Protocol::AuthenticationPacket

Inherits:
TxPacket
  • Object
show all
Defined in:
lib/mysql/protocol.rb

Overview

Authentication packet

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ AuthenticationPacket

Returns a new instance of AuthenticationPacket.



370
371
372
# File 'lib/mysql/protocol.rb', line 370

def initialize(*args)
  @client_flags, @max_packet_size, @charset_number, @username, @scrambled_password, @databasename = args
end

Instance Attribute Details

#charset_numberObject

Returns the value of attribute charset_number.



368
369
370
# File 'lib/mysql/protocol.rb', line 368

def charset_number
  @charset_number
end

#client_flagsObject

Returns the value of attribute client_flags.



368
369
370
# File 'lib/mysql/protocol.rb', line 368

def client_flags
  @client_flags
end

#databasenameObject

Returns the value of attribute databasename.



368
369
370
# File 'lib/mysql/protocol.rb', line 368

def databasename
  @databasename
end

#max_packet_sizeObject

Returns the value of attribute max_packet_size.



368
369
370
# File 'lib/mysql/protocol.rb', line 368

def max_packet_size
  @max_packet_size
end

#scrambled_passwordObject

Returns the value of attribute scrambled_password.



368
369
370
# File 'lib/mysql/protocol.rb', line 368

def scrambled_password
  @scrambled_password
end

#usernameObject

Returns the value of attribute username.



368
369
370
# File 'lib/mysql/protocol.rb', line 368

def username
  @username
end

Instance Method Details

#serializeObject



374
375
376
377
378
379
380
381
382
383
384
# File 'lib/mysql/protocol.rb', line 374

def serialize
  [
    client_flags,
    max_packet_size,
    Protocol.lcb(charset_number),
    "",                   # always 0x00 * 23
    username,
    Protocol.lcs(scrambled_password),
    databasename
  ].pack("VVa*a23Z*A*Z*")
end