1 /* 2 * Access a server offering a compound interface. 3 * 4 * Copyright (C) 2020 Paul Boddie <paul@boddie.org.uk> 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License as 8 * published by the Free Software Foundation; either version 2 of 9 * the License, or (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 * Boston, MA 02110-1301, USA 20 */ 21 22 #include <l4/re/env.h> 23 24 #include <stdio.h> 25 26 #include "calc_client.h" 27 #include "counter_client.h" 28 29 int main(void) 30 { 31 l4_cap_idx_t server = l4re_env_get_cap("server"); 32 33 /* Calculator encapsulation. */ 34 35 client_Calc calc_obj(server); 36 37 /* Counter encapsulation. */ 38 39 client_Counter counter_obj(server); 40 41 /* Call the calculator. */ 42 43 int result; 44 45 /* Invoke the operation via the interface. */ 46 47 calc_obj.add(789, 123, &result); 48 printf("add 789, 123 -> %d\n", result); 49 50 /* Call the counter. */ 51 52 /* Invoke the operation via the interface. */ 53 54 counter_obj.increment(&result); 55 printf("increment -> %d\n", result); 56 57 return 0; 58 }