reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
MethodTypes.cxx
Go to the documentation of this file.
1#if defined(HAVE_CONFIG_H)
2#include "config.h"
3#endif
4
5#include <string.h>
6#include <cstdio>
7#include "rutil/ResipAssert.h"
8
11#include "rutil/Data.hxx"
12
13using 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!
19namespace resip{
20
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
44const Data&
46{
47 if (t < UNKNOWN || t >= MAX_METHODS)
48 t=UNKNOWN;
49 return MethodNames[t];
50}
51
54{
55 // note: use data to prevent copying shared data
56 return getMethodType(name.data(), (int)name.size());
57}
58
60resip::getMethodType(const char* name, int len)
61{
62 const struct methods* m = MethodHash::in_word_set(name, len);
63 return m ? m->type : UNKNOWN;
64}
65
66/* ====================================================================
67 * The Vovida Software License, Version 1.0
68 *
69 * Copyright (c) 2000 Vovida Networks, Inc. All rights reserved.
70 *
71 * Redistribution and use in source and binary forms, with or without
72 * modification, are permitted provided that the following conditions
73 * are met:
74 *
75 * 1. Redistributions of source code must retain the above copyright
76 * notice, this list of conditions and the following disclaimer.
77 *
78 * 2. Redistributions in binary form must reproduce the above copyright
79 * notice, this list of conditions and the following disclaimer in
80 * the documentation and/or other materials provided with the
81 * distribution.
82 *
83 * 3. The names "VOCAL", "Vovida Open Communication Application Library",
84 * and "Vovida Open Communication Application Library (VOCAL)" must
85 * not be used to endorse or promote products derived from this
86 * software without prior written permission. For written
87 * permission, please contact vocal@vovida.org.
88 *
89 * 4. Products derived from this software may not be called "VOCAL", nor
90 * may "VOCAL" appear in their name, without prior written
91 * permission of Vovida Networks, Inc.
92 *
93 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
94 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
95 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
96 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL VOVIDA
97 * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
98 * IN EXCESS OF $1,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
99 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
100 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
101 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
102 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
103 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
104 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
105 * DAMAGE.
106 *
107 * ====================================================================
108 *
109 * This software consists of voluntary contributions made by Vovida
110 * Networks, Inc. and many individuals on behalf of Vovida Networks,
111 * Inc. For more information on Vovida Networks, Inc., please see
112 * <http://www.vovida.org/>.
113 *
114 */
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
Definition Data.hxx:90
size_type size() const noexcept
Returns the number of bytes in this Data.
Definition Data.hxx:599
const char * data() const noexcept
Returns a pointer to the contents of this Data.
Definition Data.hxx:608
static const struct methods * in_word_set(const char *str, size_t len)
dcm! – add UnusedChecking(_enum) below;
const Data & getMethodName(MethodTypes t)
Data MethodNames[]
@ MAX_METHODS
@ defineMethod
MethodTypes getMethodType(const Data &name)
const char * name
MethodTypes type