Introduction

KIM introduction

There are four main parts of the KIM backend interface. The Protocol classes, The Network classes, the Contact class and the XML classes.

1. Writing a client

The normal way of using a protocol is by subclassing the protocol implementations. For example, if you wish to write a kit client, you would declare a class like this:

class myKitProtocol: public KitProtocol
{
myKitProtocol(XMLNode &configuration,Network *net):
  KitProtocol(n,net);

void c_loggedIn(string proto);
// any other c_ functions you are interested in (c_ is short for callback_)
}

the inheritance diagram for subclassing KitProtocol will be Protocol -> KitProtocol -> myKitProtocol. The parameters to the constructor are first an XMLNode where all the configuration information is stored (server ip, port, username and password) are specified here.

1.1. Network interfacing

Since the protocol code is completely network agnostic you need to create a class to do the acctual network interfacing. Network is another interface class that you need to subclass and implement for your client. This gives you full control over how to do event handling in your client. Also see the documentation for the Network class.

2. Writing a new protocol

Writing a new protocol is pretty simple, subclass Protocol and implement the action functions to perform the actions needed.

handleData() is called when there is data available, so once that function is called, parse it in a convenient way.

All network interfacing should be done through the m_network member - please be careful to keep the protocol code free of system dependancies.

When you want to send an event to the client, call the event* functions defined in Protocol.h. If you call them they'll automatically make sure the protocol can be used both with the protocol manager and with the callback functions (c_*) directly.

Alphabetic index Hierarchy of classes



This page was generated with the help of DOC++.