1 /* 2 * Copyright (C) 2003-2015 FreeIPMI Core Team 3 * 4 * This program is free software: you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation, either version 3 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program. If not, see <http://www.gnu.org/licenses/>. 16 * 17 */ 18 19 #ifndef FIID_H 20 #define FIID_H 21 22 #ifdef __cplusplus 23 extern "C" { 24 #endif 25 26 #include <stdint.h> 27 28 /* 29 * FIID Error Codes 30 */ 31 32 enum fiid_err 33 { 34 FIID_ERR_SUCCESS = 0, 35 FIID_ERR_OBJ_NULL = 1, 36 FIID_ERR_OBJ_INVALID = 2, 37 FIID_ERR_ITERATOR_NULL = 3, 38 FIID_ERR_ITERATOR_INVALID = 4, 39 FIID_ERR_PARAMETERS = 5, 40 FIID_ERR_TEMPLATE_INVALID = 6, 41 FIID_ERR_FIELD_NOT_FOUND = 7, 42 FIID_ERR_KEY_INVALID = 8, 43 FIID_ERR_FLAGS_INVALID = 9, 44 FIID_ERR_TEMPLATE_NOT_BYTE_ALIGNED = 10, 45 FIID_ERR_FIELD_NOT_BYTE_ALIGNED = 11, 46 FIID_ERR_BLOCK_NOT_BYTE_ALIGNED = 12, 47 FIID_ERR_OVERFLOW = 13, 48 FIID_ERR_MAX_FIELD_LEN_MISMATCH = 14, 49 FIID_ERR_KEY_FIELD_MISMATCH = 15, 50 FIID_ERR_FLAGS_FIELD_MISMATCH = 16, 51 FIID_ERR_TEMPLATE_LENGTH_MISMATCH = 17, 52 FIID_ERR_DATA_NOT_BYTE_ALIGNED = 18, 53 FIID_ERR_REQUIRED_FIELD_MISSING = 19, 54 FIID_ERR_FIXED_LENGTH_FIELD_INVALID = 20, 55 FIID_ERR_DATA_NOT_AVAILABLE = 21, 56 FIID_ERR_NOT_IDENTICAL = 22, 57 FIID_ERR_OUT_OF_MEMORY = 23, 58 FIID_ERR_INTERNAL_ERROR = 24, 59 FIID_ERR_ERRNUMRANGE = 25 60 }; 61 62 typedef enum fiid_err fiid_err_t; 63 64 /* 65 * FIID Field Maximum Key Length 66 */ 67 68 #define FIID_FIELD_MAX_KEY_LEN 256 69 70 /* 71 * FIID Field Flags 72 * 73 * FIID Field Requirement Flags 74 * 75 * REQUIRED 76 * 77 * The field in the template is required. For requests, if not set, a 78 * packet cannot be created. For responses, if not set, a packet is 79 * invalid. 80 * 81 * OPTIONAL 82 * 83 * The field in the template is not required. For requests, if not 84 * set, a packet can still be created. For responses, if not set, a 85 * packet is still valid. 86 * 87 * In a template field, either the REQUIRED or OPTIONAL flag must be 88 * specified. 89 * 90 * FIID Field Length Flags 91 * 92 * LENGTH_FIXED 93 * 94 * The number of bits that must be set in the field is fixed. It 95 * cannot be any other length. 96 * 97 * LENGTH_VARIABLE 98 * 99 * The number of bits that must be set in the field is variable in 100 * length. 101 * 102 * In a template field, either the LENGTH_FIXED or LENGTH_VARIABLE 103 * flag must be specified. 104 * 105 * FIID Field Misc Flags 106 * 107 * MAKES_PACKET_SUFFICIENT 108 * 109 * Used to indicate a sufficient set of fields, that if set, may allow 110 * a packet to be "sufficiently valid", despite other "required" 111 * fields not being set. Typically used in response packets to 112 * indicate the few fields necessary to be set for a payload to be 113 * accepted. 114 */ 115 116 #define FIID_FIELD_REQUIRED 0x00000001 117 #define FIID_FIELD_OPTIONAL 0x00000002 118 #define FIID_FIELD_REQUIRED_MASK 0x0000000F 119 120 #define FIID_FIELD_REQUIRED_FLAG(__flags) \ 121 ((__flags) & FIID_FIELD_REQUIRED_MASK) 122 123 #define FIID_FIELD_REQUIRED_FLAG_VALID(__flags) \ 124 ((FIID_FIELD_REQUIRED_FLAG (__flags) == FIID_FIELD_REQUIRED \ 125 || FIID_FIELD_REQUIRED_FLAG (__flags) == FIID_FIELD_OPTIONAL) ? 1 : 0) 126 127 #define FIID_FIELD_LENGTH_FIXED 0x00000010 128 #define FIID_FIELD_LENGTH_VARIABLE 0x00000020 129 #define FIID_FIELD_LENGTH_MASK 0x000000F0 130 131 #define FIID_FIELD_LENGTH_FLAG(__flags) \ 132 ((__flags) & FIID_FIELD_LENGTH_MASK) 133 134 #define FIID_FIELD_LENGTH_FLAG_VALID(__flags) \ 135 ((FIID_FIELD_LENGTH_FLAG (__flags) == FIID_FIELD_LENGTH_FIXED \ 136 || FIID_FIELD_LENGTH_FLAG (__flags) == FIID_FIELD_LENGTH_VARIABLE) ? 1 : 0) 137 138 #define FIID_FIELD_MAKES_PACKET_SUFFICIENT 0x00010000 139 #define FIID_FIELD_SECURE_MEMSET_ON_CLEAR 0x00100000 140 141 /* 142 * fiid_field_t 143 * 144 * Defines a FIID field: 145 * 146 * max_field_len - maximum length of a field in bits 147 * key - field name 148 * flags - indicating field requirements 149 * 150 * An array of field's makes up a FIID template. 151 */ 152 typedef struct fiid_field 153 { 154 unsigned int max_field_len; 155 char key[FIID_FIELD_MAX_KEY_LEN]; 156 unsigned int flags; 157 } fiid_field_t; 158 159 /* 160 * FIID Template 161 * 162 * An array of fiid_field_t's make up a fiid template. The array should be 163 * terminated with a field with a maximum field length of 0. 164 * 165 * The FIID template should be a multiple of 8 (i.e. byte aligned) otherwise 166 * most of the FIID API will return errors. 167 */ 168 typedef fiid_field_t fiid_template_t[]; 169 170 typedef struct fiid_obj *fiid_obj_t; 171 172 typedef struct fiid_iterator *fiid_iterator_t; 173 174 /***************************** 175 * FIID Template API * 176 *****************************/ 177 178 /* 179 * fiid_template_field_lookup 180 * 181 * Returns 1 if the field is found in the template, 0 if not, -1 on 182 * error. 183 */ 184 int fiid_template_field_lookup (fiid_template_t tmpl, 185 const char *field); 186 187 /* 188 * FIID_TEMPLATE_FIELD_LOOKUP 189 * 190 * Returns 1 if the field is found in the template, -1 on error. 191 * Identical to fiid_template_field_lookup() except a return of 0 is 192 * not possible. If the field is not found, -1 is returned and 193 * errno EINVAL is the error code set. 194 */ 195 int FIID_TEMPLATE_FIELD_LOOKUP (fiid_template_t tmpl, 196 const char *field); 197 198 /* 199 * fiid_template_len 200 * 201 * Returns the total length (in bits) of the all the fields in the 202 * template, -1 on error. 203 */ 204 int fiid_template_len (fiid_template_t tmpl); 205 206 /* 207 * fiid_template_len_bytes 208 * 209 * Returns the total length (in bytes) of the all the fields in the 210 * template, -1 on error. Will return an error if template bit length 211 * is not a multiple of 8. 212 */ 213 int fiid_template_len_bytes (fiid_template_t tmpl); 214 215 /* 216 * fiid_template_field_start 217 * 218 * Returns the offset (in bits) of the beginning of the field within 219 * this template, -1 on error. 220 */ 221 int fiid_template_field_start (fiid_template_t tmpl, 222 const char *field); 223 224 /* 225 * fiid_template_field_start_bytes 226 * 227 * Returns the offset (in bytes) of the beginning of the field within 228 * this template, -1 on error. Will return an error if field bit 229 * offset is not a multiple of 8. 230 */ 231 int fiid_template_field_start_bytes (fiid_template_t tmpl, 232 const char *field); 233 234 /* 235 * fiid_template_field_end 236 * 237 * Returns the offset (in bits) of the ending of the field within this 238 * template, -1 on error. 239 */ 240 int fiid_template_field_end (fiid_template_t tmpl, 241 const char *field); 242 243 /* 244 * fiid_template_field_end_bytes 245 * 246 * Returns the offset (in bytes) of the ending of the field within 247 * this template, -1 on error. Will return an error if field bit 248 * offset is not a multiple of 8. 249 */ 250 int fiid_template_field_end_bytes (fiid_template_t tmpl, 251 const char *field); 252 253 /* 254 * fiid_template_field_len 255 * 256 * Returns the maximum length (in bits) of the specified field, -1 on 257 * error. 258 */ 259 int fiid_template_field_len (fiid_template_t tmpl, 260 const char *field); 261 262 /* 263 * fiid_template_field_len_bytes 264 * 265 * Returns the maximum length (in bytes) of the specified field, -1 on 266 * error. Will return an error if the field maximum bit length is not 267 * a multiple of 8. 268 */ 269 int fiid_template_field_len_bytes (fiid_template_t tmpl, 270 const char *field); 271 272 /* 273 * fiid_template_block_len 274 * 275 * Returns the maximum length (in bits) of the block of fields 276 * beginning at 'field_start' and ending at 'field_end'. Returns -1 277 * on error. 278 */ 279 int fiid_template_block_len (fiid_template_t tmpl, 280 const char *field_start, 281 const char *field_end); 282 283 /* 284 * fiid_template_block_len_bytes 285 * 286 * Returns the maximum length (in bytes) of the block of fields 287 * beginning at 'field_start' and ending at 'field_end'. Returns -1 288 * on error. Will return an error if the calculated bit length is not 289 * a multiple of 8. 290 */ 291 int fiid_template_block_len_bytes (fiid_template_t tmpl, 292 const char *field_start, 293 const char *field_end); 294 295 /* 296 * fiid_template_compare 297 * 298 * Returns 1 if the two specified templates are identical, 0 if not, 299 * -1 on error. 300 */ 301 int fiid_template_compare (fiid_template_t tmpl1, 302 fiid_template_t tmpl2); 303 304 /* 305 * FIID_TEMPLATE_COMPARE 306 * 307 * Returns 1 if the two specified templates are identical, -1 on 308 * error. Identical to fiid_template_compare() except a return of 0 309 * is not possible. If templates are not identical, -1 is returned and 310 * errno EINVAL is the error code set. 311 */ 312 int FIID_TEMPLATE_COMPARE (fiid_template_t tmpl1, 313 fiid_template_t tmpl2); 314 315 /* 316 * fiid_template_free 317 * 318 * Free's a template created by fiid_obj_template. 319 */ 320 void fiid_template_free (fiid_field_t *tmpl_dynamic); 321 322 /***************************** 323 * FIID Object API * 324 *****************************/ 325 326 /* 327 * fiid_strerror 328 * 329 * Return statically allocated string describing the specified error. 330 */ 331 char *fiid_strerror (fiid_err_t errnum); 332 333 /* 334 * fiid_obj_create 335 * 336 * Return a fiid object based on the specified template. Returns NULL 337 * on error. 338 */ 339 fiid_obj_t fiid_obj_create (fiid_template_t tmpl); 340 341 /* 342 * fiid_obj_destroy 343 * 344 * Destroy and free memory from a fiid object. 345 */ 346 void fiid_obj_destroy (fiid_obj_t obj); 347 348 /* 349 * fiid_obj_dup 350 * 351 * Create and return a duplicate object from the one specified. 352 * Returns NULL on error. 353 */ 354 fiid_obj_t fiid_obj_dup (fiid_obj_t src_obj); 355 356 /* 357 * fiid_obj_copy 358 * 359 * Create and return a duplicate object from the one specified, but 360 * base the new object on the alternate template specified. Template 361 * length of the original and alternate template must be the same. 362 * Returns NULL on error. 363 */ 364 fiid_obj_t fiid_obj_copy (fiid_obj_t src_obj, fiid_template_t alt_tmpl); 365 366 /* 367 * fiid_obj_valid 368 * 369 * Returns 1 if the object passed in is a valid fiid object, 0 if not. 370 */ 371 int fiid_obj_valid (fiid_obj_t obj); 372 373 /* 374 * fiid_obj_packet_valid 375 * 376 * Returns 1 if the object contains all the data for a valid packet, 377 * 0 if not, -1 on error. A valid packet is based on the field flags 378 * specified in the original fiid template. For example, this 379 * function will check if all required fields have been set with the 380 * correct number of bytes. It will also check that data set within 381 * the object is byte aligned. The FIID_FIELD_MAKES_PACKET_SUFFICIENT 382 * is not considered in this function. 383 */ 384 int fiid_obj_packet_valid (fiid_obj_t obj); 385 386 /* 387 * FIID_OBJ_PACKET_VALID 388 * 389 * Returns 1 if the object contains all the data for a valid packet, 390 * -1 on error. Identical to fiid_obj_packet_valid() except a return 391 * of 0 is not possible. The FIID_FIELD_MAKES_PACKET_SUFFICIENT is 392 * not considered in this function. 393 */ 394 int FIID_OBJ_PACKET_VALID (fiid_obj_t obj); 395 396 /* 397 * fiid_obj_packet_sufficient 398 * 399 * Returns 1 if the object contains all the data for a sufficient 400 * packet, 0 if not, -1 on error. Identical to 401 * fiid_obj_packet_valid() except FIID_FIELD_MAKES_PACKET_SUFFICIENT 402 * is considered. If a packet does not meet the conditions to pass 403 * fiid_obj_packet_valid(), sufficient fields are subsequently 404 * checked. 405 */ 406 int fiid_obj_packet_sufficient (fiid_obj_t obj); 407 408 /* 409 * FIID_OBJ_PACKET_SUFFICIENT 410 * 411 * Returns 1 if the object contains a all the data for a valid packet, 412 * -1 on error. Identical to fiid_obj_packet_sufficient() except a return 413 * of 0 is not possible. 414 */ 415 int FIID_OBJ_PACKET_SUFFICIENT (fiid_obj_t obj); 416 417 /* 418 * fiid_obj_template 419 * 420 * Create a template based on what is stored internally within the 421 * object. Returns NULL on error. Free the resulting template using 422 * fiid_template_free(). 423 */ 424 fiid_field_t *fiid_obj_template (fiid_obj_t obj); 425 426 /* 427 * fiid_obj_template_compare 428 * 429 * Returns 1 if the template specified is the one used to create the 430 * object, 0 if not, -1 one error. 431 */ 432 int fiid_obj_template_compare (fiid_obj_t obj, fiid_template_t tmpl); 433 434 /* 435 * FIID_OBJ_TEMPLATE_COMPARE 436 * 437 * Returns 1 if the template specified is the one used to create the 438 * object, -1 one error. Identical to fiid_obj_template_compare() 439 * except a return of 0 is not possible. If object template and input 440 * template are not identical, -1 is returned and 441 * FIID_ERR_NOT_IDENTICAL is the error code set. 442 */ 443 int FIID_OBJ_TEMPLATE_COMPARE (fiid_obj_t obj, fiid_template_t tmpl); 444 445 /* 446 * fiid_obj_errnum 447 * 448 * Returns the error code for the most recently occurring error. 449 */ 450 fiid_err_t fiid_obj_errnum (fiid_obj_t obj); 451 452 /* 453 * fiid_obj_errormsg 454 * 455 * Returns the error string for the most recently occurring error. 456 */ 457 char *fiid_obj_errormsg (fiid_obj_t obj); 458 459 /* 460 * fiid_obj_len 461 * 462 * Returns the total length (in bits) of data stored within the 463 * object, -1 on error. 464 */ 465 int fiid_obj_len (fiid_obj_t obj); 466 467 /* 468 * fiid_obj_len_bytes 469 * 470 * Returns the total length (in bytes) of data stored within the 471 * object, -1 on error. Will return an error if the total bit length 472 * of data is not a multiple of 8. 473 */ 474 int fiid_obj_len_bytes (fiid_obj_t obj); 475 476 /* 477 * fiid_obj_field_len 478 * 479 * Returns the length (in bits) of data stored within the 480 * specified field, -1 on error. 481 */ 482 int fiid_obj_field_len (fiid_obj_t obj, const char *field); 483 484 /* 485 * fiid_obj_field_len_bytes 486 * 487 * Returns the length (in bytes) of data stored within the specified 488 * field, -1 on error. Will return an error if the bit length of data 489 * is not a multiple of 8. 490 */ 491 int fiid_obj_field_len_bytes (fiid_obj_t obj, const char *field); 492 493 /* 494 * fiid_obj_block_len 495 * 496 * Returns the length (in bits) of data stored within the block of 497 * fields beginning at 'field_start' and ending at 'field_end'. 498 * Returns -1 on error. 499 */ 500 int fiid_obj_block_len (fiid_obj_t obj, 501 const char *field_start, 502 const char *field_end); 503 504 /* 505 * fiid_obj_block_len_bytes 506 * 507 * Returns the length (in bytes) of data stored within the block of 508 * fields beginning at 'field_start' and ending at 'field_end'. 509 * Returns -1 on error. Will return an error if the calculated bit 510 * length is not a multiple of 8. 511 */ 512 int fiid_obj_block_len_bytes (fiid_obj_t obj, 513 const char *field_start, 514 const char *field_end); 515 516 /* 517 * fiid_obj_clear 518 * 519 * Clear all data stored in the object. Return 0 on success, -1 on 520 * error. 521 */ 522 int fiid_obj_clear (fiid_obj_t obj); 523 524 /* 525 * fiid_obj_clear_field 526 * 527 * Clear all data stored in a specified field in the object. Return 0 528 * on success, -1 on error. 529 */ 530 int fiid_obj_clear_field (fiid_obj_t obj, const char *field); 531 532 /* 533 * fiid_obj_field_lookup 534 * 535 * Returns 1 if the field is found in the object, 0 if not, -1 on 536 * error. 537 */ 538 int fiid_obj_field_lookup (fiid_obj_t obj, const char *field); 539 540 /* 541 * FIID_OBJ_FIELD_LOOKUP 542 * 543 * Returns 1 if the field is found in the object, -1 on error. 544 * Identical to fiid_obj_field_lookup() except a return of 0 is not 545 * possible. If the field is not found, -1 is returned and 546 * FIID_ERR_FIELD_NOT_FOUND is the error code set. 547 */ 548 int FIID_OBJ_FIELD_LOOKUP (fiid_obj_t obj, const char *field); 549 550 /* 551 * fiid_obj_set 552 * 553 * Set data in the object for the specified field. Returns 0 on 554 * success, -1 on error. 555 */ 556 int fiid_obj_set (fiid_obj_t obj, const char *field, uint64_t val); 557 558 /* 559 * fiid_obj_get 560 * 561 * Get data stored in the object for the specified field. Returns 1 562 * if data was available and returned, 0 if no data was available, -1 563 * on error. 564 */ 565 int fiid_obj_get (fiid_obj_t obj, const char *field, uint64_t *val); 566 567 /* 568 * FIID_OBJ_GET 569 * 570 * Get data stored in the object for the specified field. Returns 1 571 * if data was available and returned, -1 on error. Identical to 572 * fiid_obj_get() except a return of 0 is not possible. If no data is 573 * available, -1 is returned and FIID_ERR_DATA_NOT_AVAILABLE is the 574 * error code set. 575 */ 576 int FIID_OBJ_GET (fiid_obj_t obj, const char *field, uint64_t *val); 577 578 /* 579 * fiid_obj_set_data 580 * 581 * Set an array of data in the object for the specified field. 582 * Returns length of data set on success, -1 on error. The field 583 * specified must begin on a byte boundary and have a maximum bit 584 * length that is a multiple of 8. Will truncate the data written 585 * if the field maximum length is smaller than the data given. 586 */ 587 int fiid_obj_set_data (fiid_obj_t obj, 588 const char *field, 589 const void *data, 590 unsigned int data_len); 591 592 /* 593 * fiid_obj_get_data 594 * 595 * Get an array of data in the object for the specified field. 596 * Returns length of data read on success, -1 on error. The field 597 * specified must begin on a byte boundary and have a data bit length 598 * that is a multiple of 8. 599 */ 600 int fiid_obj_get_data (fiid_obj_t obj, 601 const char *field, 602 void *data, 603 unsigned int data_len); 604 605 /* 606 * fiid_obj_set_all 607 * 608 * Set all fields in the object with the specified array of data. 609 * Returns length of data set on success, -1 on error. The given data 610 * must fall on a byte boundary of the object. Will truncate the data 611 * written if the total object maximum length is smaller than the data 612 * given. Will write as much as possible if data is not large enough 613 * to fill the entire object. 614 */ 615 int fiid_obj_set_all (fiid_obj_t obj, const void *data, unsigned int data_len); 616 617 /* 618 * fiid_obj_get_all 619 * 620 * Get an array of all data in the object. Returns length of data 621 * read on success, -1 on error. 622 */ 623 int fiid_obj_get_all (fiid_obj_t obj, void *data, unsigned int data_len); 624 625 /* 626 * fiid_obj_set_block 627 * 628 * Set a block of fields in the object, beginning with 'field_start' 629 * and ending with 'field_end'. Returns length of data set on 630 * success, -1 on error. The fields given must fall on a byte 631 * boundary of the object. Will truncate the data written if the 632 * total block maximum length is smaller than the data given. Will 633 * write as much as possible if data is not large enough to fill the 634 * entire block. 635 */ 636 int fiid_obj_set_block (fiid_obj_t obj, 637 const char *field_start, 638 const char *field_end, 639 const void *data, 640 unsigned int data_len); 641 642 /* 643 * fiid_obj_get_block 644 * 645 * Get a block of data in the object, beginning with 'field_start' and 646 * ending with 'field_end'. Returns length of data read on success, 647 * -1 on error. Data being read must fall on a byte boundary. 648 */ 649 int fiid_obj_get_block (fiid_obj_t obj, 650 const char *field_start, 651 const char *field_end, 652 void *data, 653 unsigned int data_len); 654 655 /***************************** 656 * FIID Iterator API * 657 *****************************/ 658 659 /* 660 * fiid_iterator_create 661 * 662 * Create a fiid iterator to iteratate through each field in an 663 * object. Returns iterator on success, NULL on error. 664 */ 665 fiid_iterator_t fiid_iterator_create (fiid_obj_t obj); 666 667 /* 668 * fiid_iterator_destroy 669 * 670 * Destroy and free memory from a fiid iterator. 671 */ 672 void fiid_iterator_destroy (fiid_iterator_t iter); 673 674 /* 675 * fiid_iterator_errnum 676 * 677 * Returns the error code for the most recently occurring error. 678 */ 679 fiid_err_t fiid_iterator_errnum (fiid_iterator_t iter); 680 681 /* 682 * fiid_iterator_errormsg 683 * 684 * Returns the error string for the most recently occurring error. 685 */ 686 char *fiid_iterator_errormsg (fiid_iterator_t iter); 687 688 /* 689 * fiid_iterator_reset 690 * 691 * Reset the iterator back to the beginning. Returns 0 on success, -1 692 * on error. 693 */ 694 int fiid_iterator_reset (fiid_iterator_t iter); 695 696 /* 697 * fiid_iterator_next 698 * 699 * Move the iterator to the next field. Returns 0 on success, -1 on 700 * error. 701 */ 702 int fiid_iterator_next (fiid_iterator_t iter); 703 704 /* 705 * fiid_iterator_end 706 * 707 * Returns 1 if you are at the end of the iterator, 0 if not, -1 708 * error. 709 */ 710 int fiid_iterator_end (fiid_iterator_t iter); 711 712 /* 713 * fiid_iterator_field_len 714 * 715 * Returns the number of bits set for the current field. Returns -1 716 * on error. 717 */ 718 int fiid_iterator_field_len (fiid_iterator_t iter); 719 720 /* 721 * fiid_iterator_key 722 * 723 * Returns the key name for the current field. Returns NULL on error. 724 */ 725 char *fiid_iterator_key (fiid_iterator_t iter); 726 727 /* 728 * fiid_iterator_get 729 * 730 * Get data stored in the object for the current field. Returns 1 731 * if data was available and returned, 0 if no data was available, -1 732 * on error. 733 */ 734 int fiid_iterator_get (fiid_iterator_t iter, uint64_t *val); 735 736 /* 737 * fiid_iterator_get_data 738 * 739 * Get an array of data in the object for the current field. Returns 740 * length of data read on success, -1 on error. The current field 741 * must begin on a byte boundary and have a data bit length that is a 742 * multiple of 8. 743 */ 744 int fiid_iterator_get_data (fiid_iterator_t iter, 745 void *data, 746 unsigned int data_len); 747 748 #ifdef __cplusplus 749 } 750 #endif 751 752 #endif /* FIID_H */ 753