summaryrefslogtreecommitdiffstats
path: root/stack/avct/avct_defs.h
blob: dd03c1ed7f0d3e96fa1af9e237f638e9e41c8b90 (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
/*****************************************************************************
**
**  Name:           avct_defs.h
**
**  Description:    This contains constants definitions and other information
**                  from the AVCTP specification.  This file is intended for
**                  use internal to AVCT only.
**                  
**
**  Copyright (c) 2003-2004, WIDCOMM Inc., All Rights Reserved.
**  WIDCOMM Bluetooth Core. Proprietary and confidential.
**
*****************************************************************************/
#ifndef AVCT_DEFS_H
#define AVCT_DEFS_H

/*****************************************************************************
** constants
*****************************************************************************/

/* packet type */
#define AVCT_PKT_TYPE_SINGLE        0       /* single packet */
#define AVCT_PKT_TYPE_START         1       /* start packet */
#define AVCT_PKT_TYPE_CONT          2       /* continue packet */
#define AVCT_PKT_TYPE_END           3       /* end packet */

/* header lengths for different packet types */
#define AVCT_HDR_LEN_SINGLE         3
#define AVCT_HDR_LEN_START          4
#define AVCT_HDR_LEN_CONT           1
#define AVCT_HDR_LEN_END            1

/* invalid cr+ipid value */
#define AVCT_CR_IPID_INVALID        1

/*****************************************************************************
** message parsing and building macros
*****************************************************************************/

#define AVCT_BLD_HDR(p, label, type, cr_ipid) \
    *(p)++ = ((label) << 4) | ((type) << 2) | (cr_ipid);

#define AVCT_PRS_HDR(p, label, type, cr_ipid) \
    label = *(p) >> 4; \
    type = (*(p) >> 2) & 3; \
    cr_ipid = *(p)++ & 3;

#define AVCT_PRS_PKT_TYPE(p, type) \
    type = (*(p) >> 2) & 3;
         
#endif /* AVCT_DEFS_H */