1 /* 2 * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 3 * 4 * HDF is dual licensed: you can use it either under the terms of 5 * the GPL, or the BSD license, at your option. 6 * See the LICENSE file in the root of this repository for complete details. 7 */ 8 /** 9 * @addtogroup Core 10 * @{ 11 * 12 * @brief Provides functions to use the OpenHarmony Driver Foundation (HDF). 13 * 14 * The HDF implements driver framework capabilities such as driver loading, service management, driver message model, 15 * and power management. 16 * You can develop drivers based on the HDF. 17 * 18 * @since 1.0 19 */ 20 21 /** 22 * @file hdf_sbuf.h 23 * 24 * @brief Declares functions related to the HDF SBUF. The HDF provides data serialization and deserialization 25 * capabilities for data transmission between user-space applications and kernel-space drivers. 26 * 27 * @since 1.0 28 */ 29 30 #ifndef HDF_SBUF_H 31 #define HDF_SBUF_H 32 33 #include "hdf_base.h" 34 35 #ifdef __cplusplus 36 extern "C" { 37 #else 38 typedef uint16_t char16_t; 39 #endif /* __cplusplus */ 40 41 struct HdfSBuf; 42 struct HdfSBufImpl; 43 struct HdfRemoteService; 44 45 /** 46 * @brief Enumerates HDF SBUF types. 47 * 48 * @since 1.0 49 */ 50 enum HdfSbufType { 51 SBUF_RAW = 0, /* SBUF used for communication between the user space and the kernel space */ 52 SBUF_IPC, /* SBUF used for inter-process communication (IPC) */ 53 SBUF_IPC_HW, /* Reserved for extension */ 54 SBUF_TYPE_MAX, /* Maximum value of the SBUF type */ 55 }; 56 57 /** 58 * @brief Writes a data segment to a <b>SBuf</b>. 59 * 60 * @param sbuf Indicates the pointer to the target <b>SBuf</b>. 61 * @param data Indicates the pointer to the data segment to write. 62 * @param writeSize Indicates the size of the data segment to write. The maximum value is 512 KB. 63 * @return Returns <b>true</b> if the operation is successful; returns <b>false</b> otherwise. 64 * 65 * @since 1.0 66 */ 67 bool HdfSbufWriteBuffer(struct HdfSBuf *sbuf, const void *data, uint32_t writeSize); 68 69 /** 70 * @brief Writes unpadded data to a <b>SBuf</b>. You can call {@link HdfSbufReadUnpadBuffer} to read the unpadded data. 71 * 72 * @param sbuf Indicates the pointer to the target <b>SBuf</b>. 73 * @param data Indicates the pointer to the data to write. The value cannot be a null pointer. 74 * @param writeSize Indicates the size of the data to write. The value cannot be <b>0</b>. 75 * @return Returns <b>true</b> if the operation is successful; returns <b>false</b> otherwise. 76 * 77 * @since 1.0 78 */ 79 bool HdfSbufWriteUnpadBuffer(struct HdfSBuf *sbuf, const uint8_t *data, uint32_t writeSize); 80 81 /** 82 * @brief Writes a 64-bit unsigned integer to a <b>SBuf</b>. 83 * 84 * @param sbuf Indicates the pointer to the target <b>SBuf</b>. 85 * @param value Indicates the 64-bit unsigned integer to write. 86 * @return Returns <b>true</b> if the operation is successful; returns <b>false</b> otherwise. 87 * 88 * @since 1.0 89 */ 90 bool HdfSbufWriteUint64(struct HdfSBuf *sbuf, uint64_t value); 91 92 /** 93 * @brief Writes a 32-bit unsigned integer to a <b>SBuf</b>. 94 * 95 * @param sbuf Indicates the pointer to the target <b>SBuf</b>. 96 * @param value Indicates the 32-bit unsigned integer to write. 97 * @return Returns <b>true</b> if the operation is successful; returns <b>false</b> otherwise. 98 * 99 * @since 1.0 100 */ 101 bool HdfSbufWriteUint32(struct HdfSBuf *sbuf, uint32_t value); 102 103 /** 104 * @brief Writes a 16-bit unsigned integer to a <b>SBuf</b>. 105 * 106 * @param sbuf Indicates the pointer to the target <b>SBuf</b>. 107 * @param value Indicates the 16-bit unsigned integer to write. 108 * @return Returns <b>true</b> if the operation is successful; returns <b>false</b> otherwise. 109 * 110 * @since 1.0 111 */ 112 bool HdfSbufWriteUint16(struct HdfSBuf *sbuf, uint16_t value); 113 114 /** 115 * @brief Writes an 8-bit unsigned integer to a <b>SBuf</b>. 116 * 117 * @param sbuf Indicates the pointer to the target <b>SBuf</b>. 118 * @param value Indicates the 8-bit unsigned integer to write. 119 * @return Returns <b>true</b> if the operation is successful; returns <b>false</b> otherwise. 120 * 121 * @since 1.0 122 */ 123 bool HdfSbufWriteUint8(struct HdfSBuf *sbuf, uint8_t value); 124 125 /** 126 * @brief Writes a 64-bit signed integer to a <b>SBuf</b>. 127 * 128 * @param sbuf Indicates the pointer to the target <b>SBuf</b>. 129 * @param value Indicates the 64-bit signed integer to write. 130 * @return Returns <b>true</b> if the operation is successful; returns <b>false</b> otherwise. 131 * 132 * @since 1.0 133 */ 134 bool HdfSbufWriteInt64(struct HdfSBuf *sbuf, int64_t value); 135 136 /** 137 * @brief Writes a 32-bit signed integer to a <b>SBuf</b>. 138 * 139 * @param sbuf Indicates the pointer to the target <b>SBuf</b>. 140 * @param value Indicates the 32-bit signed integer to write. 141 * @return Returns <b>true</b> if the operation is successful; returns <b>false</b> otherwise. 142 * 143 * @since 1.0 144 */ 145 bool HdfSbufWriteInt32(struct HdfSBuf *sbuf, int32_t value); 146 147 /** 148 * @brief Writes a 16-bit signed integer to a <b>SBuf</b>. 149 * 150 * @param sbuf Indicates the pointer to the target <b>SBuf</b>. 151 * @param value Indicates the 16-bit signed integer to write. 152 * @return Returns <b>true</b> if the operation is successful; returns <b>false</b> otherwise. 153 * 154 * @since 1.0 155 */ 156 bool HdfSbufWriteInt16(struct HdfSBuf *sbuf, int16_t value); 157 158 /** 159 * @brief Writes an 8-bit signed integer to a <b>SBuf</b>. 160 * 161 * @param sbuf Indicates the pointer to the target <b>SBuf</b>. 162 * @param value Indicates the 8-bit signed integer to write. 163 * @return Returns <b>true</b> if the operation is successful; returns <b>false</b> otherwise. 164 * 165 * @since 1.0 166 */ 167 bool HdfSbufWriteInt8(struct HdfSBuf *sbuf, int8_t value); 168 169 /** 170 * @brief Writes a string to a <b>SBuf</b>. 171 * 172 * @param sbuf Indicates the pointer to the target <b>SBuf</b>. 173 * @param value Indicates the pointer to the string to write. 174 * @return Returns <b>true</b> if the operation is successful; returns <b>false</b> otherwise. 175 * 176 * @since 1.0 177 */ 178 bool HdfSbufWriteString(struct HdfSBuf *sbuf, const char *value); 179 180 /** 181 * @brief Writes a wide character string to a <b>SBuf</b>. 182 * The SBUF of the <b>SBUF_RAW</b> type does not support this function. 183 * 184 * @param sbuf Indicates the pointer to the target <b>SBuf</b>. 185 * @param value Indicates the pointer to the wide character string to write. 186 * @param size Indicates the size of the wide character string to write. 187 * @return Returns <b>true</b> if the operation is successful; returns <b>false</b> otherwise. 188 * 189 * @since 1.0 190 */ 191 bool HdfSbufWriteString16(struct HdfSBuf *sbuf, const char16_t *value, uint32_t size); 192 193 /** 194 * @brief Writes a floating-point number to a <b>SBuf</b>. 195 * The SBUF of the <b>SBUF_RAW</b> type does not support this function. 196 * 197 * @param sbuf Indicates the pointer to the target <b>SBuf</b>. 198 * @param value Indicates the floating-point number to write. 199 * @return Returns <b>true</b> if the operation is successful; returns <b>false</b> otherwise. 200 * 201 * @since 1.0 202 */ 203 bool HdfSbufWriteFloat(struct HdfSBuf *sbuf, float data); 204 205 /** 206 * @brief Writes a double-precision floating-point number to a <b>SBuf</b>. 207 * The SBUF of the <b>SBUF_RAW</b> type does not support this function. 208 * 209 * @param sbuf Indicates the pointer to the target <b>SBuf</b>. 210 * @param value Indicates the double-precision floating-point number to write. 211 * @return Returns <b>true</b> if the operation is successful; returns <b>false</b> otherwise. 212 * 213 * @since 1.0 214 */ 215 bool HdfSbufWriteDouble(struct HdfSBuf *sbuf, double data); 216 217 /** 218 * @brief Writes a file descriptor to a <b>SBuf</b>. 219 * The SBUF of the <b>SBUF_RAW</b> type does not support this function. 220 * 221 * @param sbuf Indicates the pointer to the target <b>SBuf</b>. 222 * @param fd Indicates the file descriptor to write. 223 * @return Returns <b>true</b> if the operation is successful; returns <b>false</b> otherwise. 224 * 225 * @since 1.0 226 */ 227 bool HdfSbufWriteFileDescriptor(struct HdfSBuf *sbuf, int fd); 228 229 /** 230 * @brief Writes an IPC service to a <b>SBuf</b>. The SBUF of the <b>SBUF_RAW</b> type does not support this function. 231 * 232 * @param sbuf Indicates the pointer to the target <b>SBuf</b>. 233 * @param service Indicates the pointer to the IPC service to write. 234 * @return Returns <b>0</b> if the operation is successful; returns a negative value otherwise. 235 * 236 * @since 1.0 237 */ 238 int32_t HdfSbufWriteRemoteService(struct HdfSBuf *sbuf, const struct HdfRemoteService *service); 239 240 /** 241 * @brief Reads an IPC service from a <b>SBuf</b>. 242 * The SBUF of the <b>SBUF_RAW</b> type does not support this function. 243 * 244 * @param sbuf Indicates the pointer to the target <b>SBuf</b>. 245 * @return Returns the pointer to the IPC service object if the operation is successful; 246 * returns a null pointer otherwise. 247 * 248 * @since 1.0 249 */ 250 struct HdfRemoteService *HdfSbufReadRemoteService(struct HdfSBuf *sbuf); 251 252 /** 253 * @brief Reads a file descriptor from a <b>SBuf</b>. 254 * The SBUF of the <b>SBUF_RAW</b> type does not support this function. 255 * 256 * @param sbuf Indicates the pointer to the target <b>SBuf</b>. 257 * @return Returns a valid file descriptor if the operation is successful; returns a negative value otherwise. 258 * 259 * @since 1.0 260 */ 261 int HdfSbufReadFileDescriptor(struct HdfSBuf *sbuf); 262 263 /** 264 * @brief Reads a double-precision floating-point number from a <b>SBuf</b>. 265 * The SBUF of the <b>SBUF_RAW</b> type does not support this function. 266 * 267 * @param sbuf Indicates the pointer to the target <b>SBuf</b>. 268 * @param value Indicates the pointer to the double-precision floating-point number read, 269 * which is requested by the caller. 270 * @return Returns <b>true</b> if the operation is successful; returns <b>false</b> otherwise. 271 * 272 * @since 1.0 273 */ 274 bool HdfSbufReadDouble(struct HdfSBuf *sbuf, double *data); 275 276 /** 277 * @brief Reads a floating-point number from a <b>SBuf</b>. 278 * The SBUF of the <b>SBUF_RAW</b> type does not support this function. 279 * 280 * @param sbuf Indicates the pointer to the target <b>SBuf</b>. 281 * @param value Indicates the pointer to the floating-point number read, which is requested by the caller. 282 * @return Returns <b>true</b> if the operation is successful; returns <b>false</b> otherwise. 283 * 284 * @since 1.0 285 */ 286 bool HdfSbufReadFloat(struct HdfSBuf *sbuf, float *data); 287 288 /** 289 * @brief Reads a wide character string from a <b>SBuf</b>. 290 * The SBUF of the <b>SBUF_RAW</b> type does not support this function. 291 * 292 * @param sbuf Indicates the pointer to the target <b>SBuf</b>. 293 * @return Returns the pointer to the wide character string if the operation is successful; 294 * returns a null pointer otherwise. 295 * 296 * @since 1.0 297 */ 298 const char16_t *HdfSbufReadString16(struct HdfSBuf *sbuf); 299 300 /** 301 * @brief Reads a data segment from a <b>SBuf</b>. 302 * 303 * @param sbuf Indicates the pointer to the target <b>SBuf</b>. 304 * @param data Indicates the double pointer to the data read. The data read is stored in <b>*data</b>, 305 * which is requested by the caller. The memory pointed to by <b>*data</b> is managed by 306 * the <b>SBuf</b> and they share the same lifecycle. 307 * @param readSize Indicates the pointer to the size of the data read. 308 * @return Returns <b>true</b> if the operation is successful; returns <b>false</b> otherwise. 309 * 310 * @since 1.0 311 */ 312 bool HdfSbufReadBuffer(struct HdfSBuf *sbuf, const void **data, uint32_t *readSize); 313 314 /** 315 * @brief Reads unpadded data from a <b>SBuf</b>. 316 * 317 * @param sbuf Indicates the pointer to the target <b>SBuf</b>. 318 * @param length Indicates the length of the data to read. 319 * @return Returns the pointer to the unpadded data if the operation is successful; returns a null pointer otherwise. 320 * 321 * @since 1.0 322 */ 323 const uint8_t *HdfSbufReadUnpadBuffer(struct HdfSBuf *sbuf, size_t length); 324 325 /** 326 * @brief Reads a 64-bit unsigned integer from a <b>SBuf</b>. 327 * 328 * @param sbuf Indicates the pointer to the target <b>SBuf</b>. 329 * @param value Indicates the pointer to the 64-bit unsigned integer read, which is requested by the caller. 330 * @return Returns <b>true</b> if the operation is successful; returns <b>false</b> otherwise. 331 * 332 * @since 1.0 333 */ 334 bool HdfSbufReadUint64(struct HdfSBuf *sbuf, uint64_t *value); 335 336 /** 337 * @brief Reads a 32-bit unsigned integer from a <b>SBuf</b>. 338 * 339 * @param sbuf Indicates the pointer to the target <b>SBuf</b>. 340 * @param value Indicates the pointer to the 32-bit unsigned integer read, which is requested by the caller. 341 * @return Returns <b>true</b> if the operation is successful; returns <b>false</b> otherwise. 342 * 343 * @since 1.0 344 */ 345 bool HdfSbufReadUint32(struct HdfSBuf *sbuf, uint32_t *value); 346 347 /** 348 * @brief Reads a 16-bit unsigned integer from a <b>SBuf</b>. 349 * 350 * @param sbuf Indicates the pointer to the target <b>SBuf</b>. 351 * @param value Indicates the pointer to the 16-bit unsigned integer read, which is requested by the caller. 352 * @return Returns <b>true</b> if the operation is successful; returns <b>false</b> otherwise. 353 * 354 * @since 1.0 355 */ 356 bool HdfSbufReadUint16(struct HdfSBuf *sbuf, uint16_t *value); 357 358 /** 359 * @brief Reads an 8-bit unsigned integer from a <b>SBuf</b>. 360 * 361 * @param sbuf Indicates the pointer to the target <b>SBuf</b>. 362 * @param value Indicates the pointer to the 8-bit unsigned integer read, which is requested by the caller. 363 * @return Returns <b>true</b> if the operation is successful; returns <b>false</b> otherwise. 364 * 365 * @since 1.0 366 */ 367 bool HdfSbufReadUint8(struct HdfSBuf *sbuf, uint8_t *value); 368 369 /** 370 * @brief Reads a 64-bit signed integer from a <b>SBuf</b>. 371 * 372 * @param sbuf Indicates the pointer to the target <b>SBuf</b>. 373 * @param value Indicates the pointer to the 64-bit signed integer read, which is requested by the caller. 374 * @return Returns <b>true</b> if the operation is successful; returns <b>false</b> otherwise. 375 * 376 * @since 1.0 377 */ 378 bool HdfSbufReadInt64(struct HdfSBuf *sbuf, int64_t *value); 379 380 /** 381 * @brief Reads a 32-bit signed integer from a <b>SBuf</b>. 382 * 383 * @param sbuf Indicates the pointer to the target <b>SBuf</b>. 384 * @param value Indicates the pointer to the 32-bit signed integer read, which is requested by the caller. 385 * @return Returns <b>true</b> if the operation is successful; returns <b>false</b> otherwise. 386 * 387 * @since 1.0 388 */ 389 bool HdfSbufReadInt32(struct HdfSBuf *sbuf, int32_t *value); 390 391 /** 392 * @brief Reads a 16-bit signed integer from a <b>SBuf</b>. 393 * 394 * @param sbuf Indicates the pointer to the target <b>SBuf</b>. 395 * @param value Indicates the pointer to the 16-bit signed integer read, which is requested by the caller. 396 * @return Returns <b>true</b> if the operation is successful; returns <b>false</b> otherwise. 397 * 398 * @since 1.0 399 */ 400 bool HdfSbufReadInt16(struct HdfSBuf *sbuf, int16_t *value); 401 402 /** 403 * @brief Reads an 8-bit signed integer from a <b>SBuf</b>. 404 * 405 * @param sbuf Indicates the pointer to the target <b>SBuf</b>. 406 * @param value Indicates the pointer to the 8-bit signed integer read, which is requested by the caller. 407 * @return Returns <b>true</b> if the operation is successful; returns <b>false</b> otherwise. 408 * 409 * @since 1.0 410 */ 411 bool HdfSbufReadInt8(struct HdfSBuf *sbuf, int8_t *value); 412 413 /** 414 * @brief Reads a string from a <b>SBuf</b>. 415 * 416 * @param sbuf Indicates the pointer to the target <b>SBuf</b>. 417 * @return Returns the pointer to the string read if the operation is successful; returns <b>NULL</b> otherwise. 418 * The memory pointed to by this pointer is managed by the <b>SBuf</b> and they share the same lifecycle. 419 * 420 * @since 1.0 421 */ 422 const char *HdfSbufReadString(struct HdfSBuf *sbuf); 423 424 /** 425 * @brief Obtains the pointer to the data stored in a <b>SBuf</b>. 426 * 427 * @param sbuf Indicates the pointer to the target <b>SBuf</b>. 428 * @return Returns the pointer to the data stored in the target <b>SBuf</b> if the operation is successful; 429 * returns a null pointer otherwise. 430 * 431 * @since 1.0 432 */ 433 uint8_t *HdfSbufGetData(const struct HdfSBuf *sbuf); 434 435 /** 436 * @brief Clears the data stored in a <b>SBuf</b>. 437 * 438 * @param sbuf Indicates the pointer to the target <b>SBuf</b>. 439 * 440 * @since 1.0 441 */ 442 void HdfSbufFlush(struct HdfSBuf *sbuf); 443 444 /** 445 * @brief Obtains the capacity of a <b>SBuf</b>. 446 * 447 * @param sbuf Indicates the pointer to the target <b>SBuf</b>. 448 * @return Returns the <b>SBuf</b> capacity. 449 * 450 * @since 1.0 451 */ 452 size_t HdfSbufGetCapacity(const struct HdfSBuf *sbuf); 453 454 /** 455 * @brief Obtains the size of the data stored in a <b>SBuf</b>. 456 * 457 * @param sbuf Indicates the pointer to the target <b>SBuf</b>. 458 * @return Returns the data size. 459 * 460 * @since 1.0 461 */ 462 size_t HdfSbufGetDataSize(const struct HdfSBuf *sbuf); 463 464 /** 465 * @brief Sets the data size of a <b>SBuf</b>. 466 * 467 * @param sbuf Indicates the pointer to the target <b>SBuf</b>. 468 * @param size Indicates the data size to set, which cannot exceed the size obtained via {@link HdfSbufGetDataSize}. 469 * 470 * @since 1.0 471 */ 472 void HdfSbufSetDataSize(struct HdfSBuf *sbuf, size_t size); 473 474 /** 475 * @brief Obtains a <b>SBuf</b> instance. 476 * 477 * @param capacity Indicates the initial capacity of the <b>SBuf</b>. 478 * @return Returns the <b>SBuf</b> instance. 479 * 480 * @since 1.0 481 */ 482 struct HdfSBuf *HdfSbufObtain(size_t capacity); 483 484 /** 485 * @brief Obtains a <b>SBuf</b> instance of the default capacity (256 bytes). 486 * 487 * @return Returns the <b>SBuf</b> instance. 488 * 489 * @since 1.0 490 */ 491 struct HdfSBuf *HdfSbufObtainDefaultSize(void); 492 493 /** 494 * @brief Creates a <b>SBuf</b> instance with the specified data and size. 495 * The pointer to the data stored in the <b>SBuf</b> is released by the caller, 496 * and the written data size should not exceed the specified value of <b>size</b>. 497 * 498 * @param base Indicates the base of the data to use. 499 * @param size Indicates the size of the data to use. 500 * @return Returns the <b>SBuf</b> instance. 501 * 502 * @since 1.0 503 */ 504 struct HdfSBuf *HdfSbufBind(uintptr_t base, size_t size); 505 506 /** 507 * @brief Releases a <b>SBuf</b>. 508 * 509 * @param sbuf Indicates the pointer to the target <b>SBuf</b>. 510 * 511 * @since 1.0 512 */ 513 void HdfSbufRecycle(struct HdfSBuf *sbuf); 514 515 /** 516 * @brief Creates a <b>SBuf</b> instance with an original <b>SBuf</b>. 517 * This function moves the data stored in the original <b>SBuf</b> to the new one without memory copy. 518 * 519 * @param sbuf Indicates the pointer to the original <b>SBuf</b>. 520 * @return Returns the new <b>SBuf</b> instance. 521 * 522 * @since 1.0 523 */ 524 struct HdfSBuf *HdfSbufMove(struct HdfSBuf *sbuf); 525 526 /** 527 * @brief Creates a <b>SBuf</b> instance with an original <b>SBuf</b>. 528 * This function copies the data stored in the original <b>SBuf</b> to the new one. 529 * 530 * @param sbuf Indicates the pointer to the original <b>SBuf</b>. 531 * @return Returns the new <b>SBuf</b> instance. 532 * 533 * @since 1.0 534 */ 535 struct HdfSBuf *HdfSbufCopy(const struct HdfSBuf *sbuf); 536 537 /** 538 * @brief Transfers the data ownership to a <b>SBuf</b>. Once the <b>SBuf</b> is released, 539 * the bound data memory is also released. This function is used together with {@link HdfSbufBind}. 540 * 541 * @param sbuf Indicates the pointer to the target <b>SBuf</b>. 542 * 543 * @since 1.0 544 */ 545 void HdfSbufTransDataOwnership(struct HdfSBuf *sbuf); 546 547 /** 548 * @brief Obtains a <b>SBuf</b> instance of a specified type. 549 * 550 * @param type Indicates the SBUF type, which is defined in {@link HdfSbufType}. 551 * @return Returns the <b>SBuf</b> instance. 552 * 553 * @since 1.0 554 */ 555 struct HdfSBuf *HdfSbufTypedObtain(uint32_t type); 556 557 /** 558 * @brief Obtains a <b>SBuf</b> instance of a specified type based on the implementation of an existing <b>SBuf</b>. 559 * 560 * @param type Indicates the SBUF type, which is defined in {@link HdfSbufType}. 561 * @param impl Indicates the pointer to the implementation of an existing <b>SBuf</b>. 562 * @return Returns the new <b>SBuf</b> instance. 563 * 564 * @since 1.0 565 */ 566 struct HdfSBuf *HdfSbufTypedObtainInplace(uint32_t type, struct HdfSBufImpl *impl); 567 568 /** 569 * @brief Obtains a <b>SBuf</b> instance of a specified type with the given initial capacity. 570 * 571 * @param type Indicates the SBUF type, which is defined in {@link HdfSbufType}. 572 * @param capacity Indicates the initial capacity of the <b>SBuf</b>. 573 * @return Returns the new <b>SBuf</b> instance. 574 * 575 * @since 1.0 576 */ 577 struct HdfSBuf *HdfSbufTypedObtainCapacity(uint32_t type, size_t capacity); 578 579 /** 580 * @brief Creates a <b>SBuf</b> instance of a specified type with the specified data and size. 581 * The pointer to the data stored in the <b>SBuf</b> is released by the caller, 582 * and the written data size should not exceed the specified value of <b>size</b>. 583 * 584 * @param type Indicates the SBUF type, which is defined in {@link HdfSbufType}. 585 * @param base Indicates the base of the data to use. 586 * @param size Indicates the size of the data to use. 587 * @return Returns the <b>SBuf</b> instance. 588 * 589 * @since 1.0 590 */ 591 struct HdfSBuf *HdfSbufTypedBind(uint32_t type, uintptr_t base, size_t size); 592 593 /** 594 * @brief Obtains the implementation of a <b>SBuf</b>. 595 * 596 * @param sbuf Indicates the pointer to the target <b>SBuf</b>. 597 * @return Returns the pointer to the implementation of the <b>SBuf</b>. 598 * 599 * @since 1.0 600 */ 601 struct HdfSBufImpl *HdfSbufGetImpl(struct HdfSBuf *sbuf); 602 603 #ifdef __cplusplus 604 } 605 #endif /* __cplusplus */ 606 607 #endif /* HDF_SBUF_H */ 608 /** @} */ 609