summaryrefslogtreecommitdiffstats
path: root/stack/pan/pan_int.h
blob: 4e0223645fa324d1daf4644c965efae17144a5d0 (plain)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
/******************************************************************************
 *
 *  Copyright (C) 2001-2012 Broadcom Corporation
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at:
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
 ******************************************************************************/

/******************************************************************************
 *
 *  This file contains internally used PAN definitions
 *
 ******************************************************************************/

#ifndef  PAN_INT_H
#define  PAN_INT_H

#include "pan_api.h"

/*
** This role is used to shutdown the profile. Used internally
** Applications should call PAN_Deregister to shutdown the profile
*/
#define PAN_ROLE_INACTIVE      0

/* Protocols supported by the host internal stack, are registered with SDP */
#define PAN_PROTOCOL_IP        0x0800
#define PAN_PROTOCOL_ARP       0x0806

#define PAN_PROFILE_VERSION    0x0100   /* Version 1.00 */

/* Define the PAN Connection Control Block
*/
typedef struct
{
#define PAN_STATE_IDLE              0
#define PAN_STATE_CONN_START        1
#define PAN_STATE_CONNECTED         2
    UINT8             con_state;

#define PAN_FLAGS_CONN_COMPLETED    0x01
    UINT8             con_flags;

    UINT16            handle;
    BD_ADDR           rem_bda;

    UINT16            bad_pkts_rcvd;
    UINT16            src_uuid;
    UINT16            dst_uuid;
    UINT16            prv_src_uuid;
    UINT16            prv_dst_uuid;
    UINT16            ip_addr_known;
    UINT32            ip_addr;

} tPAN_CONN;


/*  The main PAN control block
*/
typedef struct
{
    UINT8                       role;
    UINT8                       active_role;
    UINT8                       prv_active_role;
    tPAN_CONN                   pcb[MAX_PAN_CONNS];

    tPAN_CONN_STATE_CB          *pan_conn_state_cb;     /* Connection state callback */
    tPAN_BRIDGE_REQ_CB          *pan_bridge_req_cb;
    tPAN_DATA_IND_CB            *pan_data_ind_cb;
    tPAN_DATA_BUF_IND_CB        *pan_data_buf_ind_cb;
    tPAN_FILTER_IND_CB          *pan_pfilt_ind_cb;      /* protocol filter indication callback */
    tPAN_MFILTER_IND_CB         *pan_mfilt_ind_cb;      /* multicast filter indication callback */
    tPAN_TX_DATA_FLOW_CB        *pan_tx_data_flow_cb;

    BD_ADDR                     my_bda;                 /* BD Address of this device    */
    char                        *user_service_name;
    char                        *gn_service_name;
    char                        *nap_service_name;
    UINT32                      pan_user_sdp_handle;
    UINT32                      pan_gn_sdp_handle;
    UINT32                      pan_nap_sdp_handle;
    UINT8                       num_conns;
    UINT8                       trace_level;
} tPAN_CB;


#ifdef __cplusplus
extern "C" {
#endif

/* Global PAN data
*/
#if PAN_DYNAMIC_MEMORY == FALSE
PAN_API extern tPAN_CB  pan_cb;
#else
PAN_API extern tPAN_CB  *pan_cb_ptr;
#define pan_cb (*pan_cb_ptr)
#endif

/*******************************************************************************/
extern void pan_register_with_bnep (void);
extern void pan_conn_ind_cb (UINT16 handle,
                             BD_ADDR p_bda,
                             tBT_UUID *remote_uuid,
                             tBT_UUID *local_uuid,
                             BOOLEAN is_role_change);
extern void pan_connect_state_cb (UINT16 handle, BD_ADDR rem_bda, tBNEP_RESULT result, BOOLEAN is_role_change);
extern void pan_data_ind_cb (UINT16 handle,
                             UINT8 *src,
                             UINT8 *dst,
                             UINT16 protocol,
                             UINT8 *p_data,
                             UINT16 len,
                             BOOLEAN fw_ext_present);
extern void pan_data_buf_ind_cb (UINT16 handle,
                                 UINT8 *src,
                                 UINT8 *dst,
                                 UINT16 protocol,
                                 BT_HDR *p_buf,
                                 BOOLEAN ext);
extern void pan_tx_data_flow_cb (UINT16 handle,
                            tBNEP_RESULT  event);
void pan_proto_filt_ind_cb (UINT16 handle,
                            BOOLEAN indication,
                            tBNEP_RESULT result,
                            UINT16 num_filters,
                            UINT8 *p_filters);
void pan_mcast_filt_ind_cb (UINT16 handle,
                            BOOLEAN indication,
                            tBNEP_RESULT result,
                            UINT16 num_filters,
                            UINT8 *p_filters);
extern UINT32 pan_register_with_sdp (UINT16 uuid, UINT8 sec_mask, char *p_name, char *p_desc);
extern tPAN_CONN *pan_allocate_pcb (BD_ADDR p_bda, UINT16 handle);
extern tPAN_CONN *pan_get_pcb_by_handle (UINT16 handle);
extern tPAN_CONN *pan_get_pcb_by_addr (BD_ADDR p_bda);
extern void pan_close_all_connections (void);
extern void pan_release_pcb (tPAN_CONN *p_pcb);
extern void pan_dump_status (void);

/********************************************************************************/

#ifdef __cplusplus
}
#endif

#endif