forked from rainliu/sip
-
Notifications
You must be signed in to change notification settings - Fork 1
/
ReferToParser.go
38 lines (33 loc) · 839 Bytes
/
ReferToParser.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package parser
import (
"sip/core"
"sip/header"
)
/** ReferTo Header parser.
*/
type ReferToParser struct {
AddressParametersParser
}
/** Creates new ReferToParser
* @param String to set
*/
func NewReferToParser(referTo string) *ReferToParser {
this := &ReferToParser{}
this.AddressParametersParser.super(referTo)
return this
}
func NewReferToParserFromLexer(lexer core.Lexer) *ReferToParser {
this := &ReferToParser{}
this.AddressParametersParser.superFromLexer(lexer)
return this
}
func (this *ReferToParser) Parse() (sh header.Header, ParseException error) {
lexer := this.GetLexer()
this.HeaderName(TokenTypes_REFER_TO)
referTo := header.NewReferTo()
if ParseException = this.AddressParametersParser.Parse(referTo); ParseException != nil {
return nil, ParseException
}
lexer.Match('\n')
return referTo, nil
}