forked from rainliu/sip
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ReplyToParser.go
47 lines (37 loc) · 1.11 KB
/
ReplyToParser.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
39
40
41
42
43
44
45
46
47
package parser
import (
"github.com/tutuvss/sip/core"
"github.com/tutuvss/sip/header"
)
/** SIPParser for a list of RelpyTo headers.
*/
type ReplyToParser struct {
AddressParametersParser
}
/** Creates a new instance of ReplyToParser
* @param replyTo the header to parse
*/
func NewReplyToParser(replyTo string) *ReplyToParser {
this := &ReplyToParser{}
this.AddressParametersParser.super(replyTo)
return this
}
/** Cosntructor
* param lexer the lexer to use to parse the header
*/
func NewReplyToParserFromLexer(lexer core.Lexer) *ReplyToParser {
this := &ReplyToParser{}
this.AddressParametersParser.superFromLexer(lexer)
return this
}
/** parse the String message and generate the ReplyTo List Object
* @return SIPHeader the ReplyTo List object
* @throws SIPParseException if errors occur during the parsing
*/
func (this *ReplyToParser) Parse() (sh header.Header, ParseException error) {
replyTo := header.NewReplyTo()
this.HeaderName(TokenTypes_REPLY_TO)
replyTo.SetHeaderName(core.SIPHeaderNames_REPLY_TO)
ParseException = this.AddressParametersParser.Parse(replyTo)
return replyTo, ParseException
}