1bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
2bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo *
3bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo * Redistribution and use in source and binary forms, with or without
4bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo * modification, are permitted provided that the following conditions are
5bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo * met:
6bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo *     * Redistributions of source code must retain the above copyright
7bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo *       notice, this list of conditions and the following disclaimer.
8bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo *     * Redistributions in binary form must reproduce the above
9bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo *       copyright notice, this list of conditions and the following
10bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo *       disclaimer in the documentation and/or other materials provided
11bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo *       with the distribution.
12bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo *     * Neither the name of The Linux Foundation, nor the names of its
13bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo *       contributors may be used to endorse or promote products derived
14bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo *       from this software without specific prior written permission.
15bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo *
16bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
17bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
19bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
20bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
26bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo *
28bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo */
29bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo#ifndef LOC_ENG_DATA_SERVER_HANDLER
30bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo#define LOC_ENG_DATA_SERVER_HANDLER
31bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo
32bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo#include <linux/types.h>
33bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo#include <arpa/inet.h>
34bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo
35bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo//for SSID_BUF_SIZE
36bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo#include <hardware/gps.h>
37bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo
38bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo#ifndef SSID_BUF_SIZE
39bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo    #define SSID_BUF_SIZE (32+1)
40bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo#endif
41bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo
42bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russoenum {
43bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo    /* 0x0 - 0xEF is reserved for daemon internal */
44bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo    GPSONE_LOC_API_IF_REQUEST   = 0xF0,
45bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo    GPSONE_LOC_API_IF_RELEASE,
46bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo    GPSONE_LOC_API_RESPONSE,
47bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo    GPSONE_UNBLOCK,
48bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo};
49bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo
50bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russoenum {
51bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo    GPSONE_LOC_API_IF_REQUEST_SUCCESS = 0xF0,
52bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo    GPSONE_LOC_API_IF_RELEASE_SUCCESS,
53bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo    GPSONE_LOC_API_IF_FAILURE,
54bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo};
55bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo
56bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo
57bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russostruct ctrl_msg_response {
58bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo    int result;
59bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo};
60bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo
61bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russostruct ctrl_msg_unblock {
62bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo    int reserved;
63bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo};
64bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo
65bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russotypedef enum {
66bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo  IF_REQUEST_TYPE_SUPL = 0,
67bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo  IF_REQUEST_TYPE_WIFI,
68bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo  IF_REQUEST_TYPE_ANY
69bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo} ctrl_if_req_type_e_type;
70bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo
71bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russotypedef enum {
72bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo  IF_REQUEST_SENDER_ID_QUIPC = 0,
73bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo  IF_REQUEST_SENDER_ID_MSAPM,
74bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo  IF_REQUEST_SENDER_ID_MSAPU,
75bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo  IF_REQUEST_SENDER_ID_GPSONE_DAEMON,
76bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo  IF_REQUEST_SENDER_ID_MODEM
77bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo} ctrl_if_req_sender_id_e_type;
78bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo
79bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russostruct ctrl_msg_if_request {
80bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo    ctrl_if_req_type_e_type type;
81bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo    ctrl_if_req_sender_id_e_type sender_id;
82bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo    unsigned long ipv4_addr;
83bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo    unsigned char ipv6_addr[16];
84bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo    char ssid[SSID_BUF_SIZE];
85bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo    char password[SSID_BUF_SIZE];
86bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo};
87bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo
88bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo/* do not change this structure */
89bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russostruct ctrl_msgbuf {
90bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo    size_t msgsz;
91bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo    uint16_t reserved1;
92bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo    uint32_t reserved2;
93bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo    uint8_t ctrl_type;
94bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo    union {
95bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo        struct ctrl_msg_response   cmsg_response;
96bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo        struct ctrl_msg_unblock    cmsg_unblock;
97bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo        struct ctrl_msg_if_request cmsg_if_request;
98bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo    } cmsg;
99bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo};
100bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo
101bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russoextern void* loc_api_handle;
102bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo
103bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russoint loc_eng_dmn_conn_loc_api_server_if_request_handler(struct ctrl_msgbuf *pmsg, int len);
104bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russoint loc_eng_dmn_conn_loc_api_server_if_release_handler(struct ctrl_msgbuf *pmsg, int len);
105bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo
106bfff6343845ad9ff062c5fd97bb3b9be1053340eDante Russo#endif /* LOC_ENG_DATA_SERVER_HANDLER */
107