Changeset 5284 for source/ariba/communication/messages
- Timestamp:
- Jul 24, 2009, 3:23:11 PM (15 years ago)
- Location:
- source/ariba/communication/messages
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
source/ariba/communication/messages/AribaBaseMsg.cpp
r4582 r5284 44 44 vsznDefault(AribaBaseMsg); 45 45 46 AribaBaseMsg::AribaBaseMsg( 47 const Address* address, 48 LINK_STATE _state, 49 const LinkID& _localLink, 50 const LinkID& _remoteLink ) 51 : state( (uint8_t)_state ), 52 localLink( _localLink ), 53 remoteLink( _remoteLink ){ 54 55 Message::setDestinationAddress( address ); 46 AribaBaseMsg::AribaBaseMsg( type_ _type, 47 const LinkID& localLink, const LinkID& remoteLink ) : 48 type((uint8_t)_type), 49 localLink(localLink),remoteLink(remoteLink) { 56 50 } 57 51 58 AribaBaseMsg::~AribaBaseMsg() {52 AribaBaseMsg::~AribaBaseMsg() { 59 53 } 60 54 61 const AribaBaseMsg::LINK_STATE AribaBaseMsg::getType(){ 62 return (LINK_STATE)state; 63 } 64 65 const LinkID& AribaBaseMsg::getLocalLink(){ 66 return localLink; 67 } 68 69 const LinkID& AribaBaseMsg::getRemoteLink(){ 70 return remoteLink; 71 } 72 73 const string AribaBaseMsg::getTypeString(){ 74 75 switch( getType() ){ 76 case LINK_STATE_DATA: return "LINK_STATE_DATA"; 77 case LINK_STATE_OPEN_REQUEST: return "LINK_STATE_OPEN_REQUEST"; 78 case LINK_STATE_OPEN_REPLY: return "LINK_STATE_OPEN_REPLY"; 79 case LINK_STATE_CLOSE_REQUEST: return "LINK_STATE_CLOSE_REQUEST"; 80 case LINK_STATE_UPDATE: return "LINK_STATE_UPDATE"; 81 default: "unknown"; 55 const string AribaBaseMsg::getTypeString() const { 56 switch (getType()) { 57 case typeData: 58 return "typeData"; 59 case typeLinkRequest: 60 return "typeLinkRequest"; 61 case typeLinkReply: 62 return "typeLinkReply"; 63 case typeLinkClose: 64 return "typeLinkClose"; 65 case typeLinkUpdate: 66 return "typeLinkUpdate"; 67 default: 68 "unknown"; 82 69 } 83 84 70 return "unknown"; 85 71 } -
source/ariba/communication/messages/AribaBaseMsg.h
r4625 r5284 48 48 #include "ariba/utility/types/ServiceID.h" 49 49 50 #include "../EndpointDescriptor.h" 51 50 52 using std::string; 51 53 using ariba::utility::Address; … … 62 64 VSERIALIZEABLE; 63 65 public: 66 enum type_ { 67 typeData = 0, 68 typeLinkRequest = 1, 69 typeLinkReply = 2, 70 typeLinkClose = 3, 71 typeLinkUpdate = 4 72 }; 64 73 65 typedef enum _LINK_STATE { 66 LINK_STATE_DATA = 0, 67 LINK_STATE_OPEN_REQUEST = 1, 68 LINK_STATE_OPEN_REPLY = 2, 69 LINK_STATE_CLOSE_REQUEST = 3, // there is no close reply. send request and local link is closed 70 LINK_STATE_UPDATE = 4, 71 } LINK_STATE; 72 73 AribaBaseMsg( 74 const Address* address = NULL, 75 LINK_STATE _state = LINK_STATE_DATA, 76 const LinkID& _localLink = LinkID::UNSPECIFIED, 77 const LinkID& _remoteLink = LinkID::UNSPECIFIED ); 74 AribaBaseMsg( type_ type = typeData, 75 const LinkID& localLink = LinkID::UNSPECIFIED, 76 const LinkID& remoteLink = LinkID::UNSPECIFIED ); 78 77 79 78 virtual ~AribaBaseMsg(); 80 79 81 const LINK_STATE getType(); 82 const string getTypeString(); 83 const LinkID& getLocalLink(); 84 const LinkID& getRemoteLink(); 80 const string getTypeString() const; 81 82 const type_ getType() const { 83 return (type_)type; 84 } 85 86 const LinkID& getLocalLink() const { 87 return localLink; 88 } 89 90 const LinkID& getRemoteLink() const { 91 return remoteLink; 92 } 93 94 EndpointDescriptor& getLocalDescriptor() { 95 return localDescriptor; 96 } 97 98 EndpointDescriptor& getRemoteDescriptor() { 99 return remoteDescriptor; 100 } 85 101 86 102 private: 87 uint8_t state; // the link message type 103 uint8_t type; // the link message type 104 105 // remote and local link ids 88 106 LinkID localLink; // the local link id 89 107 LinkID remoteLink; // the remote link id 90 108 109 // remote and local endpoint descriptors 110 EndpointDescriptor localDescriptor; 111 EndpointDescriptor remoteDescriptor; 91 112 }; 92 113 … … 94 115 95 116 sznBeginDefault( ariba::communication::AribaBaseMsg, X ) { 96 X && state && &localLink && &remoteLink && Payload(); 117 X && type && &localLink && &remoteLink; 118 if (type == typeLinkReply || type == typeLinkRequest) 119 X && localDescriptor && remoteDescriptor; 120 X && Payload(); 97 121 } sznEnd(); 98 122
Note:
See TracChangeset
for help on using the changeset viewer.