Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 1 | /** |
| 2 | * @file printer/info.c |
| 3 | * @author Michal Vasko <mvasko@cesnet.cz> |
| 4 | * @brief INFO printer for libyang data model structure |
| 5 | * |
| 6 | * Copyright (c) 2015 CESNET, z.s.p.o. |
| 7 | * |
Radek Krejci | 54f6fb3 | 2016-02-24 12:56:39 +0100 | [diff] [blame] | 8 | * This source code is licensed under BSD 3-Clause License (the "License"). |
| 9 | * You may not use this file except in compliance with the License. |
| 10 | * You may obtain a copy of the License at |
Michal Vasko | 8de098c | 2016-02-26 10:00:25 +0100 | [diff] [blame] | 11 | * |
Radek Krejci | 54f6fb3 | 2016-02-24 12:56:39 +0100 | [diff] [blame] | 12 | * https://opensource.org/licenses/BSD-3-Clause |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 13 | */ |
| 14 | |
| 15 | #include <stdlib.h> |
| 16 | #include <stdio.h> |
| 17 | #include <string.h> |
| 18 | #include <assert.h> |
| 19 | |
Radek Krejci | 998a0b8 | 2015-08-17 13:14:36 +0200 | [diff] [blame] | 20 | #include "common.h" |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 21 | #include "printer.h" |
Michal Vasko | 2d162e1 | 2015-09-24 14:33:29 +0200 | [diff] [blame] | 22 | #include "tree_schema.h" |
Radek Krejci | 998a0b8 | 2015-08-17 13:14:36 +0200 | [diff] [blame] | 23 | #include "resolve.h" |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 24 | |
| 25 | #define INDENT_LEN 11 |
| 26 | |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 27 | static void |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 28 | info_print_text(struct lyout *out, const char *text, const char *label) |
Michal Vasko | 2d86ca9 | 2015-07-15 12:08:06 +0200 | [diff] [blame] | 29 | { |
| 30 | const char *ptr1, *ptr2; |
| 31 | int first = 1; |
| 32 | |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 33 | ly_print(out, "%-*s", INDENT_LEN, label); |
Michal Vasko | 2d86ca9 | 2015-07-15 12:08:06 +0200 | [diff] [blame] | 34 | |
| 35 | if (text) { |
| 36 | ptr1 = text; |
| 37 | while (1) { |
| 38 | ptr2 = strchr(ptr1, '\n'); |
| 39 | if (!ptr2) { |
| 40 | if (first) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 41 | ly_print(out, "%s\n", ptr1); |
Michal Vasko | 2d86ca9 | 2015-07-15 12:08:06 +0200 | [diff] [blame] | 42 | first = 0; |
| 43 | } else { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 44 | ly_print(out, "%*s%s\n", INDENT_LEN, "", ptr1); |
Michal Vasko | 2d86ca9 | 2015-07-15 12:08:06 +0200 | [diff] [blame] | 45 | } |
| 46 | break; |
| 47 | } |
| 48 | ++ptr2; |
| 49 | if (first) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 50 | ly_print(out, "%.*s", (int)(ptr2-ptr1), ptr1); |
Michal Vasko | 2d86ca9 | 2015-07-15 12:08:06 +0200 | [diff] [blame] | 51 | first = 0; |
| 52 | } else { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 53 | ly_print(out, "%*s%.*s", INDENT_LEN, "", (int)(ptr2-ptr1), ptr1); |
Michal Vasko | 2d86ca9 | 2015-07-15 12:08:06 +0200 | [diff] [blame] | 54 | } |
| 55 | ptr1 = ptr2; |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | if (first) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 60 | ly_print(out, "\n"); |
Michal Vasko | 2d86ca9 | 2015-07-15 12:08:06 +0200 | [diff] [blame] | 61 | } |
| 62 | } |
| 63 | |
| 64 | static void |
Michal Vasko | 1e62a09 | 2015-12-01 12:27:20 +0100 | [diff] [blame] | 65 | info_print_snode(struct lyout *out, const struct lys_node *parent, const struct lys_node *node, const char *label) |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 66 | { |
| 67 | assert(strlen(label) < INDENT_LEN-1); |
| 68 | |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 69 | ly_print(out, "%-*s", INDENT_LEN, label); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 70 | |
Radek Krejci | 1d82ef6 | 2015-08-07 14:44:40 +0200 | [diff] [blame] | 71 | if (node) { |
| 72 | if (node->name) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 73 | ly_print(out, "%s \"", strnodetype(node->nodetype)); |
Michal Vasko | dcf98e6 | 2016-05-05 17:53:53 +0200 | [diff] [blame] | 74 | if (parent != lys_parent(node)) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 75 | ly_print(out, "%s:", node->module->prefix); |
Michal Vasko | 93df9ea | 2015-08-06 11:32:21 +0200 | [diff] [blame] | 76 | } |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 77 | ly_print(out, "%s\"\n", node->name); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 78 | } else { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 79 | ly_print(out, "%s\n", (node->nodetype == LYS_INPUT ? "input" : "output")); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 80 | } |
Radek Krejci | 1d82ef6 | 2015-08-07 14:44:40 +0200 | [diff] [blame] | 81 | node = node->next; |
| 82 | for (; node; node = node->next) { |
| 83 | if (node->name) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 84 | ly_print(out, "%*s%s \"", INDENT_LEN, "", strnodetype(node->nodetype)); |
Michal Vasko | dcf98e6 | 2016-05-05 17:53:53 +0200 | [diff] [blame] | 85 | if (parent != lys_parent(node)) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 86 | ly_print(out, "%s:", node->module->prefix); |
Michal Vasko | 93df9ea | 2015-08-06 11:32:21 +0200 | [diff] [blame] | 87 | } |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 88 | ly_print(out, "%s\"\n", node->name); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 89 | } else { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 90 | ly_print(out, "%*s%s\n", INDENT_LEN, "", (node->nodetype == LYS_INPUT ? "input" : "output")); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 91 | } |
| 92 | } |
| 93 | } else { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 94 | ly_print(out, "\n"); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 95 | } |
| 96 | } |
| 97 | |
| 98 | static void |
Radek Krejci | 4372b4e | 2016-04-14 17:42:16 +0200 | [diff] [blame] | 99 | info_print_flags(struct lyout *out, uint16_t flags, uint16_t mask, int is_list) |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 100 | { |
Radek Krejci | 1574a8d | 2015-08-03 14:16:52 +0200 | [diff] [blame] | 101 | if (mask & LYS_CONFIG_MASK) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 102 | ly_print(out, "%-*s", INDENT_LEN, "Config: "); |
Radek Krejci | 1574a8d | 2015-08-03 14:16:52 +0200 | [diff] [blame] | 103 | if (flags & LYS_CONFIG_R) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 104 | ly_print(out, "read-only\n"); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 105 | } else { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 106 | ly_print(out, "read-write\n"); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 107 | } |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 108 | } |
| 109 | |
Radek Krejci | 1574a8d | 2015-08-03 14:16:52 +0200 | [diff] [blame] | 110 | if (mask & LYS_STATUS_MASK) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 111 | ly_print(out, "%-*s", INDENT_LEN, "Status: "); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 112 | |
Radek Krejci | 1574a8d | 2015-08-03 14:16:52 +0200 | [diff] [blame] | 113 | if (flags & LYS_STATUS_DEPRC) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 114 | ly_print(out, "deprecated\n"); |
Radek Krejci | 1574a8d | 2015-08-03 14:16:52 +0200 | [diff] [blame] | 115 | } else if (flags & LYS_STATUS_OBSLT) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 116 | ly_print(out, "obsolete\n"); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 117 | } else { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 118 | ly_print(out, "current\n"); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 119 | } |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 120 | } |
| 121 | |
Radek Krejci | 1574a8d | 2015-08-03 14:16:52 +0200 | [diff] [blame] | 122 | if (mask & LYS_MAND_MASK) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 123 | ly_print(out, "%-*s", INDENT_LEN, "Mandatory: "); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 124 | |
Radek Krejci | 1574a8d | 2015-08-03 14:16:52 +0200 | [diff] [blame] | 125 | if (flags & LYS_MAND_TRUE) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 126 | ly_print(out, "yes\n"); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 127 | } else { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 128 | ly_print(out, "no\n"); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 129 | } |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 130 | } |
| 131 | |
Radek Krejci | 1574a8d | 2015-08-03 14:16:52 +0200 | [diff] [blame] | 132 | if (is_list && (mask & LYS_USERORDERED)) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 133 | ly_print(out, "%-*s", INDENT_LEN, "Order: "); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 134 | |
Radek Krejci | 1574a8d | 2015-08-03 14:16:52 +0200 | [diff] [blame] | 135 | if (flags & LYS_USERORDERED) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 136 | ly_print(out, "user-ordered\n"); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 137 | } else { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 138 | ly_print(out, "system-ordered\n"); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 139 | } |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 140 | } |
| 141 | |
Radek Krejci | 1574a8d | 2015-08-03 14:16:52 +0200 | [diff] [blame] | 142 | if (!is_list && (mask & LYS_FENABLED)) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 143 | ly_print(out, "%-*s", INDENT_LEN, "Enabled: "); |
Michal Vasko | 46bcb1e | 2015-07-15 12:09:57 +0200 | [diff] [blame] | 144 | |
Radek Krejci | 1574a8d | 2015-08-03 14:16:52 +0200 | [diff] [blame] | 145 | if (flags & LYS_FENABLED) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 146 | ly_print(out, "yes\n"); |
Michal Vasko | 46bcb1e | 2015-07-15 12:09:57 +0200 | [diff] [blame] | 147 | } else { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 148 | ly_print(out, "no\n"); |
Michal Vasko | 46bcb1e | 2015-07-15 12:09:57 +0200 | [diff] [blame] | 149 | } |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 150 | } |
| 151 | } |
| 152 | |
| 153 | static void |
Radek Krejci | 9ff0a92 | 2016-07-14 13:08:05 +0200 | [diff] [blame] | 154 | info_print_if_feature(struct lyout *out, const struct lys_module *module, |
| 155 | struct lys_iffeature *iffeature, uint8_t iffeature_size) |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 156 | { |
| 157 | int i; |
| 158 | |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 159 | ly_print(out, "%-*s", INDENT_LEN, "If-feats: "); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 160 | |
Michal Vasko | c5c26b0 | 2016-06-29 11:10:29 +0200 | [diff] [blame] | 161 | if (iffeature_size) { |
Radek Krejci | 9ff0a92 | 2016-07-14 13:08:05 +0200 | [diff] [blame] | 162 | ly_print_iffeature(out, module, &iffeature[0]); |
| 163 | ly_print(out, "\n"); |
Michal Vasko | c5c26b0 | 2016-06-29 11:10:29 +0200 | [diff] [blame] | 164 | for (i = 1; i < iffeature_size; ++i) { |
Radek Krejci | 9ff0a92 | 2016-07-14 13:08:05 +0200 | [diff] [blame] | 165 | ly_print(out, "%*s", INDENT_LEN, ""); |
| 166 | ly_print_iffeature(out, module, &iffeature[i]); |
| 167 | ly_print(out, "\n"); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 168 | } |
| 169 | } else { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 170 | ly_print(out, "\n"); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 171 | } |
| 172 | } |
| 173 | |
| 174 | static void |
Michal Vasko | 1e62a09 | 2015-12-01 12:27:20 +0100 | [diff] [blame] | 175 | info_print_when(struct lyout *out, const struct lys_when *when) |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 176 | { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 177 | ly_print(out, "%-*s", INDENT_LEN, "When: "); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 178 | if (when) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 179 | ly_print(out, "%s\n", when->cond); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 180 | } else { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 181 | ly_print(out, "\n"); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 182 | } |
| 183 | } |
| 184 | |
| 185 | static void |
Michal Vasko | 1e62a09 | 2015-12-01 12:27:20 +0100 | [diff] [blame] | 186 | info_print_must(struct lyout *out, const struct lys_restr *must, uint8_t must_size) |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 187 | { |
| 188 | int i; |
| 189 | |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 190 | ly_print(out, "%-*s", INDENT_LEN, "Must: "); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 191 | |
| 192 | if (must_size) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 193 | ly_print(out, "%s\n", must[0].expr); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 194 | for (i = 1; i < must_size; ++i) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 195 | ly_print(out, "%*s%s\n", INDENT_LEN, "", must[i].expr); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 196 | } |
| 197 | } else { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 198 | ly_print(out, "\n"); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 199 | } |
| 200 | } |
| 201 | |
| 202 | static void |
Michal Vasko | 1e62a09 | 2015-12-01 12:27:20 +0100 | [diff] [blame] | 203 | info_print_typedef(struct lyout *out, const struct lys_tpdf *tpdf, uint8_t tpdf_size) |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 204 | { |
| 205 | int i; |
| 206 | |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 207 | ly_print(out, "%-*s", INDENT_LEN, "Typedefs: "); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 208 | |
| 209 | if (tpdf_size) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 210 | ly_print(out, "%s\n", tpdf[0].name); |
Michal Vasko | 593695e | 2015-07-15 10:44:52 +0200 | [diff] [blame] | 211 | for (i = 1; i < tpdf_size; ++i) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 212 | ly_print(out, "%*s%s", INDENT_LEN, "", tpdf[i].name); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 213 | } |
| 214 | } else { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 215 | ly_print(out, "\n"); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 216 | } |
| 217 | } |
| 218 | |
| 219 | static void |
Michal Vasko | 1e62a09 | 2015-12-01 12:27:20 +0100 | [diff] [blame] | 220 | info_print_typedef_with_include(struct lyout *out, const struct lys_module *mod) |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 221 | { |
Michal Vasko | 10e8097 | 2015-07-24 12:02:14 +0200 | [diff] [blame] | 222 | int i, j, first = 1; |
| 223 | |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 224 | ly_print(out, "%-*s", INDENT_LEN, "Typedefs: "); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 225 | |
| 226 | if (mod->tpdf_size) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 227 | ly_print(out, "%s\n", mod->tpdf[0].name); |
Michal Vasko | 10e8097 | 2015-07-24 12:02:14 +0200 | [diff] [blame] | 228 | first = 0; |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 229 | |
Radek Krejci | 24a05b0 | 2015-08-13 10:03:46 +0200 | [diff] [blame] | 230 | for (i = 1; i < mod->tpdf_size; ++i) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 231 | ly_print(out, "%*s%s\n", INDENT_LEN, "", mod->tpdf[i].name); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 232 | } |
| 233 | } |
| 234 | |
| 235 | for (i = 0; i < mod->inc_size; ++i) { |
Michal Vasko | 10e8097 | 2015-07-24 12:02:14 +0200 | [diff] [blame] | 236 | if (mod->inc[i].submodule->tpdf_size) { |
| 237 | if (first) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 238 | ly_print(out, "%s\n", mod->inc[i].submodule->tpdf[0].name); |
Michal Vasko | 10e8097 | 2015-07-24 12:02:14 +0200 | [diff] [blame] | 239 | j = 1; |
| 240 | } else { |
| 241 | j = 0; |
| 242 | } |
| 243 | first = 0; |
| 244 | |
| 245 | for (; j < mod->inc[i].submodule->tpdf_size; ++j) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 246 | ly_print(out, "%*s%s\n", INDENT_LEN, "", mod->inc[i].submodule->tpdf[j].name); |
Michal Vasko | 10e8097 | 2015-07-24 12:02:14 +0200 | [diff] [blame] | 247 | } |
| 248 | } |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 249 | } |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 250 | |
| 251 | if (first) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 252 | ly_print(out, "\n"); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 253 | } |
| 254 | } |
| 255 | |
| 256 | static void |
Michal Vasko | 1e62a09 | 2015-12-01 12:27:20 +0100 | [diff] [blame] | 257 | info_print_type_detail(struct lyout *out, const struct lys_type *type, int uni) |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 258 | { |
Michal Vasko | 7df7f14 | 2015-07-15 12:10:53 +0200 | [diff] [blame] | 259 | int i; |
| 260 | |
Michal Vasko | 2e74dc3 | 2015-08-04 08:58:34 +0200 | [diff] [blame] | 261 | if (uni) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 262 | ly_print(out, " "); |
Michal Vasko | 2e74dc3 | 2015-08-04 08:58:34 +0200 | [diff] [blame] | 263 | } |
| 264 | |
Michal Vasko | 7df7f14 | 2015-07-15 12:10:53 +0200 | [diff] [blame] | 265 | switch (type->base) { |
| 266 | case LY_TYPE_DER: |
Radek Krejci | 25b9fd3 | 2015-08-10 15:06:07 +0200 | [diff] [blame] | 267 | /* unused, but what the hack */ |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 268 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Base type: ", "derived"); |
Michal Vasko | 7df7f14 | 2015-07-15 12:10:53 +0200 | [diff] [blame] | 269 | break; |
| 270 | case LY_TYPE_BINARY: |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 271 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Base type: ", "binary"); |
Michal Vasko | 2e74dc3 | 2015-08-04 08:58:34 +0200 | [diff] [blame] | 272 | if (!uni) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 273 | info_print_text(out, (type->info.binary.length ? type->info.binary.length->expr : NULL), "Length: "); |
Michal Vasko | 2e74dc3 | 2015-08-04 08:58:34 +0200 | [diff] [blame] | 274 | } |
Michal Vasko | 7df7f14 | 2015-07-15 12:10:53 +0200 | [diff] [blame] | 275 | break; |
| 276 | case LY_TYPE_BITS: |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 277 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Base type: ", "bits"); |
Michal Vasko | 7df7f14 | 2015-07-15 12:10:53 +0200 | [diff] [blame] | 278 | |
| 279 | assert(type->info.bits.count); |
Michal Vasko | 2e74dc3 | 2015-08-04 08:58:34 +0200 | [diff] [blame] | 280 | if (!uni) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 281 | ly_print(out, "%-*s%u %s\n", INDENT_LEN, "Bits: ", type->info.bits.bit[0].pos, type->info.bits.bit[0].name); |
Michal Vasko | 2e74dc3 | 2015-08-04 08:58:34 +0200 | [diff] [blame] | 282 | for (i = 1; i < type->info.bits.count; ++i) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 283 | ly_print(out, "%*s%u %s\n", INDENT_LEN, "", type->info.bits.bit[i].pos, type->info.bits.bit[i].name); |
Michal Vasko | 2e74dc3 | 2015-08-04 08:58:34 +0200 | [diff] [blame] | 284 | } |
Michal Vasko | 7df7f14 | 2015-07-15 12:10:53 +0200 | [diff] [blame] | 285 | } |
| 286 | |
| 287 | break; |
| 288 | case LY_TYPE_BOOL: |
Radek Krejci | 8c2f178 | 2016-06-24 11:21:57 +0200 | [diff] [blame] | 289 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Base type: ", "boolean"); |
Michal Vasko | 7df7f14 | 2015-07-15 12:10:53 +0200 | [diff] [blame] | 290 | break; |
| 291 | case LY_TYPE_DEC64: |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 292 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Base type: ", "decimal64"); |
Michal Vasko | 2e74dc3 | 2015-08-04 08:58:34 +0200 | [diff] [blame] | 293 | if (!uni) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 294 | info_print_text(out, (type->info.dec64.range ? type->info.dec64.range->expr : NULL), "Range: "); |
Michal Vasko | 2e74dc3 | 2015-08-04 08:58:34 +0200 | [diff] [blame] | 295 | assert(type->info.dec64.dig); |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 296 | ly_print(out, "%-*s%u\n", INDENT_LEN, "Frac dig: ", type->info.dec64.dig); |
Michal Vasko | 2e74dc3 | 2015-08-04 08:58:34 +0200 | [diff] [blame] | 297 | } |
Michal Vasko | 7df7f14 | 2015-07-15 12:10:53 +0200 | [diff] [blame] | 298 | break; |
| 299 | case LY_TYPE_EMPTY: |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 300 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Base type: ", "empty"); |
Michal Vasko | 7df7f14 | 2015-07-15 12:10:53 +0200 | [diff] [blame] | 301 | break; |
| 302 | case LY_TYPE_ENUM: |
Radek Krejci | 8c2f178 | 2016-06-24 11:21:57 +0200 | [diff] [blame] | 303 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Base type: ", "enumeration"); |
Michal Vasko | 7df7f14 | 2015-07-15 12:10:53 +0200 | [diff] [blame] | 304 | |
| 305 | assert(type->info.enums.count); |
Michal Vasko | 2e74dc3 | 2015-08-04 08:58:34 +0200 | [diff] [blame] | 306 | if (!uni) { |
Radek Krejci | fc8d539 | 2016-06-24 11:22:44 +0200 | [diff] [blame] | 307 | ly_print(out, "%-*s%s (%d)\n", INDENT_LEN, "Values: ", |
| 308 | type->info.enums.enm[0].name, type->info.enums.enm[0].value); |
Michal Vasko | 2e74dc3 | 2015-08-04 08:58:34 +0200 | [diff] [blame] | 309 | for (i = 1; i < type->info.enums.count; ++i) { |
Radek Krejci | fc8d539 | 2016-06-24 11:22:44 +0200 | [diff] [blame] | 310 | ly_print(out, "%*s%s (%d)\n", INDENT_LEN, "", |
| 311 | type->info.enums.enm[i].name, type->info.enums.enm[i].value); |
Michal Vasko | 2e74dc3 | 2015-08-04 08:58:34 +0200 | [diff] [blame] | 312 | } |
Michal Vasko | 7df7f14 | 2015-07-15 12:10:53 +0200 | [diff] [blame] | 313 | } |
| 314 | |
| 315 | break; |
| 316 | case LY_TYPE_IDENT: |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 317 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Base type: ", "identityref"); |
Michal Vasko | 7df7f14 | 2015-07-15 12:10:53 +0200 | [diff] [blame] | 318 | assert(type->info.ident.ref); |
Michal Vasko | 2e74dc3 | 2015-08-04 08:58:34 +0200 | [diff] [blame] | 319 | if (!uni) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 320 | info_print_text(out, type->info.ident.ref->name, "Identity: "); |
Michal Vasko | 2e74dc3 | 2015-08-04 08:58:34 +0200 | [diff] [blame] | 321 | } |
Michal Vasko | 7df7f14 | 2015-07-15 12:10:53 +0200 | [diff] [blame] | 322 | break; |
| 323 | case LY_TYPE_INST: |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 324 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Base type: ", "instance-identifier"); |
Michal Vasko | 2e74dc3 | 2015-08-04 08:58:34 +0200 | [diff] [blame] | 325 | if (!uni) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 326 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Required: ", (type->info.inst.req < 1 ? "no" : "yes")); |
Michal Vasko | 2e74dc3 | 2015-08-04 08:58:34 +0200 | [diff] [blame] | 327 | } |
Michal Vasko | 7df7f14 | 2015-07-15 12:10:53 +0200 | [diff] [blame] | 328 | break; |
| 329 | case LY_TYPE_INT8: |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 330 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Base type: ", "int8"); |
Michal Vasko | 7df7f14 | 2015-07-15 12:10:53 +0200 | [diff] [blame] | 331 | goto int_range; |
| 332 | case LY_TYPE_INT16: |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 333 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Base type: ", "int16"); |
Michal Vasko | 7df7f14 | 2015-07-15 12:10:53 +0200 | [diff] [blame] | 334 | goto int_range; |
| 335 | case LY_TYPE_INT32: |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 336 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Base type: ", "int32"); |
Michal Vasko | 7df7f14 | 2015-07-15 12:10:53 +0200 | [diff] [blame] | 337 | goto int_range; |
| 338 | case LY_TYPE_INT64: |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 339 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Base type: ", "int64"); |
Michal Vasko | 7df7f14 | 2015-07-15 12:10:53 +0200 | [diff] [blame] | 340 | goto int_range; |
| 341 | case LY_TYPE_UINT8: |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 342 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Base type: ", "uint8"); |
Michal Vasko | 7df7f14 | 2015-07-15 12:10:53 +0200 | [diff] [blame] | 343 | goto int_range; |
| 344 | case LY_TYPE_UINT16: |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 345 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Base type: ", "uint16"); |
Michal Vasko | 7df7f14 | 2015-07-15 12:10:53 +0200 | [diff] [blame] | 346 | goto int_range; |
| 347 | case LY_TYPE_UINT32: |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 348 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Base type: ", "uint32"); |
Michal Vasko | 7df7f14 | 2015-07-15 12:10:53 +0200 | [diff] [blame] | 349 | goto int_range; |
| 350 | case LY_TYPE_UINT64: |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 351 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Base type: ", "uint64"); |
Michal Vasko | 7df7f14 | 2015-07-15 12:10:53 +0200 | [diff] [blame] | 352 | |
| 353 | int_range: |
Michal Vasko | 2e74dc3 | 2015-08-04 08:58:34 +0200 | [diff] [blame] | 354 | if (!uni) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 355 | info_print_text(out, (type->info.num.range ? type->info.num.range->expr : NULL), "Range: "); |
Michal Vasko | 2e74dc3 | 2015-08-04 08:58:34 +0200 | [diff] [blame] | 356 | } |
Michal Vasko | 7df7f14 | 2015-07-15 12:10:53 +0200 | [diff] [blame] | 357 | break; |
| 358 | case LY_TYPE_LEAFREF: |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 359 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Base type: ", "leafref"); |
Michal Vasko | 2e74dc3 | 2015-08-04 08:58:34 +0200 | [diff] [blame] | 360 | if (!uni) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 361 | info_print_text(out, type->info.lref.path, "Path: "); |
Michal Vasko | 2e74dc3 | 2015-08-04 08:58:34 +0200 | [diff] [blame] | 362 | } |
Michal Vasko | 7df7f14 | 2015-07-15 12:10:53 +0200 | [diff] [blame] | 363 | break; |
| 364 | case LY_TYPE_STRING: |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 365 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Base type: ", "string"); |
Michal Vasko | 2e74dc3 | 2015-08-04 08:58:34 +0200 | [diff] [blame] | 366 | if (!uni) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 367 | info_print_text(out, (type->info.str.length ? type->info.str.length->expr : NULL), "Length: "); |
Michal Vasko | 7df7f14 | 2015-07-15 12:10:53 +0200 | [diff] [blame] | 368 | |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 369 | ly_print(out, "%-*s", INDENT_LEN, "Pattern: "); |
Michal Vasko | 2e74dc3 | 2015-08-04 08:58:34 +0200 | [diff] [blame] | 370 | if (type->info.str.pat_count) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 371 | ly_print(out, "%s\n", type->info.str.patterns[0].expr); |
Michal Vasko | 2e74dc3 | 2015-08-04 08:58:34 +0200 | [diff] [blame] | 372 | for (i = 1; i < type->info.str.pat_count; ++i) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 373 | ly_print(out, "%*s%s\n", INDENT_LEN, "", type->info.str.patterns[i].expr); |
Michal Vasko | 2e74dc3 | 2015-08-04 08:58:34 +0200 | [diff] [blame] | 374 | } |
| 375 | } else { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 376 | ly_print(out, "\n"); |
Michal Vasko | 7df7f14 | 2015-07-15 12:10:53 +0200 | [diff] [blame] | 377 | } |
Michal Vasko | 7df7f14 | 2015-07-15 12:10:53 +0200 | [diff] [blame] | 378 | } |
| 379 | |
| 380 | break; |
| 381 | case LY_TYPE_UNION: |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 382 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Base type: ", "union"); |
Michal Vasko | 7df7f14 | 2015-07-15 12:10:53 +0200 | [diff] [blame] | 383 | |
Michal Vasko | 2e74dc3 | 2015-08-04 08:58:34 +0200 | [diff] [blame] | 384 | if (!uni) { |
| 385 | for (i = 0; i < type->info.uni.count; ++i) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 386 | info_print_type_detail(out, &type->info.uni.types[i], 1); |
Michal Vasko | 2e74dc3 | 2015-08-04 08:58:34 +0200 | [diff] [blame] | 387 | } |
Michal Vasko | 7df7f14 | 2015-07-15 12:10:53 +0200 | [diff] [blame] | 388 | } |
Michal Vasko | 7df7f14 | 2015-07-15 12:10:53 +0200 | [diff] [blame] | 389 | break; |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 390 | } |
| 391 | |
Michal Vasko | 2e74dc3 | 2015-08-04 08:58:34 +0200 | [diff] [blame] | 392 | if (uni) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 393 | ly_print(out, " "); |
Michal Vasko | 2e74dc3 | 2015-08-04 08:58:34 +0200 | [diff] [blame] | 394 | } |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 395 | ly_print(out, "%-*s", INDENT_LEN, "Superior: "); |
Michal Vasko | 7df7f14 | 2015-07-15 12:10:53 +0200 | [diff] [blame] | 396 | if (type->der) { |
Michal Vasko | 1dca688 | 2015-10-22 14:29:42 +0200 | [diff] [blame] | 397 | if (type->module_name) { |
| 398 | ly_print(out, "%s:", type->module_name); |
Michal Vasko | 7df7f14 | 2015-07-15 12:10:53 +0200 | [diff] [blame] | 399 | } |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 400 | ly_print(out, "%s\n", type->der->name); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 401 | } else { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 402 | ly_print(out, "\n"); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 403 | } |
| 404 | } |
| 405 | |
| 406 | static void |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 407 | info_print_list_constr(struct lyout *out, uint32_t min, uint32_t max) |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 408 | { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 409 | ly_print(out, "%-*s%u..", INDENT_LEN, "Elements: ", min); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 410 | if (max) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 411 | ly_print(out, "%u\n", max); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 412 | } else { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 413 | ly_print(out, "unbounded\n"); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 414 | } |
| 415 | } |
| 416 | |
| 417 | static void |
Michal Vasko | 1e62a09 | 2015-12-01 12:27:20 +0100 | [diff] [blame] | 418 | info_print_keys(struct lyout *out, struct lys_node_leaf ** const keys, uint8_t keys_size) |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 419 | { |
| 420 | int i; |
| 421 | |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 422 | ly_print(out, "%-*s", INDENT_LEN, "Keys: "); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 423 | |
| 424 | if (keys_size) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 425 | ly_print(out, "%s\n", keys[0]->name); |
Michal Vasko | 593695e | 2015-07-15 10:44:52 +0200 | [diff] [blame] | 426 | for (i = 1; i < keys_size; ++i) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 427 | ly_print(out, "%*s%s\n", INDENT_LEN, "", keys[i]->name); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 428 | } |
| 429 | } else { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 430 | ly_print(out, "\n"); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 431 | } |
| 432 | } |
| 433 | |
| 434 | static void |
Michal Vasko | 1e62a09 | 2015-12-01 12:27:20 +0100 | [diff] [blame] | 435 | info_print_unique(struct lyout *out, const struct lys_unique *unique, uint8_t unique_size) |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 436 | { |
| 437 | int i, j; |
| 438 | |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 439 | ly_print(out, "%-*s", INDENT_LEN, "Unique: "); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 440 | |
| 441 | if (unique_size) { |
Radek Krejci | 581ce77 | 2015-11-10 17:22:40 +0100 | [diff] [blame] | 442 | ly_print(out, "%s\n", unique[0].expr[0]); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 443 | for (i = 0; i < unique_size; ++i) { |
Radek Krejci | 581ce77 | 2015-11-10 17:22:40 +0100 | [diff] [blame] | 444 | for (j = (!i ? 1 : 0); j < unique[i].expr_size; ++j) { |
| 445 | ly_print(out, "%*s%s\n", INDENT_LEN, "", unique[i].expr[j]); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 446 | } |
| 447 | } |
| 448 | } else { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 449 | ly_print(out, "\n"); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 450 | } |
| 451 | } |
| 452 | |
| 453 | static void |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 454 | info_print_nacmext(struct lyout *out, uint8_t nacm) |
Michal Vasko | c96eaf0 | 2015-07-08 11:30:15 +0200 | [diff] [blame] | 455 | { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 456 | ly_print(out, "%-*s", INDENT_LEN, "NACM: "); |
Michal Vasko | c96eaf0 | 2015-07-08 11:30:15 +0200 | [diff] [blame] | 457 | |
| 458 | if (nacm) { |
Radek Krejci | 1574a8d | 2015-08-03 14:16:52 +0200 | [diff] [blame] | 459 | if (nacm & LYS_NACM_DENYW) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 460 | ly_print(out, "default-deny-write\n"); |
Radek Krejci | 1574a8d | 2015-08-03 14:16:52 +0200 | [diff] [blame] | 461 | } else if (nacm & LYS_NACM_DENYA) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 462 | ly_print(out, "default-deny-all\n"); |
Michal Vasko | c96eaf0 | 2015-07-08 11:30:15 +0200 | [diff] [blame] | 463 | } |
| 464 | } else { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 465 | ly_print(out, "\n"); |
Michal Vasko | c96eaf0 | 2015-07-08 11:30:15 +0200 | [diff] [blame] | 466 | } |
| 467 | } |
| 468 | |
| 469 | static void |
Michal Vasko | 1e62a09 | 2015-12-01 12:27:20 +0100 | [diff] [blame] | 470 | info_print_revision(struct lyout *out, const struct lys_revision *rev, uint8_t rev_size) |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 471 | { |
| 472 | int i; |
| 473 | |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 474 | ly_print(out, "%-*s", INDENT_LEN, "Revisions: "); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 475 | |
| 476 | if (rev_size) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 477 | ly_print(out, "%s\n", rev[0].date); |
Michal Vasko | 593695e | 2015-07-15 10:44:52 +0200 | [diff] [blame] | 478 | for (i = 1; i < rev_size; ++i) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 479 | ly_print(out, "%*s%s\n", INDENT_LEN, "", rev[i].date); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 480 | } |
| 481 | } else { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 482 | ly_print(out, "\n"); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 483 | } |
| 484 | } |
| 485 | |
| 486 | static void |
Michal Vasko | 1e62a09 | 2015-12-01 12:27:20 +0100 | [diff] [blame] | 487 | info_print_import_with_include(struct lyout *out, const struct lys_module *mod) |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 488 | { |
| 489 | int first = 1, i, j; |
| 490 | |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 491 | ly_print(out, "%-*s", INDENT_LEN, "Imports: "); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 492 | if (mod->imp_size) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 493 | ly_print(out, "%s:%s\n", mod->imp[0].prefix, mod->imp[0].module->name); |
Michal Vasko | 101e00d | 2015-07-08 10:08:27 +0200 | [diff] [blame] | 494 | i = 1; |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 495 | first = 0; |
| 496 | |
| 497 | for (; i < mod->imp_size; ++i) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 498 | ly_print(out, "%*s%s:%s\n", INDENT_LEN, "", mod->imp[i].prefix, mod->imp[i].module->name); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 499 | } |
| 500 | } |
| 501 | |
| 502 | for (j = 0; j < mod->inc_size; ++j) { |
| 503 | if (mod->inc[j].submodule->imp_size) { |
| 504 | if (first) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 505 | ly_print(out, "%s:%s\n", |
Michal Vasko | 192baa5 | 2015-07-14 15:52:00 +0200 | [diff] [blame] | 506 | mod->inc[j].submodule->imp[0].prefix, mod->inc[j].submodule->imp[0].module->name); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 507 | i = 1; |
| 508 | } else { |
| 509 | i = 0; |
| 510 | } |
| 511 | first = 0; |
| 512 | |
| 513 | for (; i < mod->inc[j].submodule->imp_size; ++i) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 514 | ly_print(out, "%*s%s:%s\n", INDENT_LEN, "", |
Michal Vasko | 192baa5 | 2015-07-14 15:52:00 +0200 | [diff] [blame] | 515 | mod->inc[j].submodule->imp[i].prefix, mod->inc[j].submodule->imp[i].module->name); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 516 | } |
| 517 | } |
| 518 | } |
| 519 | |
| 520 | if (first) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 521 | ly_print(out, "\n"); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 522 | } |
| 523 | } |
| 524 | |
| 525 | static void |
Michal Vasko | 1e62a09 | 2015-12-01 12:27:20 +0100 | [diff] [blame] | 526 | info_print_include(struct lyout *out, const struct lys_module *mod) |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 527 | { |
| 528 | int first = 1, i; |
| 529 | |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 530 | ly_print(out, "%-*s", INDENT_LEN, "Includes: "); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 531 | if (mod->inc_size) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 532 | ly_print(out, "%s\n", mod->inc[0].submodule->name); |
Michal Vasko | 101e00d | 2015-07-08 10:08:27 +0200 | [diff] [blame] | 533 | i = 1; |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 534 | first = 0; |
| 535 | |
| 536 | for (; i < mod->inc_size; ++i) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 537 | ly_print(out, "%*s%s\n", INDENT_LEN, "", mod->inc[i].submodule->name); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 538 | } |
| 539 | } |
| 540 | |
| 541 | if (first) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 542 | ly_print(out, "\n"); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 543 | } |
| 544 | } |
| 545 | |
| 546 | static void |
Michal Vasko | 1e62a09 | 2015-12-01 12:27:20 +0100 | [diff] [blame] | 547 | info_print_augment(struct lyout *out, const struct lys_module *mod) |
Michal Vasko | e00908c | 2015-07-14 15:52:45 +0200 | [diff] [blame] | 548 | { |
| 549 | int first = 1, i; |
| 550 | |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 551 | ly_print(out, "%-*s", INDENT_LEN, "Augments: "); |
Michal Vasko | e00908c | 2015-07-14 15:52:45 +0200 | [diff] [blame] | 552 | if (mod->augment_size) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 553 | ly_print(out, "\"%s\"\n", mod->augment[0].target_name); |
Michal Vasko | e00908c | 2015-07-14 15:52:45 +0200 | [diff] [blame] | 554 | i = 1; |
| 555 | first = 0; |
| 556 | |
| 557 | for (; i < mod->augment_size; ++i) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 558 | ly_print(out, "%*s\"%s\"\n", INDENT_LEN, "", mod->augment[i].target_name); |
Michal Vasko | e00908c | 2015-07-14 15:52:45 +0200 | [diff] [blame] | 559 | } |
| 560 | } |
| 561 | |
| 562 | if (first) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 563 | ly_print(out, "\n"); |
Michal Vasko | e00908c | 2015-07-14 15:52:45 +0200 | [diff] [blame] | 564 | } |
| 565 | } |
| 566 | |
| 567 | static void |
Michal Vasko | 1e62a09 | 2015-12-01 12:27:20 +0100 | [diff] [blame] | 568 | info_print_deviation(struct lyout *out, const struct lys_module *mod) |
Michal Vasko | e00908c | 2015-07-14 15:52:45 +0200 | [diff] [blame] | 569 | { |
| 570 | int first = 1, i; |
| 571 | |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 572 | ly_print(out, "%-*s", INDENT_LEN, "Deviation: "); |
Michal Vasko | e00908c | 2015-07-14 15:52:45 +0200 | [diff] [blame] | 573 | if (mod->deviation_size) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 574 | ly_print(out, "\"%s\"\n", mod->deviation[0].target_name); |
Michal Vasko | e00908c | 2015-07-14 15:52:45 +0200 | [diff] [blame] | 575 | i = 1; |
| 576 | first = 0; |
| 577 | |
| 578 | for (; i < mod->deviation_size; ++i) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 579 | ly_print(out, "%*s\"%s\"\n", INDENT_LEN, "", mod->deviation[i].target_name); |
Michal Vasko | e00908c | 2015-07-14 15:52:45 +0200 | [diff] [blame] | 580 | } |
| 581 | } |
| 582 | |
| 583 | if (first) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 584 | ly_print(out, "\n"); |
Michal Vasko | e00908c | 2015-07-14 15:52:45 +0200 | [diff] [blame] | 585 | } |
| 586 | } |
| 587 | |
| 588 | static void |
Michal Vasko | 1e62a09 | 2015-12-01 12:27:20 +0100 | [diff] [blame] | 589 | info_print_ident_with_include(struct lyout *out, const struct lys_module *mod) |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 590 | { |
| 591 | int first = 1, i, j; |
| 592 | |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 593 | ly_print(out, "%-*s", INDENT_LEN, "Idents: "); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 594 | if (mod->ident_size) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 595 | ly_print(out, "%s\n", mod->ident[0].name); |
Michal Vasko | 101e00d | 2015-07-08 10:08:27 +0200 | [diff] [blame] | 596 | i = 1; |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 597 | first = 0; |
| 598 | |
| 599 | for (; i < (signed)mod->ident_size; ++i) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 600 | ly_print(out, "%*s%s\n", INDENT_LEN, "", mod->ident[i].name); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 601 | } |
| 602 | } |
| 603 | |
| 604 | for (j = 0; j < mod->inc_size; ++j) { |
| 605 | if (mod->inc[j].submodule->ident_size) { |
| 606 | if (first) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 607 | ly_print(out, "%s\n", mod->inc[j].submodule->ident[0].name); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 608 | i = 1; |
| 609 | } else { |
| 610 | i = 0; |
| 611 | } |
| 612 | first = 0; |
| 613 | |
| 614 | for (; i < (signed)mod->inc[j].submodule->ident_size; ++i) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 615 | ly_print(out, "%*s%s\n", INDENT_LEN, "", mod->inc[j].submodule->ident[i].name); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 616 | } |
| 617 | } |
| 618 | } |
| 619 | |
| 620 | if (first) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 621 | ly_print(out, "\n"); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 622 | } |
| 623 | } |
| 624 | |
| 625 | static void |
Michal Vasko | 1e62a09 | 2015-12-01 12:27:20 +0100 | [diff] [blame] | 626 | info_print_features_with_include(struct lyout *out, const struct lys_module *mod) |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 627 | { |
| 628 | int first = 1, i, j; |
| 629 | |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 630 | ly_print(out, "%-*s", INDENT_LEN, "Features: "); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 631 | if (mod->features_size) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 632 | ly_print(out, "%s\n", mod->features[0].name); |
Michal Vasko | 101e00d | 2015-07-08 10:08:27 +0200 | [diff] [blame] | 633 | i = 1; |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 634 | first = 0; |
| 635 | |
| 636 | for (; i < mod->features_size; ++i) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 637 | ly_print(out, "%*s%s\n", INDENT_LEN, "", mod->features[i].name); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 638 | } |
| 639 | } |
| 640 | |
| 641 | for (j = 0; j < mod->inc_size; ++j) { |
| 642 | if (mod->inc[j].submodule->features_size) { |
| 643 | if (first) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 644 | ly_print(out, "%s\n", mod->inc[j].submodule->features[0].name); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 645 | i = 1; |
| 646 | } else { |
| 647 | i = 0; |
| 648 | } |
| 649 | first = 0; |
| 650 | |
| 651 | for (; i < mod->inc[j].submodule->features_size; ++i) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 652 | ly_print(out, "%*s%s\n", INDENT_LEN, "", mod->inc[j].submodule->features[i].name); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 653 | } |
| 654 | } |
| 655 | } |
| 656 | |
| 657 | if (first) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 658 | ly_print(out, "\n"); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 659 | } |
| 660 | } |
| 661 | |
| 662 | static void |
Michal Vasko | 1e62a09 | 2015-12-01 12:27:20 +0100 | [diff] [blame] | 663 | info_print_data_with_include(struct lyout *out, const struct lys_module *mod) |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 664 | |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 665 | { |
Radek Krejci | c071c54 | 2016-01-27 14:57:51 +0100 | [diff] [blame] | 666 | int first = 1; |
Radek Krejci | 1d82ef6 | 2015-08-07 14:44:40 +0200 | [diff] [blame] | 667 | struct lys_node *node; |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 668 | |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 669 | ly_print(out, "%-*s", INDENT_LEN, "Data: "); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 670 | |
| 671 | if (mod->data) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 672 | ly_print(out, "%s \"%s\"\n", strnodetype(mod->data->nodetype), mod->data->name); |
Radek Krejci | 1d82ef6 | 2015-08-07 14:44:40 +0200 | [diff] [blame] | 673 | node = mod->data->next; |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 674 | first = 0; |
| 675 | |
Radek Krejci | 1d82ef6 | 2015-08-07 14:44:40 +0200 | [diff] [blame] | 676 | for (; node; node = node->next) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 677 | ly_print(out, "%*s%s \"%s\"\n", INDENT_LEN, "", strnodetype(node->nodetype), node->name); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 678 | } |
| 679 | } |
| 680 | |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 681 | if (first) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 682 | ly_print(out, "\n"); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 683 | } |
| 684 | } |
| 685 | |
| 686 | static void |
Michal Vasko | 1e62a09 | 2015-12-01 12:27:20 +0100 | [diff] [blame] | 687 | info_print_typedef_detail(struct lyout *outf, const struct lys_tpdf *tpdf) |
Michal Vasko | 7df7f14 | 2015-07-15 12:10:53 +0200 | [diff] [blame] | 688 | { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 689 | ly_print(outf, "%-*s%s\n", INDENT_LEN, "Typedef: ", tpdf->name); |
| 690 | ly_print(outf, "%-*s%s\n", INDENT_LEN, "Module: ", tpdf->module->name); |
| 691 | info_print_text(outf, tpdf->dsc, "Desc: "); |
| 692 | info_print_text(outf, tpdf->ref, "Reference: "); |
| 693 | info_print_flags(outf, tpdf->flags, LYS_STATUS_MASK, 0); |
| 694 | info_print_type_detail(outf, &tpdf->type, 0); |
| 695 | info_print_text(outf, tpdf->units, "Units: "); |
| 696 | info_print_text(outf, tpdf->dflt, "Default: "); |
Michal Vasko | 7df7f14 | 2015-07-15 12:10:53 +0200 | [diff] [blame] | 697 | } |
| 698 | |
| 699 | static void |
Michal Vasko | 1e62a09 | 2015-12-01 12:27:20 +0100 | [diff] [blame] | 700 | info_print_ident_detail(struct lyout *out, const struct lys_ident *ident) |
Michal Vasko | 7df7f14 | 2015-07-15 12:10:53 +0200 | [diff] [blame] | 701 | { |
Radek Krejci | 1b61d0e | 2016-04-15 13:55:44 +0200 | [diff] [blame] | 702 | int i; |
Michal Vasko | 7df7f14 | 2015-07-15 12:10:53 +0200 | [diff] [blame] | 703 | |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 704 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Identity: ", ident->name); |
| 705 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Module: ", ident->module->name); |
| 706 | info_print_text(out, ident->dsc, "Desc: "); |
| 707 | info_print_text(out, ident->ref, "Reference: "); |
| 708 | info_print_flags(out, ident->flags, LYS_STATUS_MASK, 0); |
| 709 | info_print_text(out, (ident->base ? ident->base->name : NULL), "Base: "); |
Michal Vasko | 7df7f14 | 2015-07-15 12:10:53 +0200 | [diff] [blame] | 710 | |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 711 | ly_print(out, "%-*s", INDENT_LEN, "Derived: "); |
Michal Vasko | 7df7f14 | 2015-07-15 12:10:53 +0200 | [diff] [blame] | 712 | if (ident->der) { |
Radek Krejci | 1b61d0e | 2016-04-15 13:55:44 +0200 | [diff] [blame] | 713 | for (i = 0; ident->der[i]; i++) { |
| 714 | ly_print(out, "%*s%s\n", i ? INDENT_LEN : 0, "", ident->der[i]->name); |
Michal Vasko | 7df7f14 | 2015-07-15 12:10:53 +0200 | [diff] [blame] | 715 | } |
| 716 | } else { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 717 | ly_print(out, "\n"); |
Michal Vasko | 7df7f14 | 2015-07-15 12:10:53 +0200 | [diff] [blame] | 718 | } |
| 719 | } |
| 720 | |
| 721 | static void |
Michal Vasko | 1e62a09 | 2015-12-01 12:27:20 +0100 | [diff] [blame] | 722 | info_print_feature_detail(struct lyout *out, const struct lys_feature *feat) |
Michal Vasko | 7df7f14 | 2015-07-15 12:10:53 +0200 | [diff] [blame] | 723 | { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 724 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Feature: ", feat->name); |
| 725 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Module: ", feat->module->name); |
| 726 | info_print_text(out, feat->dsc, "Desc: "); |
| 727 | info_print_text(out, feat->ref, "Reference: "); |
| 728 | info_print_flags(out, feat->flags, LYS_STATUS_MASK | LYS_FENABLED, 0); |
Radek Krejci | 9ff0a92 | 2016-07-14 13:08:05 +0200 | [diff] [blame] | 729 | info_print_if_feature(out, feat->module, feat->iffeature, feat->iffeature_size); |
Michal Vasko | 7df7f14 | 2015-07-15 12:10:53 +0200 | [diff] [blame] | 730 | } |
| 731 | |
| 732 | static void |
Michal Vasko | 1e62a09 | 2015-12-01 12:27:20 +0100 | [diff] [blame] | 733 | info_print_module(struct lyout *out, const struct lys_module *module) |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 734 | { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 735 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Module: ", module->name); |
| 736 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Namespace: ", module->ns); |
| 737 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Prefix: ", module->prefix); |
| 738 | info_print_text(out, module->dsc, "Desc: "); |
| 739 | info_print_text(out, module->ref, "Reference: "); |
| 740 | info_print_text(out, module->org, "Org: "); |
| 741 | info_print_text(out, module->contact, "Contact: "); |
| 742 | ly_print(out, "%-*s%s\n", INDENT_LEN, "YANG ver: ", (module->version == 2 ? "1.1" : "1.0")); |
| 743 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Deviated: ", (module->deviated ? "yes" : "no")); |
| 744 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Implement: ", (module->implemented ? "yes" : "no")); |
Radek Krejci | a77904e | 2016-02-25 16:23:45 +0100 | [diff] [blame] | 745 | info_print_text(out, module->filepath, "URI: file://"); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 746 | |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 747 | info_print_revision(out, module->rev, module->rev_size); |
| 748 | info_print_include(out, module); |
| 749 | info_print_import_with_include(out, module); |
| 750 | info_print_typedef_with_include(out, module); |
| 751 | info_print_ident_with_include(out, module); |
| 752 | info_print_features_with_include(out, module); |
| 753 | info_print_augment(out, module); |
| 754 | info_print_deviation(out, module); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 755 | |
Radek Krejci | bac8176 | 2015-10-09 10:19:52 +0200 | [diff] [blame] | 756 | info_print_data_with_include(out, module); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 757 | } |
| 758 | |
| 759 | static void |
Michal Vasko | 1e62a09 | 2015-12-01 12:27:20 +0100 | [diff] [blame] | 760 | info_print_submodule(struct lyout *out, const struct lys_submodule *module) |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 761 | { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 762 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Submodule: ", module->name); |
| 763 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Parent: ", module->belongsto->name); |
| 764 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Prefix: ", module->prefix); |
| 765 | info_print_text(out, module->dsc, "Desc: "); |
| 766 | info_print_text(out, module->ref, "Reference: "); |
| 767 | info_print_text(out, module->org, "Org: "); |
| 768 | info_print_text(out, module->contact, "Contact: "); |
Radek Krejci | c071c54 | 2016-01-27 14:57:51 +0100 | [diff] [blame] | 769 | |
| 770 | /* inherited from main module */ |
| 771 | ly_print(out, "%-*s%s\n", INDENT_LEN, "YANG ver: ", (module->belongsto->version == 2 ? "1.1" : "1.0")); |
| 772 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Deviated: ", (module->belongsto->deviated ? "yes" : "no")); |
| 773 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Implement: ", (module->belongsto->implemented ? "yes" : "no")); |
| 774 | |
Radek Krejci | a77904e | 2016-02-25 16:23:45 +0100 | [diff] [blame] | 775 | info_print_text(out, module->filepath, "URI: file://"); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 776 | |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 777 | info_print_revision(out, module->rev, module->rev_size); |
| 778 | info_print_include(out, (struct lys_module *)module); |
| 779 | info_print_import_with_include(out, (struct lys_module *)module); |
| 780 | info_print_typedef_with_include(out, (struct lys_module *)module); |
| 781 | info_print_ident_with_include(out, (struct lys_module *)module); |
| 782 | info_print_features_with_include(out, (struct lys_module *)module); |
| 783 | info_print_augment(out, (struct lys_module *)module); |
| 784 | info_print_deviation(out, (struct lys_module *)module); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 785 | |
Radek Krejci | bac8176 | 2015-10-09 10:19:52 +0200 | [diff] [blame] | 786 | info_print_data_with_include(out, (struct lys_module *)module); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 787 | } |
| 788 | |
| 789 | static void |
Michal Vasko | 1e62a09 | 2015-12-01 12:27:20 +0100 | [diff] [blame] | 790 | info_print_container(struct lyout *out, const struct lys_node *node) |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 791 | { |
Radek Krejci | 1d82ef6 | 2015-08-07 14:44:40 +0200 | [diff] [blame] | 792 | struct lys_node_container *cont = (struct lys_node_container *)node; |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 793 | |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 794 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Container: ", cont->name); |
| 795 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Module: ", cont->module->name); |
| 796 | info_print_text(out, cont->dsc, "Desc: "); |
| 797 | info_print_text(out, cont->ref, "Reference: "); |
| 798 | info_print_flags(out, cont->flags, LYS_CONFIG_MASK | LYS_STATUS_MASK | LYS_MAND_MASK, 0); |
| 799 | info_print_text(out, cont->presence, "Presence: "); |
Radek Krejci | 9ff0a92 | 2016-07-14 13:08:05 +0200 | [diff] [blame] | 800 | info_print_if_feature(out, cont->module, cont->iffeature, cont->iffeature_size); |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 801 | info_print_when(out, cont->when); |
| 802 | info_print_must(out, cont->must, cont->must_size); |
| 803 | info_print_typedef(out, cont->tpdf, cont->tpdf_size); |
| 804 | info_print_nacmext(out, cont->nacm); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 805 | |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 806 | info_print_snode(out, (struct lys_node *)cont, cont->child, "Children:"); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 807 | } |
| 808 | |
| 809 | static void |
Michal Vasko | 1e62a09 | 2015-12-01 12:27:20 +0100 | [diff] [blame] | 810 | info_print_choice(struct lyout *out, const struct lys_node *node) |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 811 | { |
Radek Krejci | 1d82ef6 | 2015-08-07 14:44:40 +0200 | [diff] [blame] | 812 | struct lys_node_choice *choice = (struct lys_node_choice *)node; |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 813 | |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 814 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Choice: ", choice->name); |
| 815 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Module: ", choice->module->name); |
| 816 | info_print_text(out, choice->dsc, "Desc: "); |
| 817 | info_print_text(out, choice->ref, "Reference: "); |
| 818 | info_print_flags(out, choice->flags, LYS_CONFIG_MASK | LYS_STATUS_MASK | LYS_MAND_MASK, 0); |
| 819 | ly_print(out, "%-*s", INDENT_LEN, "Default: "); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 820 | if (choice->dflt) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 821 | ly_print(out, "%s\n", choice->dflt->name); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 822 | } else { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 823 | ly_print(out, "\n"); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 824 | } |
Radek Krejci | 9ff0a92 | 2016-07-14 13:08:05 +0200 | [diff] [blame] | 825 | info_print_if_feature(out, choice->module, choice->iffeature, choice->iffeature_size); |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 826 | info_print_when(out, choice->when); |
| 827 | info_print_nacmext(out, choice->nacm); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 828 | |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 829 | info_print_snode(out, (struct lys_node *)choice, choice->child, "Cases:"); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 830 | } |
| 831 | |
| 832 | static void |
Michal Vasko | 1e62a09 | 2015-12-01 12:27:20 +0100 | [diff] [blame] | 833 | info_print_leaf(struct lyout *out, const struct lys_node *node) |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 834 | { |
Radek Krejci | 1d82ef6 | 2015-08-07 14:44:40 +0200 | [diff] [blame] | 835 | struct lys_node_leaf *leaf = (struct lys_node_leaf *)node; |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 836 | |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 837 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Leaf: ", leaf->name); |
| 838 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Module: ", leaf->module->name); |
| 839 | info_print_text(out, leaf->dsc, "Desc: "); |
| 840 | info_print_text(out, leaf->ref, "Reference: "); |
| 841 | info_print_flags(out, leaf->flags, LYS_CONFIG_MASK | LYS_STATUS_MASK | LYS_MAND_MASK, 0); |
| 842 | info_print_text(out, leaf->type.der->name, "Type: "); |
| 843 | info_print_text(out, leaf->units, "Units: "); |
| 844 | info_print_text(out, leaf->dflt, "Default: "); |
Radek Krejci | 9ff0a92 | 2016-07-14 13:08:05 +0200 | [diff] [blame] | 845 | info_print_if_feature(out, leaf->module, leaf->iffeature, leaf->iffeature_size); |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 846 | info_print_when(out, leaf->when); |
| 847 | info_print_must(out, leaf->must, leaf->must_size); |
| 848 | info_print_nacmext(out, leaf->nacm); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 849 | } |
| 850 | |
| 851 | static void |
Michal Vasko | 1e62a09 | 2015-12-01 12:27:20 +0100 | [diff] [blame] | 852 | info_print_leaflist(struct lyout *out, const struct lys_node *node) |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 853 | { |
Radek Krejci | 1d82ef6 | 2015-08-07 14:44:40 +0200 | [diff] [blame] | 854 | struct lys_node_leaflist *llist = (struct lys_node_leaflist *)node; |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 855 | |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 856 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Leaflist: ", llist->name); |
| 857 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Module: ", llist->module->name); |
| 858 | info_print_text(out, llist->dsc, "Desc: "); |
| 859 | info_print_text(out, llist->ref, "Reference: "); |
| 860 | info_print_flags(out, llist->flags, LYS_CONFIG_MASK | LYS_STATUS_MASK | LYS_MAND_MASK | LYS_USERORDERED, 1); |
| 861 | info_print_text(out, llist->type.der->name, "Type: "); |
| 862 | info_print_text(out, llist->units, "Units: "); |
| 863 | info_print_list_constr(out, llist->min, llist->max); |
Radek Krejci | 9ff0a92 | 2016-07-14 13:08:05 +0200 | [diff] [blame] | 864 | info_print_if_feature(out, llist->module, llist->iffeature, llist->iffeature_size); |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 865 | info_print_when(out, llist->when); |
| 866 | info_print_must(out, llist->must, llist->must_size); |
| 867 | info_print_nacmext(out, llist->nacm); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 868 | } |
| 869 | |
| 870 | static void |
Michal Vasko | 1e62a09 | 2015-12-01 12:27:20 +0100 | [diff] [blame] | 871 | info_print_list(struct lyout *out, const struct lys_node *node) |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 872 | { |
Radek Krejci | 1d82ef6 | 2015-08-07 14:44:40 +0200 | [diff] [blame] | 873 | struct lys_node_list *list = (struct lys_node_list *)node; |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 874 | |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 875 | ly_print(out, "%-*s%s\n", INDENT_LEN, "List: ", list->name); |
| 876 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Module: ", list->module->name); |
| 877 | info_print_text(out, list->dsc, "Desc: "); |
| 878 | info_print_text(out, list->ref, "Reference: "); |
| 879 | info_print_flags(out, list->flags, LYS_CONFIG_MASK | LYS_STATUS_MASK | LYS_MAND_MASK | LYS_USERORDERED, 1); |
| 880 | info_print_list_constr(out, list->min, list->max); |
Radek Krejci | 9ff0a92 | 2016-07-14 13:08:05 +0200 | [diff] [blame] | 881 | info_print_if_feature(out, list->module, list->iffeature, list->iffeature_size); |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 882 | info_print_when(out, list->when); |
| 883 | info_print_must(out, list->must, list->must_size); |
| 884 | info_print_keys(out, list->keys, list->keys_size); |
| 885 | info_print_unique(out, list->unique, list->unique_size); |
| 886 | info_print_typedef(out, list->tpdf, list->tpdf_size); |
| 887 | info_print_nacmext(out, list->nacm); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 888 | |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 889 | info_print_snode(out, (struct lys_node *)list, list->child, "Children:"); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 890 | } |
| 891 | |
| 892 | static void |
Michal Vasko | 1e62a09 | 2015-12-01 12:27:20 +0100 | [diff] [blame] | 893 | info_print_anyxml(struct lyout *out, const struct lys_node *node) |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 894 | { |
Radek Krejci | 1d82ef6 | 2015-08-07 14:44:40 +0200 | [diff] [blame] | 895 | struct lys_node_anyxml *axml = (struct lys_node_anyxml *)node; |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 896 | |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 897 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Anyxml: ", axml->name); |
| 898 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Module: ", axml->module->name); |
| 899 | info_print_text(out, axml->dsc, "Desc: "); |
| 900 | info_print_text(out, axml->ref, "Reference: "); |
| 901 | info_print_flags(out, axml->flags, LYS_CONFIG_MASK | LYS_STATUS_MASK | LYS_MAND_MASK, 0); |
Radek Krejci | 9ff0a92 | 2016-07-14 13:08:05 +0200 | [diff] [blame] | 902 | info_print_if_feature(out, axml->module, axml->iffeature, axml->iffeature_size); |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 903 | info_print_when(out, axml->when); |
| 904 | info_print_must(out, axml->must, axml->must_size); |
| 905 | info_print_nacmext(out, axml->nacm); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 906 | } |
| 907 | |
| 908 | static void |
Michal Vasko | 1e62a09 | 2015-12-01 12:27:20 +0100 | [diff] [blame] | 909 | info_print_grouping(struct lyout *out, const struct lys_node *node) |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 910 | { |
Radek Krejci | 1d82ef6 | 2015-08-07 14:44:40 +0200 | [diff] [blame] | 911 | struct lys_node_grp *group = (struct lys_node_grp *)node; |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 912 | |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 913 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Grouping: ", group->name); |
| 914 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Module: ", group->module->name); |
| 915 | info_print_text(out, group->dsc, "Desc: "); |
| 916 | info_print_text(out, group->ref, "Reference: "); |
| 917 | info_print_flags(out, group->flags, LYS_STATUS_MASK, 0); |
| 918 | info_print_typedef(out, group->tpdf, group->tpdf_size); |
| 919 | info_print_nacmext(out, group->nacm); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 920 | |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 921 | info_print_snode(out, (struct lys_node *)group, group->child, "Children:"); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 922 | } |
| 923 | |
| 924 | static void |
Michal Vasko | 1e62a09 | 2015-12-01 12:27:20 +0100 | [diff] [blame] | 925 | info_print_case(struct lyout *out, const struct lys_node *node) |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 926 | { |
Radek Krejci | 1d82ef6 | 2015-08-07 14:44:40 +0200 | [diff] [blame] | 927 | struct lys_node_case *cas = (struct lys_node_case *)node; |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 928 | |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 929 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Case: ", cas->name); |
| 930 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Module: ", cas->module->name); |
| 931 | info_print_text(out, cas->dsc, "Desc: "); |
| 932 | info_print_text(out, cas->ref, "Reference: "); |
| 933 | info_print_flags(out, cas->flags, LYS_CONFIG_MASK | LYS_STATUS_MASK | LYS_MAND_MASK, 0); |
Radek Krejci | 9ff0a92 | 2016-07-14 13:08:05 +0200 | [diff] [blame] | 934 | info_print_if_feature(out, cas->module, cas->iffeature, cas->iffeature_size); |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 935 | info_print_when(out, cas->when); |
| 936 | info_print_nacmext(out, cas->nacm); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 937 | |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 938 | info_print_snode(out, (struct lys_node *)cas, cas->child, "Children:"); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 939 | } |
| 940 | |
| 941 | static void |
Michal Vasko | 1e62a09 | 2015-12-01 12:27:20 +0100 | [diff] [blame] | 942 | info_print_input(struct lyout *out, const struct lys_node *node) |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 943 | { |
Michal Vasko | 44fb638 | 2016-06-29 11:12:27 +0200 | [diff] [blame] | 944 | struct lys_node_inout *input = (struct lys_node_inout *)node; |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 945 | |
Michal Vasko | dcf98e6 | 2016-05-05 17:53:53 +0200 | [diff] [blame] | 946 | assert(lys_parent(node) && lys_parent(node)->nodetype == LYS_RPC); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 947 | |
Michal Vasko | dcf98e6 | 2016-05-05 17:53:53 +0200 | [diff] [blame] | 948 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Input of: ", lys_parent(node)->name); |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 949 | info_print_typedef(out, input->tpdf, input->tpdf_size); |
Radek Krejci | 12032a5 | 2016-07-29 15:42:56 +0200 | [diff] [blame^] | 950 | info_print_must(out, input->must, input->must_size); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 951 | |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 952 | info_print_snode(out, (struct lys_node *)input, input->child, "Children:"); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 953 | } |
| 954 | |
| 955 | static void |
Michal Vasko | 1e62a09 | 2015-12-01 12:27:20 +0100 | [diff] [blame] | 956 | info_print_output(struct lyout *out, const struct lys_node *node) |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 957 | { |
Michal Vasko | 44fb638 | 2016-06-29 11:12:27 +0200 | [diff] [blame] | 958 | struct lys_node_inout *output = (struct lys_node_inout *)node; |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 959 | |
Michal Vasko | dcf98e6 | 2016-05-05 17:53:53 +0200 | [diff] [blame] | 960 | assert(lys_parent(node) && lys_parent(node)->nodetype == LYS_RPC); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 961 | |
Michal Vasko | dcf98e6 | 2016-05-05 17:53:53 +0200 | [diff] [blame] | 962 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Output of: ", lys_parent(node)->name); |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 963 | info_print_typedef(out, output->tpdf, output->tpdf_size); |
Radek Krejci | 12032a5 | 2016-07-29 15:42:56 +0200 | [diff] [blame^] | 964 | info_print_must(out, output->must, output->must_size); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 965 | |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 966 | info_print_snode(out, (struct lys_node *)output, output->child, "Children:"); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 967 | } |
| 968 | |
| 969 | static void |
Michal Vasko | 1e62a09 | 2015-12-01 12:27:20 +0100 | [diff] [blame] | 970 | info_print_notif(struct lyout *out, const struct lys_node *node) |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 971 | { |
Radek Krejci | 1d82ef6 | 2015-08-07 14:44:40 +0200 | [diff] [blame] | 972 | struct lys_node_notif *ntf = (struct lys_node_notif *)node; |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 973 | |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 974 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Notif: ", ntf->name); |
| 975 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Module: ", ntf->module->name); |
| 976 | info_print_text(out, ntf->dsc, "Desc: "); |
| 977 | info_print_text(out, ntf->ref, "Reference: "); |
| 978 | info_print_flags(out, ntf->flags, LYS_STATUS_MASK, 0); |
Radek Krejci | 9ff0a92 | 2016-07-14 13:08:05 +0200 | [diff] [blame] | 979 | info_print_if_feature(out, ntf->module, ntf->iffeature, ntf->iffeature_size); |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 980 | info_print_typedef(out, ntf->tpdf, ntf->tpdf_size); |
Radek Krejci | 12032a5 | 2016-07-29 15:42:56 +0200 | [diff] [blame^] | 981 | info_print_must(out, ntf->must, ntf->must_size); |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 982 | info_print_nacmext(out, ntf->nacm); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 983 | |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 984 | info_print_snode(out, (struct lys_node *)ntf, ntf->child, "Params:"); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 985 | } |
| 986 | |
| 987 | static void |
Michal Vasko | 1e62a09 | 2015-12-01 12:27:20 +0100 | [diff] [blame] | 988 | info_print_rpc(struct lyout *out, const struct lys_node *node) |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 989 | { |
Michal Vasko | c5c26b0 | 2016-06-29 11:10:29 +0200 | [diff] [blame] | 990 | struct lys_node_rpc_action *rpc = (struct lys_node_rpc_action *)node; |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 991 | |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 992 | ly_print(out, "%-*s%s\n", INDENT_LEN, "RPC: ", rpc->name); |
| 993 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Module: ", rpc->module->name); |
| 994 | info_print_text(out, rpc->dsc, "Desc: "); |
| 995 | info_print_text(out, rpc->ref, "Reference: "); |
| 996 | info_print_flags(out, rpc->flags, LYS_STATUS_MASK, 0); |
Radek Krejci | 9ff0a92 | 2016-07-14 13:08:05 +0200 | [diff] [blame] | 997 | info_print_if_feature(out, rpc->module, rpc->iffeature, rpc->iffeature_size); |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 998 | info_print_typedef(out, rpc->tpdf, rpc->tpdf_size); |
| 999 | info_print_nacmext(out, rpc->nacm); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 1000 | |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 1001 | info_print_snode(out, (struct lys_node *)rpc, rpc->child, "Data:"); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 1002 | } |
| 1003 | |
Michal Vasko | ca7cbc4 | 2016-07-01 11:36:53 +0200 | [diff] [blame] | 1004 | static void |
| 1005 | info_print_action(struct lyout *out, const struct lys_node *node) |
| 1006 | { |
| 1007 | struct lys_node_rpc_action *act = (struct lys_node_rpc_action *)node; |
| 1008 | |
| 1009 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Action: ", act->name); |
| 1010 | ly_print(out, "%-*s%s\n", INDENT_LEN, "Module: ", act->module->name); |
| 1011 | info_print_text(out, act->dsc, "Desc: "); |
| 1012 | info_print_text(out, act->ref, "Reference: "); |
| 1013 | info_print_flags(out, act->flags, LYS_STATUS_MASK, 0); |
Radek Krejci | 9ff0a92 | 2016-07-14 13:08:05 +0200 | [diff] [blame] | 1014 | info_print_if_feature(out, act->module, act->iffeature, act->iffeature_size); |
Michal Vasko | ca7cbc4 | 2016-07-01 11:36:53 +0200 | [diff] [blame] | 1015 | info_print_typedef(out, act->tpdf, act->tpdf_size); |
| 1016 | info_print_nacmext(out, act->nacm); |
| 1017 | |
| 1018 | info_print_snode(out, (struct lys_node *)act, act->child, "Data:"); |
| 1019 | } |
| 1020 | |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 1021 | int |
Michal Vasko | 1e62a09 | 2015-12-01 12:27:20 +0100 | [diff] [blame] | 1022 | info_print_model(struct lyout *out, const struct lys_module *module, const char *target_node) |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 1023 | { |
Michal Vasko | 3ab70fc | 2015-08-17 14:06:23 +0200 | [diff] [blame] | 1024 | int i, rc; |
Michal Vasko | d04dbea | 2015-08-06 15:10:19 +0200 | [diff] [blame] | 1025 | char *grouping_target = NULL; |
Michal Vasko | 3edeaf7 | 2016-02-11 13:17:43 +0100 | [diff] [blame] | 1026 | struct lys_node *target = NULL; |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 1027 | |
| 1028 | if (!target_node) { |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 1029 | if (module->type == 0) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 1030 | info_print_module(out, module); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 1031 | } else { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 1032 | info_print_submodule(out, (struct lys_submodule *)module); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 1033 | } |
| 1034 | } else { |
Michal Vasko | 035f523 | 2015-07-15 12:26:52 +0200 | [diff] [blame] | 1035 | if ((target_node[0] == '/') || !strncmp(target_node, "type/", 5)) { |
Michal Vasko | 3edeaf7 | 2016-02-11 13:17:43 +0100 | [diff] [blame] | 1036 | rc = resolve_augment_schema_nodeid((target_node[0] == '/' ? target_node : target_node + 4), NULL, module, |
| 1037 | (const struct lys_node **)&target); |
| 1038 | if (rc || !target) { |
| 1039 | ly_print(out, "Target %s could not be resolved.\n", (target_node[0] == '/' ? target_node : target_node + 4)); |
Michal Vasko | 7df7f14 | 2015-07-15 12:10:53 +0200 | [diff] [blame] | 1040 | return EXIT_FAILURE; |
| 1041 | } |
Michal Vasko | d04dbea | 2015-08-06 15:10:19 +0200 | [diff] [blame] | 1042 | } else if (!strncmp(target_node, "grouping/", 9)) { |
| 1043 | /* cut the data part off */ |
Michal Vasko | 3edeaf7 | 2016-02-11 13:17:43 +0100 | [diff] [blame] | 1044 | if (strchr(target_node + 9, '/')) { |
Michal Vasko | d04dbea | 2015-08-06 15:10:19 +0200 | [diff] [blame] | 1045 | /* HACK only temporary */ |
Michal Vasko | 3edeaf7 | 2016-02-11 13:17:43 +0100 | [diff] [blame] | 1046 | *strchr(target_node + 9, '/') = '\0'; |
| 1047 | grouping_target = (char *)(target_node + strlen(target_node) + 1); |
Michal Vasko | d04dbea | 2015-08-06 15:10:19 +0200 | [diff] [blame] | 1048 | } |
Michal Vasko | 3edeaf7 | 2016-02-11 13:17:43 +0100 | [diff] [blame] | 1049 | rc = resolve_absolute_schema_nodeid(target_node + 9, module, LYS_GROUPING, (const struct lys_node **)&target); |
| 1050 | if (rc || !target) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 1051 | ly_print(out, "Grouping %s not found.\n", target_node+9); |
Michal Vasko | d04dbea | 2015-08-06 15:10:19 +0200 | [diff] [blame] | 1052 | return EXIT_FAILURE; |
| 1053 | } |
Michal Vasko | 7df7f14 | 2015-07-15 12:10:53 +0200 | [diff] [blame] | 1054 | } else if (!strncmp(target_node, "typedef/", 8)) { |
| 1055 | target_node += 8; |
| 1056 | for (i = 0; i < module->tpdf_size; ++i) { |
| 1057 | if (!strcmp(module->tpdf[i].name, target_node)) { |
| 1058 | break; |
| 1059 | } |
| 1060 | } |
| 1061 | if (i == module->tpdf_size) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 1062 | ly_print(out, "Typedef %s not found.\n", target_node); |
Michal Vasko | 7df7f14 | 2015-07-15 12:10:53 +0200 | [diff] [blame] | 1063 | return EXIT_FAILURE; |
| 1064 | } |
| 1065 | |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 1066 | info_print_typedef_detail(out, &module->tpdf[i]); |
Michal Vasko | 7df7f14 | 2015-07-15 12:10:53 +0200 | [diff] [blame] | 1067 | return EXIT_SUCCESS; |
| 1068 | |
| 1069 | } else if (!strncmp(target_node, "identity/", 9)) { |
| 1070 | target_node += 9; |
| 1071 | for (i = 0; i < (signed)module->ident_size; ++i) { |
| 1072 | if (!strcmp(module->ident[i].name, target_node)) { |
| 1073 | break; |
| 1074 | } |
| 1075 | } |
| 1076 | if (i == (signed)module->ident_size) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 1077 | ly_print(out, "Identity %s not found.\n", target_node); |
Michal Vasko | 7df7f14 | 2015-07-15 12:10:53 +0200 | [diff] [blame] | 1078 | return EXIT_FAILURE; |
| 1079 | } |
| 1080 | |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 1081 | info_print_ident_detail(out, &module->ident[i]); |
Michal Vasko | 7df7f14 | 2015-07-15 12:10:53 +0200 | [diff] [blame] | 1082 | return EXIT_SUCCESS; |
| 1083 | |
| 1084 | } else if (!strncmp(target_node, "feature/", 8)) { |
| 1085 | target_node += 8; |
| 1086 | for (i = 0; i < module->features_size; ++i) { |
| 1087 | if (!strcmp(module->features[i].name, target_node)) { |
| 1088 | break; |
| 1089 | } |
| 1090 | } |
| 1091 | if (i == module->features_size) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 1092 | ly_print(out, "Feature %s not found.\n", target_node); |
Michal Vasko | 7df7f14 | 2015-07-15 12:10:53 +0200 | [diff] [blame] | 1093 | return EXIT_FAILURE; |
| 1094 | } |
| 1095 | |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 1096 | info_print_feature_detail(out, &module->features[i]); |
Michal Vasko | 7df7f14 | 2015-07-15 12:10:53 +0200 | [diff] [blame] | 1097 | return EXIT_SUCCESS; |
| 1098 | } else { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 1099 | ly_print(out, "Target could not be resolved.\n"); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 1100 | return EXIT_FAILURE; |
| 1101 | } |
| 1102 | |
Michal Vasko | d04dbea | 2015-08-06 15:10:19 +0200 | [diff] [blame] | 1103 | if (!strncmp(target_node, "type/", 5)) { |
Radek Krejci | 7651257 | 2015-08-04 09:47:08 +0200 | [diff] [blame] | 1104 | if (!(target->nodetype & (LYS_LEAF | LYS_LEAFLIST))) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 1105 | ly_print(out, "Target is not a leaf or a leaf-list.\n"); |
Michal Vasko | 035f523 | 2015-07-15 12:26:52 +0200 | [diff] [blame] | 1106 | return EXIT_FAILURE; |
| 1107 | } |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 1108 | info_print_type_detail(out, &((struct lys_node_leaf *)target)->type, 0); |
Michal Vasko | 035f523 | 2015-07-15 12:26:52 +0200 | [diff] [blame] | 1109 | return EXIT_SUCCESS; |
Michal Vasko | d04dbea | 2015-08-06 15:10:19 +0200 | [diff] [blame] | 1110 | } else if (!strncmp(target_node, "grouping/", 9) && !grouping_target) { |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 1111 | info_print_grouping(out, target); |
Michal Vasko | d04dbea | 2015-08-06 15:10:19 +0200 | [diff] [blame] | 1112 | return EXIT_SUCCESS; |
| 1113 | } |
| 1114 | |
| 1115 | /* find the node in the grouping */ |
| 1116 | if (grouping_target) { |
Michal Vasko | 3edeaf7 | 2016-02-11 13:17:43 +0100 | [diff] [blame] | 1117 | rc = resolve_descendant_schema_nodeid(grouping_target, target->child, LYS_NO_RPC_NOTIF_NODE, |
Radek Krejci | f3c71de | 2016-04-11 12:45:46 +0200 | [diff] [blame] | 1118 | 1, 0, (const struct lys_node **)&target); |
Michal Vasko | 3edeaf7 | 2016-02-11 13:17:43 +0100 | [diff] [blame] | 1119 | if (rc || !target) { |
| 1120 | ly_print(out, "Grouping %s child \"%s\" not found.\n", target_node + 9, grouping_target); |
Michal Vasko | d04dbea | 2015-08-06 15:10:19 +0200 | [diff] [blame] | 1121 | return EXIT_FAILURE; |
| 1122 | } |
| 1123 | /* HACK return previous hack */ |
| 1124 | --grouping_target; |
| 1125 | grouping_target[0] = '/'; |
Michal Vasko | 035f523 | 2015-07-15 12:26:52 +0200 | [diff] [blame] | 1126 | } |
| 1127 | |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 1128 | switch (target->nodetype) { |
Radek Krejci | 7651257 | 2015-08-04 09:47:08 +0200 | [diff] [blame] | 1129 | case LYS_CONTAINER: |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 1130 | info_print_container(out, target); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 1131 | break; |
Radek Krejci | 7651257 | 2015-08-04 09:47:08 +0200 | [diff] [blame] | 1132 | case LYS_CHOICE: |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 1133 | info_print_choice(out, target); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 1134 | break; |
Radek Krejci | 7651257 | 2015-08-04 09:47:08 +0200 | [diff] [blame] | 1135 | case LYS_LEAF: |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 1136 | info_print_leaf(out, target); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 1137 | break; |
Radek Krejci | 7651257 | 2015-08-04 09:47:08 +0200 | [diff] [blame] | 1138 | case LYS_LEAFLIST: |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 1139 | info_print_leaflist(out, target); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 1140 | break; |
Radek Krejci | 7651257 | 2015-08-04 09:47:08 +0200 | [diff] [blame] | 1141 | case LYS_LIST: |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 1142 | info_print_list(out, target); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 1143 | break; |
Radek Krejci | 7651257 | 2015-08-04 09:47:08 +0200 | [diff] [blame] | 1144 | case LYS_ANYXML: |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 1145 | info_print_anyxml(out, target); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 1146 | break; |
Radek Krejci | 7651257 | 2015-08-04 09:47:08 +0200 | [diff] [blame] | 1147 | case LYS_CASE: |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 1148 | info_print_case(out, target); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 1149 | break; |
Radek Krejci | 7651257 | 2015-08-04 09:47:08 +0200 | [diff] [blame] | 1150 | case LYS_NOTIF: |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 1151 | info_print_notif(out, target); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 1152 | break; |
Radek Krejci | 7651257 | 2015-08-04 09:47:08 +0200 | [diff] [blame] | 1153 | case LYS_RPC: |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 1154 | info_print_rpc(out, target); |
Michal Vasko | 2750f82 | 2016-07-13 15:15:23 +0200 | [diff] [blame] | 1155 | break; |
Michal Vasko | ca7cbc4 | 2016-07-01 11:36:53 +0200 | [diff] [blame] | 1156 | case LYS_ACTION: |
| 1157 | info_print_action(out, target); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 1158 | break; |
Radek Krejci | 7651257 | 2015-08-04 09:47:08 +0200 | [diff] [blame] | 1159 | case LYS_INPUT: |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 1160 | info_print_input(out, target); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 1161 | break; |
Radek Krejci | 7651257 | 2015-08-04 09:47:08 +0200 | [diff] [blame] | 1162 | case LYS_OUTPUT: |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 1163 | info_print_output(out, target); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 1164 | break; |
| 1165 | default: |
Radek Krejci | 76b0790 | 2015-10-09 09:11:25 +0200 | [diff] [blame] | 1166 | ly_print(out, "Nodetype %s not supported.\n", strnodetype(target->nodetype)); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 1167 | break; |
| 1168 | } |
| 1169 | } |
Michal Vasko | 95068c4 | 2016-03-24 14:58:11 +0100 | [diff] [blame] | 1170 | ly_print_flush(out); |
Michal Vasko | 85217a3 | 2015-07-07 11:40:08 +0200 | [diff] [blame] | 1171 | |
| 1172 | return EXIT_SUCCESS; |
| 1173 | } |