1 /* 2 * Type representations for interfaces. 3 * 4 * Copyright (C) 2019, 2022 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 #pragma once 23 24 /* General capability type. */ 25 26 #define L4_CAP_TYPE "l4_cap_idx_t" 27 28 /* A flexpage type that can hold extra information (such as the "hot spot"). */ 29 30 #define L4_FPAGE_TYPE "l4_snd_fpage_t" 31 32 /* IPC opcode type. */ 33 34 #define L4_OPCODE_TYPE "l4_uint32_t" 35 #define L4_OPCODE_PADDING_TYPE "l4_uint32_t" 36 37 /* Specifier values. */ 38 39 enum specifier 40 { 41 IN_PARAMETER = 1, 42 OUT_PARAMETER = 2, 43 INOUT_PARAMETER = 3, 44 ANY_PARAMETER = 3, 45 }; 46 47 /* Data class of a parameter. */ 48 49 enum parameter_class 50 { 51 WORD_CLASS = 1, 52 CAP_ITEM = 2, 53 FPAGE_ITEM = 4, 54 ITEM_CLASS = 6, /* all item values combined */ 55 ANY_CLASS = 7, /* WORD_CLASS | ITEM_CLASS */ 56 }; 57 58 /* Component roles. */ 59 60 enum component_role 61 { 62 CLIENT_ROLE, 63 SERVER_ROLE, 64 }; 65 66 /* Function roles. */ 67 68 enum function_role 69 { 70 COMPLETION_ROLE, 71 GENERAL_FUNCTION_ROLE, 72 }; 73 74 /* Role of a parameter in output. */ 75 76 enum parameter_role 77 { 78 SIGNATURE_ROLE, 79 STRUCTURE_ROLE, 80 INVOCATION_ROLE, 81 }; 82 83 /* Role of a name or signature. */ 84 85 enum signature_role 86 { 87 ACCESS_ROLE = 1, 88 DECLARATION_ROLE = 2, 89 DEFINITION_ROLE = 4, 90 MEMBER_ROLE = 8, 91 MEMBER_DECLARATION_ROLE = 10, /* DECLARATION_ROLE | MEMBER_ROLE */ 92 }; 93 94 /* Output language. */ 95 96 enum language 97 { 98 C_LANGUAGE, 99 CPP_LANGUAGE, 100 }; 101 102 /* Include declarations. */ 103 104 struct include 105 { 106 char *filename; 107 struct include *tail; 108 }; 109 110 /* An identifier with a link to other identifiers. */ 111 112 struct identifier 113 { 114 char *identifier; 115 struct identifier *tail; 116 }; 117 118 /* A single parameter description linking to other parameters. */ 119 120 struct parameter 121 { 122 enum specifier specifier; 123 enum parameter_class cls; 124 struct identifier *identifiers; 125 struct parameter *tail; 126 }; 127 128 /* A single signature description linking to other signatures. */ 129 130 struct signature 131 { 132 char *qualifier; 133 char *operation; 134 struct parameter *parameters; 135 struct attribute *attributes; 136 struct signature *tail; 137 }; 138 139 /* A single attribute description linking to other attributes. */ 140 141 struct attribute 142 { 143 char *attribute; 144 struct identifier *identifiers; 145 struct attribute *tail; 146 }; 147 148 /* A single interface description linking to other interfaces. */ 149 150 struct interface 151 { 152 char *name; 153 struct signature *signatures; 154 struct attribute *attributes; 155 struct include *includes; 156 struct interface *tail; 157 };