| 1 | /****************************************************************************** |
|---|
| 2 | * (c)2011 Broadcom Corporation |
|---|
| 3 | * |
|---|
| 4 | * This program is the proprietary software of Broadcom Corporation and/or its licensors, |
|---|
| 5 | * and may only be used, duplicated, modified or distributed pursuant to the terms and |
|---|
| 6 | * conditions of a separate, written license agreement executed between you and Broadcom |
|---|
| 7 | * (an "Authorized License"). Except as set forth in an Authorized License, Broadcom grants |
|---|
| 8 | * no license (express or implied), right to use, or waiver of any kind with respect to the |
|---|
| 9 | * Software, and Broadcom expressly reserves all rights in and to the Software and all |
|---|
| 10 | * intellectual property rights therein. IF YOU HAVE NO AUTHORIZED LICENSE, THEN YOU |
|---|
| 11 | * HAVE NO RIGHT TO USE THIS SOFTWARE IN ANY WAY, AND SHOULD IMMEDIATELY |
|---|
| 12 | * NOTIFY BROADCOM AND DISCONTINUE ALL USE OF THE SOFTWARE. |
|---|
| 13 | * |
|---|
| 14 | * Except as expressly set forth in the Authorized License, |
|---|
| 15 | * |
|---|
| 16 | * 1. This program, including its structure, sequence and organization, constitutes the valuable trade |
|---|
| 17 | * secrets of Broadcom, and you shall use all reasonable efforts to protect the confidentiality thereof, |
|---|
| 18 | * and to use this information only in connection with your use of Broadcom integrated circuit products. |
|---|
| 19 | * |
|---|
| 20 | * 2. TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS" |
|---|
| 21 | * AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES, REPRESENTATIONS OR |
|---|
| 22 | * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO |
|---|
| 23 | * THE SOFTWARE. BROADCOM SPECIFICALLY DISCLAIMS ANY AND ALL IMPLIED WARRANTIES |
|---|
| 24 | * OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, |
|---|
| 25 | * LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION |
|---|
| 26 | * OR CORRESPONDENCE TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING OUT OF |
|---|
| 27 | * USE OR PERFORMANCE OF THE SOFTWARE. |
|---|
| 28 | * |
|---|
| 29 | * 3. TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM OR ITS |
|---|
| 30 | * LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL, INCIDENTAL, SPECIAL, INDIRECT, OR |
|---|
| 31 | * EXEMPLARY DAMAGES WHATSOEVER ARISING OUT OF OR IN ANY WAY RELATING TO YOUR |
|---|
| 32 | * USE OF OR INABILITY TO USE THE SOFTWARE EVEN IF BROADCOM HAS BEEN ADVISED OF |
|---|
| 33 | * THE POSSIBILITY OF SUCH DAMAGES; OR (ii) ANY AMOUNT IN EXCESS OF THE AMOUNT |
|---|
| 34 | * ACTUALLY PAID FOR THE SOFTWARE ITSELF OR U.S. $1, WHICHEVER IS GREATER. THESE |
|---|
| 35 | * LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF |
|---|
| 36 | * ANY LIMITED REMEDY. |
|---|
| 37 | * |
|---|
| 38 | * $brcm_Workfile: bipc_client_test.c $ |
|---|
| 39 | * $brcm_Revision: 1 $ |
|---|
| 40 | * $brcm_Date: 10/4/11 5:44p $ |
|---|
| 41 | * |
|---|
| 42 | * Module Description: |
|---|
| 43 | * |
|---|
| 44 | * Revision History: |
|---|
| 45 | * |
|---|
| 46 | * $brcm_Log: /nexus/lib/ipc/build/bipc_client_test.c $ |
|---|
| 47 | * |
|---|
| 48 | * 1 10/4/11 5:44p vsilyaev |
|---|
| 49 | * SW7425-1364: Reference applicaion IPC and reference server |
|---|
| 50 | * |
|---|
| 51 | *****************************************************************************/ |
|---|
| 52 | #include "bstd.h" |
|---|
| 53 | #include "bkni_multi.h" |
|---|
| 54 | #include "bipc_client.h" |
|---|
| 55 | |
|---|
| 56 | #include "bsspk_decoder.h" |
|---|
| 57 | #include "bsac_session.h" |
|---|
| 58 | #include "bipc_test.h" |
|---|
| 59 | |
|---|
| 60 | BDBG_MODULE(bipc_client_test); |
|---|
| 61 | |
|---|
| 62 | #include "ipc_client.h" |
|---|
| 63 | |
|---|
| 64 | static const bipc_interface_descriptor * const interfaces[] = { |
|---|
| 65 | &bipc_bsac_session_descriptor, |
|---|
| 66 | &bipc_bsspk_decoder_descriptor |
|---|
| 67 | }; |
|---|
| 68 | |
|---|
| 69 | |
|---|
| 70 | int main(int argc, const char *argv[]) |
|---|
| 71 | { |
|---|
| 72 | bipc_t ipc; |
|---|
| 73 | bsac_session_t session, session2; |
|---|
| 74 | bsac_session_client_configuration config; |
|---|
| 75 | bsspk_decoder_t decoder, decoder2; |
|---|
| 76 | int rc; |
|---|
| 77 | bsac_session_client_info info; |
|---|
| 78 | bsspk_decoder_resources resources; |
|---|
| 79 | |
|---|
| 80 | BSTD_UNUSED(argc); |
|---|
| 81 | BSTD_UNUSED(argv); |
|---|
| 82 | BKNI_Init(); |
|---|
| 83 | BDBG_Init(); |
|---|
| 84 | BDBG_LOG(("Start")); |
|---|
| 85 | |
|---|
| 86 | BKNI_Snprintf(config.name.string, sizeof(config.name.string), "%s", argv[0]); |
|---|
| 87 | |
|---|
| 88 | ipc = bipc_client_create(CLIENT_RECV_FD, CLIENT_SEND_FD, interfaces, sizeof(interfaces)/sizeof(*interfaces)); |
|---|
| 89 | BDBG_ASSERT(ipc); |
|---|
| 90 | session = bsac_session_create(ipc, &config); |
|---|
| 91 | BDBG_ASSERT(session); |
|---|
| 92 | rc = bsac_session_get_clientinfo(session, &info); |
|---|
| 93 | BDBG_LOG(("%#x %s(%u)", info.client, info.certificate.data, info.certificate.length)); |
|---|
| 94 | BDBG_ASSERT(rc==0); |
|---|
| 95 | |
|---|
| 96 | decoder = bsspk_decoder_open(ipc); |
|---|
| 97 | BDBG_ASSERT(decoder); |
|---|
| 98 | rc = bsspk_decoder_get_resources(decoder, &resources); |
|---|
| 99 | BDBG_ASSERT(rc==0); |
|---|
| 100 | |
|---|
| 101 | session2 = bsac_session_create(ipc, &config); |
|---|
| 102 | decoder2 = bsspk_decoder_open(ipc); |
|---|
| 103 | |
|---|
| 104 | bsac_session_destroy(session); |
|---|
| 105 | bsspk_decoder_close(decoder); |
|---|
| 106 | bipc_client_destroy(ipc); |
|---|
| 107 | |
|---|
| 108 | close(CLIENT_RECV_FD); |
|---|
| 109 | close(CLIENT_SEND_FD); |
|---|
| 110 | |
|---|
| 111 | BDBG_Uninit(); |
|---|
| 112 | BKNI_Uninit(); |
|---|
| 113 | return 0; |
|---|
| 114 | } |
|---|
| 115 | |
|---|
| 116 | |
|---|
| 117 | |
|---|