1package gov.nist.javax.sip.header;
2
3import java.text.ParseException;
4
5import gov.nist.javax.sip.header.extensions.JoinHeader;
6import gov.nist.javax.sip.header.extensions.ReferredByHeader;
7import gov.nist.javax.sip.header.extensions.ReplacesHeader;
8import gov.nist.javax.sip.header.extensions.SessionExpiresHeader;
9import gov.nist.javax.sip.header.ims.PAccessNetworkInfoHeader;
10import gov.nist.javax.sip.header.ims.PAssertedIdentityHeader;
11import gov.nist.javax.sip.header.ims.PAssertedServiceHeader;
12import gov.nist.javax.sip.header.ims.PAssociatedURIHeader;
13import gov.nist.javax.sip.header.ims.PCalledPartyIDHeader;
14import gov.nist.javax.sip.header.ims.PChargingFunctionAddressesHeader;
15import gov.nist.javax.sip.header.ims.PChargingVectorHeader;
16import gov.nist.javax.sip.header.ims.PMediaAuthorizationHeader;
17import gov.nist.javax.sip.header.ims.PPreferredIdentityHeader;
18import gov.nist.javax.sip.header.ims.PPreferredServiceHeader;
19import gov.nist.javax.sip.header.ims.PProfileKeyHeader;
20import gov.nist.javax.sip.header.ims.PServedUserHeader;
21import gov.nist.javax.sip.header.ims.PUserDatabaseHeader;
22import gov.nist.javax.sip.header.ims.PVisitedNetworkIDHeader;
23import gov.nist.javax.sip.header.ims.PathHeader;
24import gov.nist.javax.sip.header.ims.PrivacyHeader;
25import gov.nist.javax.sip.header.ims.SecurityClientHeader;
26import gov.nist.javax.sip.header.ims.SecurityServerHeader;
27import gov.nist.javax.sip.header.ims.SecurityVerifyHeader;
28import gov.nist.javax.sip.header.ims.ServiceRouteHeader;
29
30import javax.sip.InvalidArgumentException;
31import javax.sip.address.Address;
32import javax.sip.header.Header;
33import javax.sip.header.HeaderFactory;
34
35/**
36 * Header factory extensions. These will be included in the next release of
37 * JAIN-SIP.
38 *
39 * @since 2.0
40 *
41 */
42public interface HeaderFactoryExt extends HeaderFactory {
43
44    /**
45     * Create a RequestLine from a String
46     * @throws ParseException
47     */
48    public SipRequestLine createRequestLine(String requestLine) throws ParseException;
49
50
51    /**
52     * Create a StatusLine from a String.
53     */
54    public SipStatusLine createStatusLine(String statusLine) throws ParseException;
55
56
57    /**
58     * Create a ReferredBy Header.
59     *
60     * @param address --
61     *            address for the header.
62     *
63     */
64    public ReferredByHeader createReferredByHeader(Address address);
65
66    /**
67     *
68     * Create a Replaces header with a call Id, to and from tag.
69     *
70     * @param callId -
71     *            the call id to use.
72     * @param toTag -
73     *            the to tag to use.
74     * @param fromTag -
75     *            the fromTag to use.
76     *
77     */
78    public ReplacesHeader createReplacesHeader(String callId, String toTag,
79            String fromTag) throws ParseException;
80
81    /**
82     * creates a P-Access-Network-Info header.
83     *
84     * @return newly created P-Access-Network-Info header
85     */
86    public PAccessNetworkInfoHeader createPAccessNetworkInfoHeader();
87
88    /**
89     * P-Asserted-Identity header
90     *
91     * @param address -
92     *            Address
93     * @return newly created P-Asserted-Identity header
94     * @throws ParseException
95     * @throws NullPointerException
96     */
97    public PAssertedIdentityHeader createPAssertedIdentityHeader(Address address)
98            throws NullPointerException, ParseException;
99
100    /**
101     * Creates a new P-Associated-URI header based on the supplied address
102     *
103     * @param assocURI -
104     *            Address
105     * @return newly created P-Associated-URI header
106     * @throws NullPointerException
107     *             if the supplied address is null
108     * @throws ParseException
109     */
110    public PAssociatedURIHeader createPAssociatedURIHeader(Address assocURI);
111
112    /**
113     * P-Called-Party-ID header
114     *
115     * @param address -
116     *            Address
117     * @return newly created P-Called-Party-ID header
118     * @throws NullPointerException
119     * @throws ParseException
120     */
121    public PCalledPartyIDHeader createPCalledPartyIDHeader(Address address);
122
123    /**
124     * P-Charging-Function-Addresses header
125     *
126     * @return newly created P-Charging-Function-Addresses header
127     */
128    public PChargingFunctionAddressesHeader createPChargingFunctionAddressesHeader();
129
130    /**
131     * P-Charging-Vector header
132     *
133     * @param icid -
134     *            icid string
135     * @return newly created P-Charging-Vector header
136     * @throws NullPointerException
137     * @throws ParseException
138     */
139    public PChargingVectorHeader createChargingVectorHeader(String icid) throws ParseException;
140
141     /**
142     * P-Media-Authorization header
143     * @param token - token string
144     * @return newly created P-Media-Authorizarion header
145     * @throws InvalidArgumentException
146     * @throws ParseException
147     */
148    public PMediaAuthorizationHeader createPMediaAuthorizationHeader(String token)
149        throws InvalidArgumentException, ParseException;
150
151    /**
152     * P-Preferred-Identity header
153     * @param address - Address
154     * @return newly created P-Preferred-Identity header
155     * @throws NullPointerException
156     */
157    public PPreferredIdentityHeader createPPreferredIdentityHeader(Address address);
158
159    /**
160     * P-Visited-Network-ID header
161     * @return newly created P-Visited-Network-ID header
162     */
163    public PVisitedNetworkIDHeader createPVisitedNetworkIDHeader();
164
165    /**
166     * PATH header
167     * @param address - Address
168     * @return newly created Path header
169     * @throws NullPointerException
170     * @throws ParseException
171     */
172    public PathHeader createPathHeader(Address address);
173
174    /**
175     * Privacy header
176     * @param privacyType - privacy type string
177     * @return newly created Privacy header
178     * @throws NullPointerException
179     */
180    public PrivacyHeader createPrivacyHeader(String privacyType);
181
182
183    /**
184     * Service-Route header
185     * @param address - Address
186     * @return newly created Service-Route header
187     * @throws NullPointerException
188     */
189    public ServiceRouteHeader createServiceRouteHeader(Address address);
190
191    /**
192     * Security-Server header
193     * @return newly created Security-Server header
194     */
195    public SecurityServerHeader createSecurityServerHeader();
196
197    /**
198     * Security-Client header
199     * @return newly created Security-Client header
200     */
201    public SecurityClientHeader createSecurityClientHeader();
202
203
204    /**
205     * Security-Verify header
206     * @return newly created Security-Verify header
207     */
208    public SecurityVerifyHeader createSecurityVerifyHeader();
209
210
211    /**
212     * Creates a new SessionExpiresHeader based on the newly supplied expires value.
213     *
214     * @param expires - the new integer value of the expires.
215     * @throws InvalidArgumentException if supplied expires is less
216     * than zero.
217     * @return the newly created SessionExpiresHeader object.
218     *
219     */
220    public SessionExpiresHeader createSessionExpiresHeader(int expires) throws InvalidArgumentException ;
221
222    /**
223     *
224     * Create a Join header with a call Id, to and from tag.
225     *
226     * @param callId -
227     *            the call id to use.
228     * @param toTag -
229     *            the to tag to use.
230     * @param fromTag -
231     *            the fromTag to use.
232     *
233     */
234    public JoinHeader createJoinHeader(String callId, String toTag,
235            String fromTag) throws ParseException;
236
237    /**
238     *
239     * @return the newly created P-User-Database header
240     * @param the database name, that may be an IP:port or a domain name.
241     */
242    public PUserDatabaseHeader createPUserDatabaseHeader(String databaseName);
243
244
245    /**
246     *
247     * @param address
248     * @return The newly created P-Profile-Key header
249     */
250    public PProfileKeyHeader createPProfileKeyHeader(Address address);
251
252    /**
253     * @param address of the served user.
254     * @return The newly created P-Served-User Header.
255     */
256    public PServedUserHeader createPServedUserHeader(Address address);
257
258    /**
259     *
260     * @return The newly created P-Preferred-Service Header.
261     */
262    public PPreferredServiceHeader createPPreferredServiceHeader();
263
264    /**
265     *
266     * @return The newly created P-Asserted-Service Header.
267     */
268    public PAssertedServiceHeader createPAssertedServiceHeader();
269
270    /**
271     * Create a header from a string. The string is assumed to be in the
272     * name:value format. The trailing CRLF (if any ) will be stripped
273     * before parsing this. The header should be a singleton.
274     */
275    public Header createHeader(String header) throws ParseException;
276
277}
278