/[resiprocate]/branches/b-identity-0505/MethodTypes.cxx
ViewVC logotype

Contents of /branches/b-identity-0505/MethodTypes.cxx

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4598 - (show annotations) (download)
Wed May 11 22:53:07 2005 UTC (14 years, 6 months ago) by derek
File size: 4534 byte(s)
set svn:eol-style to LF
1 #if defined(HAVE_CONFIG_H)
2 #include "resiprocate/config.hxx"
3 #endif
4
5 #include <string.h>
6 #include <cstdio>
7 #include <cassert>
8
9 #include "resiprocate/MethodTypes.hxx"
10 #include "resiprocate/Symbols.hxx"
11 #include "resiprocate/os/Data.hxx"
12
13 using namespace resip;
14
15 #define defineMethod(_enum, _name, _rfc) _name
16
17 // !dlb! this file will be subsumed by MethodHash.cxx on auto-generate
18 // move into MethodHash.cxx -- generated from MethodTypes.hxx -- !ah! indeed, yuck!
19 namespace resip{
20
21 Data MethodNames[] =
22 {
23 defineMethod(UNKNOWN, "UNKNOWN", "NA"),
24 defineMethod(ACK, "ACK", "RFC ????"),
25 defineMethod(BYE, "BYE", "RFC ????"),
26 defineMethod(CANCEL, "CANCEL", "RFC ????"),
27 defineMethod(INVITE, "INVITE", "RFC ????"),
28 defineMethod(NOTIFY, "NOTIFY", "RFC ????"),
29 defineMethod(OPTIONS, "OPTIONS", "RFC ????"),
30 defineMethod(REFER, "REFER", "RFC ????"),
31 defineMethod(REGISTER, "REGISTER", "RFC ????"),
32 defineMethod(SUBSCRIBE, "SUBSCRIBE", "RFC ????"),
33 defineMethod(RESPONSE, "RESPONSE", "RFC ????"),
34 defineMethod(MESSAGE, "MESSAGE", "RFC ????"),
35 defineMethod(INFO, "INFO", "RFC ????"),
36 defineMethod(PRACK, "PRACK", "RFC ????"),
37 defineMethod(PUBLISH, "PUBLISH", "RFC ????"),
38 defineMethod(SERVICE, "SERVICE", "!RFC"),
39 defineMethod(UPDATE,"UPDATE", "RFC ????")
40 };
41 }
42 #include "MethodHash.hxx"
43
44 const Data&
45 resip::getMethodName(MethodTypes t)
46 {
47 if (t < UNKNOWN || t >= MAX_METHODS)
48 t=UNKNOWN;
49 return MethodNames[t];
50 }
51
52 MethodTypes
53 resip::getMethodType(const Data& name)
54 {
55 // note: use data to prevent copying shared data
56 return getMethodType(name.data(), name.size());
57 }
58
59 MethodTypes
60 resip::getMethodType(const char* name, int len)
61 {
62 struct methods* m = MethodHash::in_word_set(name, len);
63 return m ? m->type : UNKNOWN;
64 }
65
66 // ?dlb? why aren't we using the lib strncasecmp?
67 int strncasecmp(const char* a, const char* b, int len)
68 {
69 //!ah! whoever implemented this should be shot.
70 //!ah! should use library based strncasecmp() !
71 //!ah! have fixed it up a bit.
72 for (int i = 0; i < len; i++)
73 {
74 int c = tolower(a[i]) - tolower(b[i]);
75 if (c) return c;
76 }
77 return 0;
78 }
79
80 /* ====================================================================
81 * The Vovida Software License, Version 1.0
82 *
83 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
84 *
85 * Redistribution and use in source and binary forms, with or without
86 * modification, are permitted provided that the following conditions
87 * are met:
88 *
89 * 1. Redistributions of source code must retain the above copyright
90 * notice, this list of conditions and the following disclaimer.
91 *
92 * 2. Redistributions in binary form must reproduce the above copyright
93 * notice, this list of conditions and the following disclaimer in
94 * the documentation and/or other materials provided with the
95 * distribution.
96 *
97 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
98 * and "Vovida Open Communication Application Library (VOCAL)" must
99 * not be used to endorse or promote products derived from this
100 * software without prior written permission. For written
101 * permission, please contact vocal@vovida.org.
102 *
103 * 4. Products derived from this software may not be called "VOCAL", nor
104 * may "VOCAL" appear in their name, without prior written
105 * permission of Vovida Networks, Inc.
106 *
107 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
108 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
109 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
110 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
111 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
112 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
113 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
114 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
115 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
116 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
117 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
118 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
119 * DAMAGE.
120 *
121 * ====================================================================
122 *
123 * This software consists of voluntary contributions made by Vovida
124 * Networks, Inc. and many individuals on behalf of Vovida Networks,
125 * Inc. For more information on Vovida Networks, Inc., please see
126 * <http://www.vovida.org/>.
127 *
128 */

Properties

Name Value
svn:eol-style LF

webmaster AT resiprocate DOT org
ViewVC Help
Powered by ViewVC 1.1.27