yu.dong | c33b307 | 2024-08-21 23:14:49 -0700 | [diff] [blame^] | 1 | /***************************************************************************** |
| 2 | * Copyright Statement: |
| 3 | * -------------------- |
| 4 | * This software is protected by Copyright and the information contained |
| 5 | * herein is confidential. The software may not be copied and the information |
| 6 | * contained herein may not be used or disclosed except with the written |
| 7 | * permission of MediaTek Inc. (C) 2005 |
| 8 | * |
| 9 | * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES |
| 10 | * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") |
| 11 | * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON |
| 12 | * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, |
| 13 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF |
| 14 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. |
| 15 | * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE |
| 16 | * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR |
| 17 | * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH |
| 18 | * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO |
| 19 | * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S |
| 20 | * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM. |
| 21 | * |
| 22 | * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE |
| 23 | * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE, |
| 24 | * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE, |
| 25 | * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO |
| 26 | * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. |
| 27 | * |
| 28 | * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE |
| 29 | * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF |
| 30 | * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND |
| 31 | * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER |
| 32 | * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC). |
| 33 | * |
| 34 | *****************************************************************************/ |
| 35 | |
| 36 | /***************************************************************************** |
| 37 | * |
| 38 | * Filename: |
| 39 | * --------- |
| 40 | * app2saf_struct.h |
| 41 | * |
| 42 | * Project: |
| 43 | * -------- |
| 44 | * MAUI |
| 45 | * |
| 46 | * Description: |
| 47 | * ------------ |
| 48 | * This file describes the common struct of Applications and SAF. |
| 49 | * |
| 50 | * Author: |
| 51 | * ------- |
| 52 | * ------- |
| 53 | * |
| 54 | *============================================================================== |
| 55 | * HISTORY |
| 56 | * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!! |
| 57 | *------------------------------------------------------------------------------ |
| 58 | * removed! |
| 59 | * |
| 60 | * removed! |
| 61 | * removed! |
| 62 | * removed! |
| 63 | * |
| 64 | * removed! |
| 65 | * removed! |
| 66 | * removed! |
| 67 | * |
| 68 | * removed! |
| 69 | * removed! |
| 70 | * removed! |
| 71 | * |
| 72 | *------------------------------------------------------------------------------ |
| 73 | * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!! |
| 74 | *============================================================================== |
| 75 | *******************************************************************************/ |
| 76 | |
| 77 | #ifndef _APP2SAF_STRUCT_H |
| 78 | #define _APP2SAF_STRUCT_H |
| 79 | |
| 80 | #ifndef _SOC_API_H |
| 81 | #error pls include soc_api.h before app2saf_struct.h |
| 82 | #endif |
| 83 | |
| 84 | #define SAF_MAX_SERVER_LEN (64) /* server string length constraint */ |
| 85 | #define SAF_MAX_DERIVED_ADDR_NUM (2) /* number of derived addresses quering constraint */ |
| 86 | |
| 87 | /* The structure for specified the derived address */ |
| 88 | typedef struct |
| 89 | { |
| 90 | sockaddr_struct local_addr; /* local address */ |
| 91 | sockaddr_struct derived_addr; /* derived address from stun server */ |
| 92 | } saf_addr_struct; |
| 93 | |
| 94 | /* Used to open the channel */ |
| 95 | typedef struct |
| 96 | { |
| 97 | kal_uint8 ref_count; |
| 98 | kal_uint16 msg_len; |
| 99 | |
| 100 | kal_uint32 data_account_id; /* selected dataaccount for opening channel */ |
| 101 | kal_char stun_server[SAF_MAX_SERVER_LEN]; /* stun server (null terminated) */ |
| 102 | kal_uint16 stun_port; /* stun port number */ |
| 103 | kal_char turn_server[SAF_MAX_SERVER_LEN]; /* turn proto, not support yet */ |
| 104 | kal_uint16 turn_port; /* turn proto, not support yet */ |
| 105 | } app_saf_open_channel_req_struct; |
| 106 | |
| 107 | /* Used for confirmation of OPEN_CHANNEL_REQ */ |
| 108 | typedef struct |
| 109 | { |
| 110 | kal_uint8 ref_count; |
| 111 | kal_uint16 msg_len; |
| 112 | |
| 113 | kal_uint8 result; /* saf_result_enum */ |
| 114 | kal_uint32 error_cause; /* reserved, always return 0 now */ |
| 115 | kal_uint8 channel_id; /* opened channel id */ |
| 116 | } app_saf_open_channel_cnf_struct; |
| 117 | |
| 118 | /* Used to abort OPEN_CHANNEL_REQ */ |
| 119 | typedef struct |
| 120 | { |
| 121 | kal_uint8 ref_count; |
| 122 | kal_uint16 msg_len; |
| 123 | |
| 124 | } app_saf_abort_open_channel_req_struct; |
| 125 | |
| 126 | /* Used for confirmation of ABORT_OPEN_CHANNEL_REQ */ |
| 127 | typedef struct |
| 128 | { |
| 129 | kal_uint8 ref_count; |
| 130 | kal_uint16 msg_len; |
| 131 | |
| 132 | kal_uint8 result; /* saf_result_enum */ |
| 133 | kal_uint32 error_cause; /* reserved, always return 0 now */ |
| 134 | } app_saf_abort_open_channel_cnf_struct; |
| 135 | |
| 136 | /* Used to close the channel */ |
| 137 | typedef struct |
| 138 | { |
| 139 | kal_uint8 ref_count; |
| 140 | kal_uint16 msg_len; |
| 141 | |
| 142 | kal_uint8 channel_id; /* specified channel id */ |
| 143 | } app_saf_close_channel_req_struct; |
| 144 | |
| 145 | /* Used for confirmation of CLOSE_CHANNEL_REQ */ |
| 146 | typedef struct |
| 147 | { |
| 148 | kal_uint8 ref_count; |
| 149 | kal_uint16 msg_len; |
| 150 | |
| 151 | kal_uint8 result; /* saf_result_enum */ |
| 152 | kal_uint32 error_cause; /* reserved, always return 0 now */ |
| 153 | kal_uint8 channel_id; /* specified channel id */ |
| 154 | } app_saf_close_channel_cnf_struct; |
| 155 | |
| 156 | /* Used to get the derived IP address and port number */ |
| 157 | typedef struct |
| 158 | { |
| 159 | kal_uint8 ref_count; |
| 160 | kal_uint16 msg_len; |
| 161 | |
| 162 | kal_uint8 channel_id; /* associated channel id */ |
| 163 | kal_uint32 request_id; /* return same value in cnf */ |
| 164 | |
| 165 | kal_uint8 stun_addr_num; /* identify the number of addresses need to query */ |
| 166 | kal_uint8 turn_addr_num; /* not support yet */ |
| 167 | } app_saf_get_derived_addr_req_struct; |
| 168 | |
| 169 | /* Used for confirmation of GET_DERIVED_ADDR_REQ */ |
| 170 | typedef struct |
| 171 | { |
| 172 | kal_uint8 ref_count; |
| 173 | kal_uint16 msg_len; |
| 174 | |
| 175 | kal_uint8 result; /* saf_result_enum */ |
| 176 | kal_uint32 error_cause; /* reserved, always return 0 now */ |
| 177 | kal_uint8 channel_id; /* associated channel id */ |
| 178 | kal_uint32 request_id; /* same value in req */ |
| 179 | saf_addr_struct stun_addr[SAF_MAX_DERIVED_ADDR_NUM]; /* associated stun address object array */ |
| 180 | kal_uint8 stun_addr_num; /* identify number of objects in array */ |
| 181 | saf_addr_struct turn_addr[SAF_MAX_DERIVED_ADDR_NUM]; /* turn proto, not support yet */ |
| 182 | kal_uint8 turn_addr_num; /* turn proto, not support yet */ |
| 183 | } app_saf_get_derived_addr_cnf_struct; |
| 184 | |
| 185 | /* Used to abort GET_DERIVED_ADDR_REQ */ |
| 186 | typedef struct |
| 187 | { |
| 188 | kal_uint8 ref_count; |
| 189 | kal_uint16 msg_len; |
| 190 | |
| 191 | kal_uint8 channel_id; /* associated channel id */ |
| 192 | kal_uint32 request_id; /* shall same as the one in req */ |
| 193 | |
| 194 | } app_saf_abort_get_derived_addr_req_struct; |
| 195 | |
| 196 | /* Used for confirmation of ABORT_GET_DERIVED_ADDR_REQ */ |
| 197 | typedef struct |
| 198 | { |
| 199 | kal_uint8 ref_count; |
| 200 | kal_uint16 msg_len; |
| 201 | |
| 202 | kal_uint8 result; /* saf_result_enum */ |
| 203 | kal_uint32 error_cause; /* reserved, always return 0 now */ |
| 204 | kal_uint8 channel_id; /* shall same as the one in req */ |
| 205 | kal_uint32 request_id; /* same value in req */ |
| 206 | |
| 207 | } app_saf_abort_get_derived_addr_cnf_struct; |
| 208 | |
| 209 | /* Used to get the NAT type */ |
| 210 | typedef struct |
| 211 | { |
| 212 | kal_uint8 ref_count; |
| 213 | kal_uint16 msg_len; |
| 214 | |
| 215 | kal_uint8 channel_id; /* associated NAT type */ |
| 216 | |
| 217 | /* TRUE: SAF will report SAF_RESTRICTED_CONE_NAT directly and |
| 218 | will not perform further test for distinguishing |
| 219 | whether it is Restricted Cone or Port Restricted Cone. |
| 220 | This can save the discovery time. */ |
| 221 | kal_bool not_care_port_restricted; |
| 222 | |
| 223 | } app_saf_get_nat_type_req_struct; |
| 224 | |
| 225 | /* Used for confirmation of GET_NAT_TYPE_REQ */ |
| 226 | typedef struct |
| 227 | { |
| 228 | kal_uint8 ref_count; |
| 229 | kal_uint16 msg_len; |
| 230 | |
| 231 | kal_uint8 result; /* saf_result_enum */ |
| 232 | kal_uint32 error_cause; /* reserved, always return 0 now */ |
| 233 | kal_uint8 channel_id; /* associated channel id */ |
| 234 | kal_uint8 nat_type; /* saf_nat_type_enum */ |
| 235 | |
| 236 | } app_saf_get_nat_type_cnf_struct; |
| 237 | |
| 238 | /* Used to get the NAT binding lifetime */ |
| 239 | typedef struct |
| 240 | { |
| 241 | kal_uint8 ref_count; |
| 242 | kal_uint16 msg_len; |
| 243 | |
| 244 | kal_uint8 channel_id; /* associated channel id */ |
| 245 | kal_uint32 initial_trial_time; /* specifies the first lifetime SAF tried to test. |
| 246 | 0: by default, in second */ |
| 247 | kal_uint32 max_trial_count; /* specifies the maximum of trials. |
| 248 | 0: by default */ |
| 249 | kal_uint32 max_trial_duration; /* specifies the maximum of trial duration which application could endure. |
| 250 | 0: by default, in second */ |
| 251 | |
| 252 | } app_saf_get_nat_binding_lifetime_req_struct; |
| 253 | |
| 254 | /* Used for confirmation of GET_NAT_BINDING_LIFETIME_REQ */ |
| 255 | typedef struct |
| 256 | { |
| 257 | kal_uint8 ref_count; |
| 258 | kal_uint16 msg_len; |
| 259 | |
| 260 | kal_uint8 result; /* saf_result_enum */ |
| 261 | kal_uint32 error_cause; /* reserved, always return 0 now */ |
| 262 | kal_uint8 channel_id; /* associated channel id */ |
| 263 | kal_uint32 lifetime; /* in second */ |
| 264 | |
| 265 | } app_saf_get_nat_binding_lifetime_cnf_struct; |
| 266 | |
| 267 | /* The abort get nat type request and abort get derived addr request share the same structs */ |
| 268 | typedef app_saf_abort_get_derived_addr_req_struct app_saf_abort_get_nat_type_req_struct; |
| 269 | |
| 270 | /* The abort get nat lifetime request and abort get derived addr request share the same structs */ |
| 271 | typedef app_saf_abort_get_derived_addr_req_struct app_saf_abort_get_nat_lifetime_req_struct; |
| 272 | |
| 273 | /* The abort get nat type confirm and abort get derived addr confirm share the same structs */ |
| 274 | typedef app_saf_abort_get_derived_addr_cnf_struct app_saf_abort_get_nat_type_cnf_struct; |
| 275 | |
| 276 | /* The abort get nat lifetime confirm and abort get derived addr confirm share the same structs */ |
| 277 | typedef app_saf_abort_get_derived_addr_cnf_struct app_saf_abort_get_nat_lifetime_cnf_struct; |
| 278 | |
| 279 | #endif /* _APP2SAF_STRUCT_H */ |
| 280 | |