?? sipheader.java
字號:
/* * This file was derived from libdissipate, an open source SIP library. The original file * was modified on 1/23/2001. Please see * http://www.div8.net/dissipate for more information. * * Copyright (c) 2000 Billy Biggs <bbiggs@div8.net> * * * This library is free software; you can redistribute it and/or modify it * under the terms of the GNU Library General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public * License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, * MA 02111-1307, USA. * *//** * class SipHeader * * This code has been generated using C2J++ * C2J++ is based on Chris Laffra's C2J (laffra@watson.ibm.com) * Read general disclaimer distributed with C2J++ before using this code * For information about C2J++, send mail to Ilya_Tilevich@ibi.com */package org.mitre.jsip;public class SipHeader{ public static final int Accept = 0; public static final int Accept_Encoding = 1; public static final int Accept_Language = 2; public static final int Allow = 3; public static final int Also = 4; public static final int Authorization = 5; public static final int Call_ID = 6; public static final int Contact = 7; public static final int Content_Encoding = 8; public static final int Content_Length = 9; public static final int Content_Type = 10; public static final int CSeq = 11; public static final int Date = 12; public static final int Encryption = 13; public static final int Expires = 14; public static final int From = 15; public static final int Hide = 16; public static final int Max_Forwards = 17; public static final int Organization = 18; public static final int Proxy_Authenticate = 19; public static final int Proxy_Authorization = 20; public static final int Proxy_Require = 21; public static final int Priority = 22; public static final int Require = 23; public static final int Retry_After = 24; public static final int Response_Key = 25; public static final int Record_Route = 26; public static final int Route = 27; public static final int Server = 28; public static final int Subject = 29; public static final int Timestamp = 30; public static final int To = 31; public static final int Unsupported = 32; public static final int User_Agent = 33; public static final int Via = 34; public static final int Warning = 35; public static final int WWW_Authenticate = 36; public static final int BadHeader = 37; int id; String data; /** * SipHeader * @param newid * @param newdata */ public SipHeader(int newid, String newdata) { id = newid; data = newdata; } public static String getHeaderString(int id) { return getHeaderString(id, false); } /** * getHeaderString * @param id * @param shortform * @return String */ public static String getHeaderString(int id, boolean shortform) { if ( shortform ) { switch ( id ) { case Accept: return "Accept"; case Accept_Encoding: return "Accept-Encoding"; case Accept_Language: return "Accept-Language"; case Allow: return "Allow"; case Also: return "Also"; case Authorization: return "Authorization"; case Call_ID: return "i"; case Contact: return "m"; case Content_Encoding: return "e"; case Content_Length: return "l"; case Content_Type: return "c"; case CSeq: return "CSeq"; case Date: return "Date"; case Encryption: return "Encryption"; case Expires: return "Expires"; case From: return "f"; case Hide: return "Hide"; case Max_Forwards: return "Max-Forwards"; case Organization: return "Organization"; case Proxy_Authenticate: return "Proxy-Authenticate"; case Proxy_Authorization: return "Proxy-Authorization"; case Proxy_Require: return "Proxy-Require"; case Priority: return "Priority"; case Require: return "Require"; case Retry_After: return "Retry-After"; case Response_Key: return "Response-Key"; case Record_Route: return "Record-Route"; case Route: return "Route"; case Server: return "Server"; case Subject: return "s"; case Timestamp: return "Timestamp"; case To: return "t"; case Unsupported: return "Unsupported"; case User_Agent: return "User-Agent"; case Via: return "v"; case Warning: return "Warning"; case WWW_Authenticate: return "WWW-Authenticate"; case BadHeader: return "BadHeader"; } } else { switch ( id ) { case Accept: return "Accept"; case Accept_Encoding: return "Accept-Encoding"; case Accept_Language: return "Accept-Language"; case Allow: return "Allow"; case Also: return "Also"; case Authorization: return "Authorization"; case Call_ID: return "Call-ID"; case Contact: return "Contact"; case Content_Encoding: return "Content-Encoding"; case Content_Length: return "Content-Length"; case Content_Type: return "Content-Type"; case CSeq: return "CSeq"; case Date: return "Date"; case Encryption: return "Encryption"; case Expires: return "Expires"; case From: return "From"; case Hide: return "Hide"; case Max_Forwards: return "Max-Forwards"; case Organization: return "Organization"; case Proxy_Authenticate: return "Proxy-Authenticate"; case Proxy_Authorization: return "Proxy-Authorization"; case Proxy_Require: return "Proxy-Require"; case Priority: return "Priority"; case Require: return "Require"; case Retry_After: return "Retry-After"; case Response_Key: return "Response-Key"; case Record_Route: return "Record-Route"; case Route: return "Route"; case Server: return "Server"; case Subject: return "Subject"; case Timestamp: return "Timestamp"; case To: return "To"; case Unsupported: return "Unsupported"; case User_Agent: return "User-Agent"; case Via: return "Via"; case Warning: return "Warning"; case WWW_Authenticate: return "WWW-Authenticate"; case BadHeader: return "BadHeader"; } } return null; } /** * matchHeader * @param h * @return SipHeaderId */ public static int matchHeader(String h) { String u = h.toUpperCase(); // Check short forms first if ( u.compareTo( getHeaderString( Via, true ).toUpperCase() ) == 0 ) { return Via; } if ( u.compareTo( getHeaderString( Content_Type, true ).toUpperCase() ) == 0 ) { return Content_Type; } if ( u.compareTo( getHeaderString( Content_Encoding, true ).toUpperCase() ) == 0 ) { return Content_Encoding; } if ( u.compareTo( getHeaderString( From, true ).toUpperCase() ) == 0 ) { return From; } if ( u.compareTo( getHeaderString( Call_ID, true ).toUpperCase() ) == 0 ) { return Call_ID; } if ( u.compareTo( getHeaderString( Contact, true ).toUpperCase() ) == 0 ) { return Contact; } if ( u.compareTo( getHeaderString( Content_Length, true ).toUpperCase() ) == 0 ) { return Content_Length; } if ( u.compareTo( getHeaderString( Subject, true ).toUpperCase() ) == 0 ) { return Subject; } if ( u.compareTo( getHeaderString( To, true ).toUpperCase() ) == 0 ) { return To; } if ( u.compareTo( getHeaderString( Accept ).toUpperCase() ) == 0 ) { return Accept; } if ( u.compareTo( getHeaderString( Accept_Encoding ).toUpperCase() ) == 0 ) { return Accept_Encoding; } if ( u.compareTo( getHeaderString( Accept_Language ).toUpperCase() ) == 0 ) { return Accept_Language; } if ( u.compareTo( getHeaderString( Allow ).toUpperCase() ) == 0 ) { return Allow; } if ( u.compareTo( getHeaderString( Also ).toUpperCase() ) == 0 ) { return Also; } if ( u.compareTo( getHeaderString( Authorization ).toUpperCase() ) == 0 ) { return Authorization; } if ( u.compareTo( getHeaderString( Call_ID ).toUpperCase() ) == 0 ) { return Call_ID; } if ( u.compareTo( getHeaderString( Contact ).toUpperCase() ) == 0 ) { return Contact; } if ( u.compareTo( getHeaderString( Content_Encoding ).toUpperCase() ) == 0 ) { return Content_Encoding; } if ( u.compareTo( getHeaderString( Content_Length ).toUpperCase() ) == 0 ) { return Content_Length; } if ( u.compareTo( getHeaderString( Content_Type, true ).toUpperCase() ) == 0 ) { return Content_Type; } if ( u.compareTo( getHeaderString( CSeq ).toUpperCase() ) == 0 ) { return CSeq; } if ( u.compareTo( getHeaderString( Date ).toUpperCase() ) == 0 ) { return Date; } if ( u.compareTo( getHeaderString( Encryption ).toUpperCase() ) == 0 ) { return Encryption; } if ( u.compareTo( getHeaderString( Expires ).toUpperCase() ) == 0 ) { return Expires; } if ( u.compareTo( getHeaderString( From ).toUpperCase() ) == 0 ) { return From; } if ( u.compareTo( getHeaderString( Hide ).toUpperCase() ) == 0 ) { return Hide; } if ( u.compareTo( getHeaderString( Max_Forwards ).toUpperCase() ) == 0 ) { return Max_Forwards; } if ( u.compareTo( getHeaderString( Organization ).toUpperCase() ) == 0 ) { return Organization; } if ( u.compareTo( getHeaderString( Proxy_Authenticate ).toUpperCase() ) == 0 ) { return Proxy_Authenticate; } if ( u.compareTo( getHeaderString( Proxy_Authorization ).toUpperCase() ) == 0 ) { return Proxy_Authorization; } if ( u.compareTo( getHeaderString( Proxy_Require ).toUpperCase() ) == 0 ) { return Proxy_Require; } if ( u.compareTo( getHeaderString( Priority ).toUpperCase() ) == 0 ) { return Priority; } if ( u.compareTo( getHeaderString( Require ).toUpperCase() ) == 0 ) { return Require; } if ( u.compareTo( getHeaderString( Retry_After ).toUpperCase() ) == 0 ) { return Retry_After; } if ( u.compareTo( getHeaderString( Response_Key ).toUpperCase() ) == 0 ) { return Response_Key; } if ( u.compareTo( getHeaderString( Record_Route ).toUpperCase() ) == 0 ) { return Record_Route; } if ( u.compareTo( getHeaderString( Route ).toUpperCase() ) == 0 ) { return Route; } if ( u.compareTo( getHeaderString( Server ).toUpperCase() ) == 0 ) { return Server; } if ( u.compareTo( getHeaderString( Subject ).toUpperCase() ) == 0 ) { return Subject; } if ( u.compareTo( getHeaderString( Timestamp ).toUpperCase() ) == 0 ) { return Timestamp; } if ( u.compareTo( getHeaderString( To ).toUpperCase() ) == 0 ) { return To; } if ( u.compareTo( getHeaderString( Unsupported ).toUpperCase() ) == 0 ) { return Unsupported; } if ( u.compareTo( getHeaderString( User_Agent ).toUpperCase() ) == 0 ) { return User_Agent; } if ( u.compareTo( getHeaderString( Via ).toUpperCase() ) == 0 ) { return Via; } if ( u.compareTo( getHeaderString( Warning ).toUpperCase() ) == 0 ) { return Warning; } if ( u.compareTo( getHeaderString( WWW_Authenticate ).toUpperCase() ) == 0 ) { return WWW_Authenticate; } return BadHeader; }}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -