////////////////////////////////////////////////////////////////// // // rasinfo.h // // RAS type traits // Define template classes that associate RAS tags and types // // Copyright (c) Citron Network Inc. 2003 // // This work is published under the GNU Public License (GPL) // see file COPYING for details. // We also explicitely grant the right to link this code // with the OpenH323 library. // // initial author: Chih-Wei Huang // initial version: 05/28/2003 // ////////////////////////////////////////////////////////////////// #ifndef RASINFO_H #define RASINFO_H "@(#) $Id: rasinfo.h,v 1.3 2006/04/14 13:56:19 willamowius Exp $" #ifndef __STL_TEMPLATE_NULL // explicit specialization #define __STL_TEMPLATE_NULL template<> #endif #ifndef __explicit_specialization #define __explicit_specialization __STL_TEMPLATE_NULL #endif // compile time assertion template struct CTAssert; template<> struct CTAssert {}; // define a type for an RAS tag template struct RasTag { operator unsigned() const { return I; } }; // the template classes map RAS tags to its corresponding RAS types template struct RasType; template<> struct RasType { typedef H225_GatekeeperRequest Type; }; template<> struct RasType { typedef H225_GatekeeperConfirm Type; }; template<> struct RasType { typedef H225_GatekeeperReject Type; }; template<> struct RasType { typedef H225_RegistrationRequest Type; }; template<> struct RasType { typedef H225_RegistrationConfirm Type; }; template<> struct RasType { typedef H225_RegistrationReject Type; }; template<> struct RasType { typedef H225_UnregistrationRequest Type; }; template<> struct RasType { typedef H225_UnregistrationConfirm Type; }; template<> struct RasType { typedef H225_UnregistrationReject Type; }; template<> struct RasType { typedef H225_AdmissionRequest Type; }; template<> struct RasType { typedef H225_AdmissionConfirm Type; }; template<> struct RasType { typedef H225_AdmissionReject Type; }; template<> struct RasType { typedef H225_BandwidthRequest Type; }; template<> struct RasType { typedef H225_BandwidthConfirm Type; }; template<> struct RasType { typedef H225_BandwidthReject Type; }; template<> struct RasType { typedef H225_DisengageRequest Type; }; template<> struct RasType { typedef H225_DisengageConfirm Type; }; template<> struct RasType { typedef H225_DisengageReject Type; }; template<> struct RasType { typedef H225_LocationRequest Type; }; template<> struct RasType { typedef H225_LocationConfirm Type; }; template<> struct RasType { typedef H225_LocationReject Type; }; template<> struct RasType { typedef H225_InfoRequest Type; }; template<> struct RasType { typedef H225_InfoRequestResponse Type; }; template<> struct RasType { typedef H225_NonStandardMessage Type; }; template<> struct RasType { typedef H225_UnknownMessageResponse Type; }; template<> struct RasType { typedef H225_RequestInProgress Type; }; template<> struct RasType { typedef H225_ResourcesAvailableIndicate Type; }; template<> struct RasType { typedef H225_ResourcesAvailableConfirm Type; }; template<> struct RasType { typedef H225_InfoRequestAck Type; }; template<> struct RasType { typedef H225_InfoRequestNak Type; }; template<> struct RasType { typedef H225_ServiceControlIndication Type; }; template<> struct RasType { typedef H225_ServiceControlResponse Type; }; // associate a tag and its type template struct TagInfo { typedef RasTag Tag; typedef typename RasType::Type Type; enum { tag = I, // there are just 32 types of RAS, lucky! flag = (1 << I) }; }; // a dirty trick, but works :p template struct RequestInfo : public TagInfo { typedef RasTag ConfirmTag; typedef RasTag RejectTag; typedef typename RasType::Type ConfirmType; typedef typename RasType::Type RejectType; }; template struct ConfirmInfo : public TagInfo { typedef RasTag RequestTag; typedef typename RasType::Type RequestType; }; template struct RejectInfo : public TagInfo { typedef RasTag RequestTag; typedef typename RasType::Type RequestType; }; // define an RAS request and all its associated types template struct RasInfo; // RAS request template<> struct RasInfo : public RequestInfo {}; template<> struct RasInfo : public RequestInfo {}; template<> struct RasInfo : public RequestInfo {}; template<> struct RasInfo : public RequestInfo {}; template<> struct RasInfo : public RequestInfo {}; template<> struct RasInfo : public RequestInfo {}; template<> struct RasInfo : public RequestInfo {}; // RAS confirm template<> struct RasInfo : public ConfirmInfo {}; template<> struct RasInfo : public ConfirmInfo {}; template<> struct RasInfo : public ConfirmInfo {}; template<> struct RasInfo : public ConfirmInfo {}; template<> struct RasInfo : public ConfirmInfo {}; template<> struct RasInfo : public ConfirmInfo {}; template<> struct RasInfo : public ConfirmInfo {}; // RAS reject template<> struct RasInfo : public RejectInfo {}; template<> struct RasInfo : public RejectInfo {}; template<> struct RasInfo : public RejectInfo {}; template<> struct RasInfo : public RejectInfo {}; template<> struct RasInfo : public RejectInfo {}; template<> struct RasInfo : public RejectInfo {}; template<> struct RasInfo : public RejectInfo {}; // others template<> struct RasInfo : public TagInfo {}; template<> struct RasInfo : public TagInfo { typedef RasTag ConfirmTag; typedef RasTag RejectTag; typedef RasType::Type ConfirmType; typedef RasType::Type RejectType; }; template<> struct RasInfo : public TagInfo {}; template<> struct RasInfo : public TagInfo {}; template<> struct RasInfo : public TagInfo {}; template<> struct RasInfo : public TagInfo { typedef RasTag ConfirmTag; typedef RasType::Type ConfirmType; }; template<> struct RasInfo : public TagInfo {}; template<> struct RasInfo : public TagInfo {}; template<> struct RasInfo : public TagInfo {}; template<> struct RasInfo : public TagInfo {}; template<> struct RasInfo : public TagInfo {}; #endif // RASINFO_H