]> sjero.net Git - linphone/blob - java/impl/org/linphone/core/LinphoneAuthInfoImpl.java
full LinphoneAuthInfo impl for Android
[linphone] / java / impl / org / linphone / core / LinphoneAuthInfoImpl.java
1 /*
2 LinphoneAuthInfoImpl.java
3 Copyright (C) 2010  Belledonne Communications, Grenoble, France
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18 */
19 package org.linphone.core;
20
21 class LinphoneAuthInfoImpl implements LinphoneAuthInfo {
22         protected final long nativePtr;
23         private native long newLinphoneAuthInfo();
24         private native void  delete(long ptr);
25         private native String getPassword(long ptr);
26         private native String getRealm(long ptr);
27         private native String getUsername(long ptr);
28         private native void setPassword(long ptr, String password);
29         private native void setRealm(long ptr, String realm);
30         private native void setUsername(long ptr, String username);
31         private native void setUserId(long ptr, String username);
32         private native void setHa1(long ptr, String ha1);
33         private native String getUserId(long ptr);
34         private native String getHa1(long ptr);
35         
36         protected LinphoneAuthInfoImpl(String username,String password, String realm)  {
37                 this(username,null,password,null,null);
38         }
39         protected LinphoneAuthInfoImpl(String username, String userid, String passwd, String ha1,String realm)  {
40                 nativePtr = newLinphoneAuthInfo();
41                 this.setUsername(username);
42                 this.setUserId(userid);
43                 this.setPassword(passwd);
44                 this.setHa1(ha1);
45         }
46         protected void finalize() throws Throwable {
47                 delete(nativePtr);
48         }
49         public String getPassword() {
50                 return getPassword (nativePtr);
51         }
52         public String getRealm() {
53                 return getRealm (nativePtr);
54         }
55         public String getUsername() {
56                 return getUsername (nativePtr);
57         }
58         public void setPassword(String password) {
59                 setPassword(nativePtr,password);
60         }
61         public void setRealm(String realm) {
62                 setRealm(nativePtr,realm);
63         }
64         public void setUsername(String username) {
65                 setUsername(nativePtr,username);
66         }
67         @Override
68         public String getUserId() {
69                 return getUserId(nativePtr);
70         }
71         @Override
72         public void setUserId(String userid) {
73                 setUserId(nativePtr,userid);
74                 
75         }
76         @Override
77         public String getHa1() {
78                 return getHa1(nativePtr);
79         }
80         @Override
81         public void setHa1(String ha1) {
82                 setHa1(nativePtr,ha1);
83                 
84         }
85 }