1600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang/* 2600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* Conditions Of Use 3600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* 4600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* This software was developed by employees of the National Institute of 5600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* Standards and Technology (NIST), an agency of the Federal Government. 6600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* Pursuant to title 15 Untied States Code Section 105, works of NIST 7600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* employees are not subject to copyright protection in the United States 8600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* and are considered to be in the public domain. As a result, a formal 9600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* license is not needed to use the software. 10600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* 11600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* This software is provided by NIST as a service and is expressly 12600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED 13600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF 14600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT 15600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* AND DATA ACCURACY. NIST does not warrant or make any representations 16600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* regarding the use of the software or the results thereof, including but 17600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* not limited to the correctness, accuracy, reliability or usefulness of 18600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* the software. 19600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* 20600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* Permission to use this software is contingent upon your acceptance 21600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* of the terms of this agreement 22600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* 23600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* . 24600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang* 25600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang*/ 26600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wangpackage gov.nist.javax.sip.header; 27600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wangimport gov.nist.core.*; 28600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wangimport gov.nist.javax.sip.header.ims.*; 29600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 30600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wangimport java.util.Hashtable; 31600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 32600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang/** 33600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * A mapping class that returns the SIPHeader for a given header name. 34600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * Add new classes to this map if you are implementing new header types if 35600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * you want some of the introspection based methods to work. 36600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * @version 1.2 $Revision: 1.11 $ $Date: 2009/07/17 18:57:32 $ 37600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * @since 1.1 38600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang */ 39600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wangpublic class NameMap implements SIPHeaderNames, PackageNames { 40600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang static Hashtable nameMap; 41600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang static { 42600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang initializeNameMap(); 43600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang } 44600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 45600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang protected static void putNameMap(String headerName, String className) { 46600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang nameMap.put( 47600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang headerName.toLowerCase(), 48600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang className); 49600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang } 50600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 51600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang public static Class getClassFromName(String headerName) { 52600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang String className = (String) nameMap.get(headerName.toLowerCase()); 53600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang if (className == null) 54600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang return null; 55600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang else { 56600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang try { 57600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang return Class.forName(className); 58600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang } catch (ClassNotFoundException ex) { 59600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang return null; 60600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang } 61600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang } 62600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang } 63600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 64600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang /** add an extension header to this map. 65600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang *@param headerName is the extension header name. 66600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang *@param className is the fully qualified class name that implements 67600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * the header (does not have to belong to the nist-sip package). 68600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang * Use this if you want to use the introspection-based methods. 69600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang */ 70600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 71600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang public static void addExtensionHeader( 72600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang String headerName, 73600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang String className) { 74600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang nameMap.put(headerName.toLowerCase(), className); 75600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang } 76600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 77600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang private static void initializeNameMap() { 78600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang nameMap = new Hashtable(); 79600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(MinExpires.NAME, MinExpires.class.getName()); // 1 80600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 81600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(ErrorInfo.NAME, ErrorInfo.class.getName()); // 2 82600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 83600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(MimeVersion.NAME, MimeVersion.class.getName()); // 3 84600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 85600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(InReplyTo.NAME, InReplyTo.class.getName()); // 4 86600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 87600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(Allow.NAME, Allow.class.getName()); // 5 88600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 89600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(ContentLanguage.NAME, ContentLanguage.class.getName()); // 6 90600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 91600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(CALL_INFO, CallInfo.class.getName()); //7 92600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 93600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(CSEQ, CSeq.class.getName()); //8 94600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 95600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(ALERT_INFO, AlertInfo.class.getName()); //9 96600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 97600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(ACCEPT_ENCODING, AcceptEncoding.class.getName()); //10 98600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 99600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(ACCEPT, Accept.class.getName()); //11 100600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 101600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(ACCEPT_LANGUAGE, AcceptLanguage.class.getName()); //12 102600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 103600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(RECORD_ROUTE, RecordRoute.class.getName()); //13 104600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 105600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(TIMESTAMP, TimeStamp.class.getName()); //14 106600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 107600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(TO, To.class.getName()); //15 108600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 109600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(VIA, Via.class.getName()); //16 110600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 111600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(FROM, From.class.getName()); //17 112600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 113600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(CALL_ID, CallID.class.getName()); //18 114600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 115600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(AUTHORIZATION, Authorization.class.getName()); //19 116600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 117600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(PROXY_AUTHENTICATE, ProxyAuthenticate.class.getName()); //20 118600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 119600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(SERVER, Server.class.getName()); //21 120600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 121600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(UNSUPPORTED, Unsupported.class.getName()); //22 122600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 123600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(RETRY_AFTER, RetryAfter.class.getName()); //23 124600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 125600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(CONTENT_TYPE, ContentType.class.getName()); //24 126600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 127600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(CONTENT_ENCODING, ContentEncoding.class.getName()); //25 128600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 129600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(CONTENT_LENGTH, ContentLength.class.getName()); //26 130600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 131600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(ROUTE, Route.class.getName()); //27 132600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 133600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(CONTACT, Contact.class.getName()); //28 134600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 135600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(WWW_AUTHENTICATE, WWWAuthenticate.class.getName()); //29 136600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 137600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(MAX_FORWARDS, MaxForwards.class.getName()); //30 138600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 139600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(ORGANIZATION, Organization.class.getName()); //31 140600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 141600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(PROXY_AUTHORIZATION, ProxyAuthorization.class.getName()); //32 142600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 143600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(PROXY_REQUIRE, ProxyRequire.class.getName()); //33 144600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 145600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(REQUIRE, Require.class.getName()); //34 146600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 147600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(CONTENT_DISPOSITION, ContentDisposition.class.getName()); //35 148600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 149600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(SUBJECT, Subject.class.getName()); //36 150600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 151600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(USER_AGENT, UserAgent.class.getName()); //37 152600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 153600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(WARNING, Warning.class.getName()); //38 154600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 155600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(PRIORITY, Priority.class.getName()); //39 156600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 157600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(DATE, SIPDateHeader.class.getName()); //40 158600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 159600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(EXPIRES, Expires.class.getName()); //41 160600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 161600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(SUPPORTED, Supported.class.getName()); //42 162600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 163600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(REPLY_TO, ReplyTo.class.getName()); // 43 164600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 165600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(SUBSCRIPTION_STATE, SubscriptionState.class.getName()); //44 166600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 167600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(EVENT, Event.class.getName()); //45 168600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 169600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(ALLOW_EVENTS, AllowEvents.class.getName()); //46 170600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 171600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 172600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang // pmusgrave - extensions 173600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(REFERRED_BY, "ReferredBy"); 174600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(SESSION_EXPIRES, "SessionExpires"); 175600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(MIN_SE, "MinSE"); 176600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(REPLACES, "Replaces"); 177600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang // jean deruelle 178600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(JOIN, "Join"); 179600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 180600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 181600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang // IMS Specific headers. 182600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 183600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(PAccessNetworkInfoHeader.NAME, PAccessNetworkInfo.class.getName()); 184600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 185600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(PAssertedIdentityHeader.NAME, PAssertedIdentity.class.getName()); 186600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 187600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(PAssociatedURIHeader.NAME, PAssociatedURI.class.getName()); 188600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 189600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(PCalledPartyIDHeader.NAME, PCalledPartyID.class.getName()); 190600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 191600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(PChargingFunctionAddressesHeader.NAME, PChargingFunctionAddresses.class.getName()); 192600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 193600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(PChargingVectorHeader.NAME,PChargingVector.class.getName()); 194600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 195600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(PMediaAuthorizationHeader.NAME,PMediaAuthorization.class.getName()); 196600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 197600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(Path.NAME, Path.class.getName()); 198600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 199600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(PPreferredIdentity.NAME, PPreferredIdentity.class.getName()); 200600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 201600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(Privacy.NAME,Privacy.class.getName()); 202600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 203600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(ServiceRoute.NAME, ServiceRoute.class.getName()); 204600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 205600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang putNameMap(PVisitedNetworkID.NAME, PVisitedNetworkID.class.getName()); 206600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 207600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 208600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang 209600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang } 210600c7a4bbc7348167293eac928192e695b4ad5baChung-yih Wang} 211