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