summaryrefslogtreecommitdiff
path: root/toxmsi/toxmsi_header.h
blob: 599fafa3d9fa1edeadfd8180393cde10003bc7a0 (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
#ifndef _MSI_HEADER_
#define _MSI_HEADER_

/* Basic format of the unparsed header string
 * ( No spaces in field allowed )
 * Version 0.1.1\n\r
 * Request INVITE\n\r
 * Response\n\r
 * Friend-id ( from ip )\n\r
 * Call-type AUDIO\n\r
 * User-agent phone-v.1.0.0\n\r
 */


/* define raw header terminator */
static const char* _RAW_TERMINATOR = "\n\r";

/* define string formats for the identifiers */
#define _VERSION_FIELD          "Version"
#define _REQUEST_FIELD          "Request"
#define _RESPONSE_FIELD         "Response"
#define _FRIENDID_FIELD         "Friend-id"
#define _CALLTYPE_FIELD         "Call-type"
#define _USERAGENT_FIELD        "User-agent"
#define _INFO_FIELD             "INFO"
#define _REASON_FIELD           "Reason"
#define _CALL_ID_FIELD          "Call-id"

#define HEADER_VALUES   \
/*uint8_t* _header_field */ \
uint8_t* _header_value;

typedef struct msi_header_s { /* raw header list */
    uint8_t* _header_field;
    uint8_t* _header_value;

    struct msi_header_s* next;

} msi_header_t;



typedef struct msi_header_version_s { /* Defines our version */
    HEADER_VALUES

} msi_header_version_t;

typedef struct msi_header_request_s { /* Defines our request */
    HEADER_VALUES

} msi_header_request_t;

typedef struct msi_header_response_s { /* Defines our response */
    HEADER_VALUES

} msi_header_response_t;

typedef struct msi_header_friendid_s { /* Defines source that sent the message */
    HEADER_VALUES

} msi_header_friendid_t;

typedef struct msi_header_call_type_s { /* Defines the type of the call */
    HEADER_VALUES

} msi_header_call_type_t;

typedef struct msi_header_user_agent_s { /* Defines the device of the participant */
    HEADER_VALUES

} msi_header_user_agent_t;


typedef struct msi_header_call_id_s { /* Call id that is used to identify the call */
    HEADER_VALUES

} msi_header_call_id_t;

typedef struct msi_header_info_s { /* Defines informational message header */
    HEADER_VALUES

} msi_header_info_t;

typedef struct msi_header_reason_s { /* Defines reason mostly for error messages */
    HEADER_VALUES

} msi_header_reason_t;

struct msi_msg_s;

/*
 * Parses the header list to header types
 */
int             msi_parse_headers ( struct msi_msg_s* _msg );

/* Make sure it's null terminated */
msi_header_t*   msi_parse_raw_data ( const uint8_t* _data );

#endif /* _MSI_HEADER_ */