Ticket #1360 (assigned task)

Opened 2 years ago

Last modified 14 months ago

Re-engineer CBuffer

Reported by: erijo Owned by: erijo
Priority: normal Milestone: 2.0.0
Component: licq daemon Version:
Keywords: Cc:

Description (last modified by erijo) (diff)

The CBuffer class (src/buffer.cpp and include/licq_buffer.h) should be rewritten. All Oscar/ICQ related functions should be removed and placed in the ICQ plugin in a CICQBuffer class.

Also the CBuffer uses a static buffer at the moment. The new class should use a dynamicaly sized buffer, that will resize itself when writing to it (operator <<). It has to support the pack/unpack functions for byte-sex conversion, since this is used for ICQ and other protocols most likely.

The idea would be to make it exception-safe and to use an STL structure as the underlying data structure to make it dynamic. Precomputing the size, as it is necessary now, is a major problem and is counter-intuitive for plugins.

Change History

Changed 2 years ago by erijo

  • status changed from new to assigned

Changed 2 years ago by erijo

  • description modified (diff)

Changed 2 years ago by erijo

  • status changed from assigned to closed
  • resolution set to fixed

Changed 2 years ago by erijo

  • status changed from closed to reopened
  • resolution fixed deleted

Reopening this since it's not committed yet.

Changed 2 years ago by erijo

  • status changed from reopened to new

Comments from the talk page in old wiki.

I'm interested in helping out with this task. If nobody objects, I can start with it the coming week.

Before I start I have some questions:

  • Should it be designed as a general buffer, which allows random access to elements, or will the usage be more like a queue where you write to the end and read from the start (FIFO)?
  • Should unit testing be used?
  • Should the buffer be thread safe? (While on the subject, any plans to switch to boost::threads to make licq easier to port?)

--Erik 21:54, 13 May 2006 (JST)


Sure, there are no objections.

  • I guess it can be considered like a FIFO except with ICQ, there is write access that is after the entire buffer has been written. (The encryption hash for the protocol). Other than that the buffer is read only when the data is sent over the socket. For more information about this exception take a look at Encrypt_Client in icqpacket.cpp. Actually, the buffer is only used in icqpacket.cpp. For MSN, it doesn't do anything special.
  • Since this is not built into the core it would be easy to do unit testing. I haven't done any Unit Testing in C++, so perhaps this would be a good place to give it a start.
  • The buffer shouldn't be thread safe. It is written only by one thread, and then read after all writes have been completed.

While on the subject of boost:threads, I have looked into it a little bit, but I haven't confirmed that it really is more portable than pthreads.

--Jon 07:46, 15 May 2006 (JST)

Changed 2 years ago by erijo

  • status changed from new to assigned

Changed 14 months ago by anonymous

Note: See TracTickets for help on using tickets.