Added two methods for setting and getting space in queues.

* It is possible to get free space in incoming and outgoing queue.
* It is possible to get max size of incoming and outgoing queue.
* It is possible to set max size of incoming and outgoing queue.
* Added some comments and refactoring.