#include "sdpint.h"
+extern fixed_queue_t *btu_general_alarm_queue;
+
/********************************************************************************/
/* G L O B A L S D P D A T A */
/********************************************************************************/
/* Clears all structures and local SDP database (if Server is enabled) */
memset (&sdp_cb, 0, sizeof (tSDP_CB));
+ for (int i = 0; i < SDP_MAX_CONNECTIONS; i++) {
+ sdp_cb.ccb[i].sdp_conn_timer = alarm_new("sdp.sdp_conn_timer");
+ }
+
/* Initialize the L2CAP configuration. We only care about MTU and flush */
sdp_cb.l2cap_my_cfg.mtu_present = TRUE;
sdp_cb.l2cap_my_cfg.mtu = SDP_MTU_SIZE;
}
}
+void sdp_free(void) {
+ for (int i = 0; i < SDP_MAX_CONNECTIONS; i++) {
+ alarm_free(sdp_cb.ccb[i].sdp_conn_timer);
+ sdp_cb.ccb[i].sdp_conn_timer = NULL;
+ }
+}
+
#if (defined(SDP_DEBUG) && SDP_DEBUG == TRUE)
/*******************************************************************************
**
{
p_ccb->con_state = SDP_STATE_CONNECTED;
- if (p_ccb->con_flags & SDP_FLAGS_IS_ORIG)
+ if (p_ccb->con_flags & SDP_FLAGS_IS_ORIG) {
sdp_disc_connected (p_ccb);
- else
+ } else {
/* Start inactivity timer */
- btu_start_timer (&p_ccb->timer_entry, BTU_TTYPE_SDP, SDP_INACT_TIMEOUT);
+ alarm_set_on_queue(p_ccb->sdp_conn_timer, SDP_INACT_TIMEOUT_MS,
+ sdp_conn_timer_timeout, p_ccb,
+ btu_general_alarm_queue);
+ }
}
-
}
-
/*******************************************************************************
**
** Function sdp_config_cfm
{
p_ccb->con_state = SDP_STATE_CONNECTED;
- if (p_ccb->con_flags & SDP_FLAGS_IS_ORIG)
+ if (p_ccb->con_flags & SDP_FLAGS_IS_ORIG) {
sdp_disc_connected (p_ccb);
- else
+ } else {
/* Start inactivity timer */
- btu_start_timer (&p_ccb->timer_entry, BTU_TTYPE_SDP, SDP_INACT_TIMEOUT);
+ alarm_set_on_queue(p_ccb->sdp_conn_timer, SDP_INACT_TIMEOUT_MS,
+ sdp_conn_timer_timeout, p_ccb,
+ btu_general_alarm_queue);
+ }
}
}
else
SDP_TRACE_WARNING ("SDP - Rcvd L2CAP data, unknown CID: 0x%x", l2cap_cid);
}
- osi_freebuf (p_msg);
+ osi_free(p_msg);
}
/*******************************************************************************
**
-** Function sdp_conn_timeout
+** Function sdp_conn_timer_timeout
**
** Description This function processes a timeout. Currently, we simply send
** a disconnect request to L2CAP.
** Returns void
**
*******************************************************************************/
-void sdp_conn_timeout (tCONN_CB*p_ccb)
+void sdp_conn_timer_timeout(void *data)
{
+ tCONN_CB *p_ccb = (tCONN_CB *)data;
+
SDP_TRACE_EVENT ("SDP - CCB timeout in state: %d CID: 0x%x",
p_ccb->con_state, p_ccb->connection_id);