Fork us on GitHub Follow us on Facebook Follow us on Twitter

Ignore:
Timestamp:
2010-09-26T13:03:18Z (10 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
master
Children:
0402bda5
Parents:
7390870
Message:

Fix cstyle for measured strings.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/adt/measured_strings.h

    r7390870 redba2b6f  
    2727 */
    2828
    29 /** @addtogroup net
     29/** @addtogroup libc
    3030 *  @{
    3131 */
    3232
    3333/** @file
    34  *  Character string with measured length.
    35  *  The structure has been designed for serialization of character strings between modules.
     34 * Character string with measured length.
     35 * The structure has been designed for serialization of character strings
     36 * between modules.
    3637 */
    3738
     
    4445 *  @see measured_string
    4546 */
    46 typedef struct measured_string  measured_string_t;
     47typedef struct measured_string measured_string_t;
    4748
    4849/** Type definition of the character string with measured length pointer.
    4950 *  @see measured_string
    5051 */
    51 typedef measured_string_t *             measured_string_ref;
     52typedef measured_string_t *measured_string_ref;
    5253
    5354/** Character string with measured length.
    54  *  This structure has been designed for serialization of character strings between modules.
     55 *
     56 * This structure has been designed for serialization of character strings
     57 * between modules.
    5558 */
    56 struct  measured_string{
    57         /** Character string data.
    58          */
     59struct measured_string {
     60        /** Character string data. */
    5961        char * value;
    60         /** Character string length.
    61          */
     62        /** Character string length. */
    6263        size_t length;
    6364};
    6465
    65 /** Creates a&nbsp;new measured string bundled with a&nbsp;copy of the given string itself as one memory block.
    66  *  If the measured string is being freed, whole memory block is freed.
    67  *  The measured string should be used only as a&nbsp;constant.
    68  *  @param[in] string The initial character string to be stored.
    69  *  @param[in] length The length of the given string without the terminating zero ('/0') character. If the length is zero (0), the actual length is computed. The given length is used and appended with the terminating zero ('\\0') character otherwise.
    70  *  @returns The new bundled character string with measured length.
    71  *  @returns NULL if there is not enough memory left.
    72  */
    73 extern measured_string_ref measured_string_create_bulk(const char * string, size_t length);
    74 
    75 /** Copies the given measured string with separated header and data parts.
    76  *  @param[in] source The source measured string to be copied.
    77  *  @returns The copy of the given measured string.
    78  *  @returns NULL if the source parameter is NULL.
    79  *  @returns NULL if there is not enough memory left.
    80  */
    81 extern measured_string_ref measured_string_copy(measured_string_ref source);
    82 
    83 /** Receives a&nbsp;measured strings array from a&nbsp;calling module.
    84  *  Creates the array and the data memory blocks.
    85  *  This method should be used only while processing IPC messages as the array size has to be negotiated in advance.
    86  *  @param[out] strings The received measured strings array.
    87  *  @param[out] data The measured strings data. This memory block stores the actual character strings.
    88  *  @param[in] count The size of the measured strings array.
    89  *  @returns EOK on success.
    90  *  @returns EINVAL if the strings or data parameter is NULL.
    91  *  @returns EINVAL if the count parameter is zero (0).
    92  *  @returns EINVAL if the sent array differs in size.
    93  *  @returns EINVAL if there is inconsistency in sent measured strings' lengths (should not occur).
    94  *  @returns ENOMEM if there is not enough memory left.
    95  *  @returns Other error codes as defined for the async_data_write_finalize() function.
    96  */
    97 extern int measured_strings_receive(measured_string_ref * strings, char ** data, size_t count);
    98 
    99 /** Replies the given measured strings array to a&nbsp;calling module.
    100  *  This method should be used only while processing IPC messages as the array size has to be negotiated in advance.
    101  *  @param[in] strings The measured strings array to be transferred.
    102  *  @param[in] count The measured strings array size.
    103  *  @returns EOK on success.
    104  *  @returns EINVAL if the strings parameter is NULL.
    105  *  @returns EINVAL if the count parameter is zero (0).
    106  *  @returns EINVAL if the calling module does not accept the given array size.
    107  *  @returns EINVAL if there is inconsistency in sent measured strings' lengths (should not occur).
    108  *  @returns Other error codes as defined for the async_data_read_finalize() function.
    109  */
    110 extern int measured_strings_reply(const measured_string_ref strings, size_t count);
    111 
    112 /** Receives a&nbsp;measured strings array from another module.
    113  *  Creates the array and the data memory blocks.
    114  *  This method should be used only following other IPC messages as the array size has to be negotiated in advance.
    115  *  @param[in] phone The other module phone.
    116  *  @param[out] strings The returned measured strings array.
    117  *  @param[out] data The measured strings data. This memory block stores the actual character strings.
    118  *  @param[in] count The size of the measured strings array.
    119  *  @returns EOK on success.
    120  *  @returns EINVAL if the strings or data parameter is NULL.
    121  *  @returns EINVAL if the phone or count parameter is not positive (<=0).
    122  *  @returns EINVAL if the sent array differs in size.
    123  *  @returns ENOMEM if there is not enough memory left.
    124  *  @returns Other error codes as defined for the async_data_read_start() function.
    125  */
    126 extern int measured_strings_return(int phone, measured_string_ref * strings, char ** data, size_t count);
    127 
    128 /** Sends the given measured strings array to another module.
    129  *  This method should be used only following other IPC messages as the array size has to be negotiated in advance.
    130  *  @param[in] phone The other module phone.
    131  *  @param[in] strings The measured strings array to be transferred.
    132  *  @param[in] count The measured strings array size.
    133  *  @returns EOK on success.
    134  *  @returns EINVAL if the strings parameter is NULL.
    135  *  @returns EINVAL if the phone or count parameter is not positive (<=0).
    136  *  @returns Other error codes as defined for the async_data_write_start() function.
    137  */
    138 extern int measured_strings_send(int phone, const measured_string_ref strings, size_t count);
     66extern measured_string_ref measured_string_create_bulk(const char *, size_t);
     67extern measured_string_ref measured_string_copy(measured_string_ref);
     68extern int measured_strings_receive(measured_string_ref *, char **, size_t);
     69extern int measured_strings_reply(const measured_string_ref, size_t);
     70extern int measured_strings_return(int, measured_string_ref *, char **, size_t);
     71extern int measured_strings_send(int, const measured_string_ref, size_t);
    13972
    14073#endif
     
    14275/** @}
    14376 */
    144 
Note: See TracChangeset for help on using the changeset viewer.