Home | History | Annotate | Download | only in src
      1 /* -------------------------------------------------------------------------------
      2 Copyright (c) 2009, QUALCOMM USA, INC.
      3 
      4 All rights reserved.
      5 
      6 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
      7 
      8          Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
      9 
     10          Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
     11 
     12          Neither the name of the QUALCOMM USA, INC.  nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
     13 
     14 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     15  -------------------------------------------------------------------------------
     16  */
     17 #include "rpc/rpc.h"
     18 #include "loc_api_common.h"
     19 #include "loc_api.h"
     20 #include "loc_api_cb.h"
     21 #include "loc_api_fixup.h"
     22 
     23 #include "loc_apicb_appinit.h"
     24 
     25 #define RPC_FUNC_VERSION_BASE(a,b) a ## b
     26 #define RPC_CB_FUNC_VERS(a,b) RPC_FUNC_VERSION_BASE(a,b)
     27 
     28 static SVCXPRT* svrPort = NULL;
     29 
     30 extern void RPC_CB_FUNC_VERS(loc_apicbprog_,LOC_APICBVERS_0001)(struct svc_req *rqstp, register SVCXPRT *transp);
     31 
     32 int loc_apicb_app_init(void)
     33 {
     34     /* Register a callback server to use the loc_apicbprog_* function  */
     35     if (svrPort == NULL) {
     36         svrPort = svcrtr_create();
     37     }
     38     if (!svrPort) return -1;
     39 
     40     xprt_register(svrPort);
     41     if(svc_register(svrPort, LOC_APICBPROG, LOC_APICBVERS_0001, RPC_CB_FUNC_VERS(loc_apicbprog_,LOC_APICBVERS_0001),0))
     42     {
     43         return 0;
     44     }
     45     else
     46     {
     47         return -1;
     48     }
     49 }
     50 
     51 void loc_apicb_app_deinit(void)
     52 {
     53     if (svrPort == NULL)
     54     {
     55         return;
     56     }
     57     xprt_unregister(svrPort);
     58     svc_destroy(svrPort);
     59     //svc_unregister(svrPort, LOC_APICBPROG, LOC_APICBVERS_0001);
     60     svrPort = NULL;
     61 }
     62