| 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 |
#ifndef LOST_UTILITIES_H |
| 35 |
#define LOST_UTILITIES_H |
| 36 |
|
| 37 |
#include "response.h" |
| 38 |
|
| 39 |
#define LAQUOT '<' |
| 40 |
#define COLON ':' |
| 41 |
|
| 42 |
#define LOST_GEOLOC_HEADER "Geolocation: " |
| 43 |
#define LOST_GEOLOC_HEADER_SIZE strlen(LOST_GEOLOC_HEADER) |
| 44 |
#define LOST_PAI_HEADER "P-Asserted-Identity: " |
| 45 |
#define LOST_PAI_HEADER_SIZE strlen(LOST_PAI_HEADER) |
| 46 |
|
| 47 |
#define LOST_BOUNDARY_TRUE 1 |
| 48 |
#define LOST_BOUNDARY_FALSE 0 |
| 49 |
#define LOST_XPATH_DPTH 3 |
| 50 |
#define LOST_XPATH_GP "//gp:location-info |
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
#define LOST_PNT "Point" |
| 67 |
#define LOST_POL "Polygon" |
| 68 |
#define LOST_CIR "Circle" |
| 69 |
#define LOST_ELL "Ellipse" |
| 70 |
#define LOST_ARC "ArcBand" |
| 71 |
#define LOST_SPH "Sphere" |
| 72 |
#define LOST_OID "Ellipsoid" |
| 73 |
#define LOST_PSM "Prism" |
| 74 |
#define LOST_CIV "civicAddress" |
| 75 |
|
| 76 |
#define HELD_TYPE_ANY "any" |
| 77 |
#define HELD_TYPE_CIV "civic" |
| 78 |
#define HELD_TYPE_GEO "geodetic" |
| 79 |
#define HELD_TYPE_URI "locationURI" |
| 80 |
#define HELD_TYPE_SEP " " |
| 81 |
|
| 82 |
#define HELD_LR "locationRequest" |
| 83 |
#define HELD_LT "locationType" |
| 84 |
#define HELD_RT "responseTime" |
| 85 |
#define HELD_ED "emergencyDispatch" |
| 86 |
#define HELD_ER "emergencyRouting" |
| 87 |
|
| 88 |
#define HELD_EXACT_TRUE 1 |
| 89 |
#define HELD_EXACT_FALSE 0 |
| 90 |
|
| 91 |
#define BUFSIZE 128 |
| 92 |
#define RANDSTRSIZE 16 |
| 93 |
|
| 94 |
typedef struct lost_loc |
| 95 |
{ |
| 96 |
char *identity; |
| 97 |
char *urn; |
| 98 |
char *xpath; |
| 99 |
char *geodetic; |
| 100 |
char *longitude; |
| 101 |
char *latitude; |
| 102 |
char *altitude; |
| 103 |
char *profile; |
| 104 |
int radius; |
| 105 |
int recursive; |
| 106 |
int boundary; |
| 107 |
} s_lost_loc_t, *p_lost_loc_t; |
| 108 |
|
| 109 |
typedef struct lost_held |
| 110 |
{ |
| 111 |
char *identity; |
| 112 |
char *type; |
| 113 |
int time; |
| 114 |
int exact; |
| 115 |
} s_lost_held_t, *p_lost_held_t; |
| 116 |
|
| 117 |
typedef enum lost_geotype |
| 118 |
{ |
| 119 |
ANY, |
| 120 |
CID, |
| 121 |
HTTP, |
| 122 |
HTTPS, |
| 123 |
UNKNOWN = -1 |
| 124 |
} lost_geotype_t; |
| 125 |
|
| 126 |
typedef struct lost_geolist |
| 127 |
{ |
| 128 |
char *value; |
| 129 |
char *param; |
| 130 |
lost_geotype_t type; |
| 131 |
struct lost_geolist *next; |
| 132 |
} s_lost_geolist_t, *p_lost_geolist_t; |
| 133 |
|
| 134 |
void lost_rand_str(char *, size_t); |
| 135 |
void lost_free_loc(p_lost_loc_t *); |
| 136 |
void lost_free_held(p_lost_held_t *); |
| 137 |
void lost_free_string(str *); |
| 138 |
void lost_free_geoheader_list(p_lost_geolist_t *); |
| 139 |
void lost_reverse_geoheader_list(p_lost_geolist_t *); |
| 140 |
|
| 141 |
int lost_parse_location_info(xmlNodePtr, p_lost_loc_t); |
| 142 |
int lost_xpath_location(xmlDocPtr, char *, p_lost_loc_t); |
| 143 |
int lost_parse_geo(xmlNodePtr, p_lost_loc_t); |
| 144 |
int lost_parse_host(const char *, str *, int *); |
| 145 |
int lost_new_geoheader_list(p_lost_geolist_t *, str); |
| 146 |
int lost_get_nameinfo(char *, str *, int); |
| 147 |
|
| 148 |
char *lost_find_service_request(p_lost_loc_t, p_lost_list_t, int *); |
| 149 |
char *lost_held_location_request(p_lost_held_t, int *); |
| 150 |
char *lost_held_post_request(int *, long, char *); |
| 151 |
char *lost_get_content(xmlNodePtr, const char *, int *); |
| 152 |
char *lost_get_property(xmlNodePtr, const char *, int *); |
| 153 |
char *lost_get_from_header(struct sip_msg *, int *); |
| 154 |
char *lost_get_pai_header(struct sip_msg *, int *); |
| 155 |
char *lost_get_childname(xmlNodePtr, const char *, int *); |
| 156 |
char *lost_trim_content(char *, int *); |
| 157 |
char *lost_copy_geoheader_value(char *, int); |
| 158 |
char *lost_get_geoheader_value(p_lost_geolist_t, lost_geotype_t, int *); |
| 159 |
char *lost_copy_string(str, int *); |
| 160 |
|
| 161 |
p_lost_loc_t lost_new_loc(str); |
| 162 |
p_lost_loc_t lost_parse_pidf(str, str); |
| 163 |
p_lost_held_t lost_new_held(str, str, int, int); |
| 164 |
p_lost_geolist_t lost_get_geolocation_header(struct sip_msg *, int *); |
| 165 |
|
| 166 |
#endif |