pike.git / lib / modules / SSL.pmod / Buffer.pike

version» Context lines:

pike.git/lib/modules/SSL.pmod/Buffer.pike:4:   //! String buffer with the possibility to read and write data   //! as they would be formatted in structs.      inherit Stdio.Buffer;      this_program add_hstring(string(8bit)|Stdio.Buffer str, int sz)   {    return [object(this_program)]::add_hstring(str,sz);   }    -  +    //! Create a new buffer, optionally initialized with the   //! value @[s].   void create(void|string(0..255) s)   {    if( s && strlen(s) )    ::create(s);    else    ::create();    set_error_mode(.BufferError);   }    - //! Trims the buffer to only contain the data after the - //! read pointer and returns the contents of the buffer. - string(0..255) contents() - { -  return (string(8bit))this; - } -  +    //! Adds the data @[s] verbatim to the end of the buffer.   this_program add_data(string(0..255) s)   {    return [object(this_program)]add(s);   }    - //! Return all the data in the buffer and empties it. - string(0..255) pop_data() - { -  return read(); - } -  +    //! Appends an unsigned integer in network order to the buffer.   //!   //! @param i   //! Unsigned integer to append.   //! @param len   //! Length of integer in bytes.   this_program put_uint(int i, int(0..) len)   {    return [object(this_program)]add_int(i,len);   }