RoapMessageHandler.h revision 9066cfe9886ac131c34d59ed0e2d287b0e3c0087
1/* 2 * Copyright (C) 2007 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16#ifndef _ROAPMESSAGEHADLER_ 17#define _ROAPMESSAGEHADLER_ 18 19#include <Drm2CommonTypes.h> 20#include <util/xml/XMLDocumentImpl.h> 21 22class RoapMessageHandler 23{ 24public: 25 /** 26 * define all the client message types. 27 */ 28 enum msgType {DeviceHello=1,RegistrationRequest,RORequest}; 29 30 /** 31 * Constructor for DrmManager,used to open local dcf file. 32 * @param type the message type. 33 */ 34 RoapMessageHandler(); 35 36 /** 37 * Create one specified client message based on message template xml file. 38 * @param type the message type. 39 * @return the pointer of the document object of the message if successful,otherwise 40 * return NULL. 41 */ 42 XMLDocumentImpl* createClientMsg(msgType type); 43 44 /** 45 * Handle received message from RI. 46 * @return true if successful, otherwise return false. 47 */ 48 bool handlePeerMsg(); 49 50 /** 51 * Send the client message to RI 52 */ 53 int16_t send(); 54 55 /** 56 * Receive message from RI and parse it 57 * @return the pointer of the parsed document. 58 */ 59 XMLDocumentImpl* receive(); 60 61PROTECTED: 62 XMLDocumentImpl * mDoc; 63PRIVATE: 64 int16_t mMsgType; 65}; 66#endif //_ROAPMESSAGEHADLER_ 67