2010-05-07 04:47:10 -05:00
|
|
|
/*
|
2010-05-16 16:02:50 -05:00
|
|
|
* Copyright 2009-2010, Andrea Anzani. All rights reserved.
|
|
|
|
* Copyright 2009-2010, Pier Luigi Fiorini. All rights reserved.
|
2010-05-07 04:47:10 -05:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2010-05-16 16:02:50 -05:00
|
|
|
#ifndef _CAYA_PROTOCOL_H
|
|
|
|
#define _CAYA_PROTOCOL_H
|
2010-05-07 04:47:10 -05:00
|
|
|
|
|
|
|
#include <Messenger.h>
|
|
|
|
|
2010-07-10 14:28:29 -05:00
|
|
|
// Caya protocol interface version
|
|
|
|
#define CAYA_VERSION_1_PRE_ALPHA_1 0x00000001
|
|
|
|
#define CAYA_VERSION_1_ALPHA_1 0x00000100
|
|
|
|
|
|
|
|
#define CAYA_VERSION CAYA_VERSION_1_PRE_ALPHA_1
|
|
|
|
|
2010-05-07 04:47:10 -05:00
|
|
|
class CayaProtocolMessengerInterface {
|
2010-05-16 16:02:50 -05:00
|
|
|
public:
|
|
|
|
virtual status_t SendMessage(BMessage* message) = 0;
|
2010-05-07 04:47:10 -05:00
|
|
|
};
|
|
|
|
|
2010-05-16 16:02:50 -05:00
|
|
|
class CayaProtocol {
|
|
|
|
public:
|
2010-07-10 14:28:29 -05:00
|
|
|
//! Messenger
|
2010-05-16 16:02:50 -05:00
|
|
|
virtual status_t Init(CayaProtocolMessengerInterface*) = 0;
|
2010-05-07 04:47:10 -05:00
|
|
|
|
2010-07-10 14:28:29 -05:00
|
|
|
//! Called before unloading from memory
|
2010-05-16 16:02:50 -05:00
|
|
|
virtual status_t Shutdown() = 0;
|
2010-05-07 04:47:10 -05:00
|
|
|
|
2010-07-10 14:28:29 -05:00
|
|
|
//! Process message
|
2010-05-16 16:02:50 -05:00
|
|
|
virtual status_t Process(BMessage*) = 0;
|
2010-05-07 04:47:10 -05:00
|
|
|
|
2010-07-10 14:28:29 -05:00
|
|
|
//! Change settings
|
2010-05-16 16:02:50 -05:00
|
|
|
virtual status_t UpdateSettings(BMessage*) = 0;
|
2010-05-07 04:47:10 -05:00
|
|
|
|
2010-07-10 14:28:29 -05:00
|
|
|
//! Protocol signature
|
2010-05-16 16:02:50 -05:00
|
|
|
virtual const char* Signature() const = 0;
|
2010-07-10 14:28:29 -05:00
|
|
|
|
|
|
|
//! Protocol name
|
2010-05-16 16:02:50 -05:00
|
|
|
virtual const char* FriendlySignature() const = 0;
|
|
|
|
|
2010-07-10 14:28:29 -05:00
|
|
|
//! Preferred encoding of messages
|
2010-05-16 16:02:50 -05:00
|
|
|
virtual uint32 GetEncoding() = 0;
|
2010-05-07 04:47:10 -05:00
|
|
|
|
2010-07-10 14:28:29 -05:00
|
|
|
//! Messenger interface used
|
2010-05-16 16:02:50 -05:00
|
|
|
virtual CayaProtocolMessengerInterface* MessengerInterface() const = 0;
|
2010-07-10 14:28:29 -05:00
|
|
|
|
|
|
|
//! Caya interface version
|
|
|
|
virtual uint32 Version() const = 0;
|
2010-05-16 16:02:50 -05:00
|
|
|
};
|
2010-05-07 04:47:10 -05:00
|
|
|
|
2010-05-16 16:02:50 -05:00
|
|
|
#endif // _CAYA_PROTOCOL_H
|