Ignore:
Timestamp:
2010-11-25T13:42:50Z (13 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8df8415
Parents:
a93d79a (diff), eb667613 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/net/generic/packet_client.c

    ra93d79a r8fb1bf82  
    5353 * @param[in] data      The data to be copied.
    5454 * @param[in] length    The length of the copied data.
    55  * @returns             EOK on success.
    56  * @returns             EINVAL if the packet is not valid.
    57  * @returns             ENOMEM if there is not enough memory left.
    58  */
    59 int packet_copy_data(packet_t packet, const void *data, size_t length)
     55 * @return              EOK on success.
     56 * @return              EINVAL if the packet is not valid.
     57 * @return              ENOMEM if there is not enough memory left.
     58 */
     59int packet_copy_data(packet_t *packet, const void *data, size_t length)
    6060{
    6161        if (!packet_is_valid(packet))
     
    7878 * @param[in] length    The space length to be allocated at the beginning of the
    7979 *                      packet content.
    80  * @returns             The pointer to the allocated memory.
    81  * @returns             NULL if there is not enough memory left.
    82  */
    83 void *packet_prefix(packet_t packet, size_t length)
     80 * @return              The pointer to the allocated memory.
     81 * @return              NULL if there is not enough memory left.
     82 */
     83void *packet_prefix(packet_t *packet, size_t length)
    8484{
    8585        if ((!packet_is_valid(packet)) ||
    86             (packet->data_start - sizeof(struct packet) -
     86            (packet->data_start - sizeof(packet_t) -
    8787            2 * (packet->dest_addr - packet->src_addr) < length)) {
    8888                return NULL;
     
    9999 * @param[in] length    The space length to be allocated at the end of the
    100100 *                       packet content.
    101  * @returns             The pointer to the allocated memory.
    102  * @returns             NULL if there is not enough memory left.
    103  */
    104 void *packet_suffix(packet_t packet, size_t length)
     101 * @return              The pointer to the allocated memory.
     102 * @return              NULL if there is not enough memory left.
     103 */
     104void *packet_suffix(packet_t *packet, size_t length)
    105105{
    106106        if ((!packet_is_valid(packet)) ||
     
    120120 * @param[in] suffix    The suffix length to be removed from the end of the
    121121 *                      packet content.
    122  * @returns             EOK on success.
    123  * @returns             EINVAL if the packet is not valid.
    124  * @returns             ENOMEM if there is not enough memory left.
    125  */
    126 int packet_trim(packet_t packet, size_t prefix, size_t suffix)
     122 * @return              EOK on success.
     123 * @return              EINVAL if the packet is not valid.
     124 * @return              ENOMEM if there is not enough memory left.
     125 */
     126int packet_trim(packet_t *packet, size_t prefix, size_t suffix)
    127127{
    128128        if (!packet_is_valid(packet))
     
    140140 *
    141141 * @param[in] packet    The packet.
    142  * @returns             The packet identifier.
    143  * @returns             Zero if the packet is not valid.
    144  */
    145 packet_id_t packet_get_id(const packet_t packet)
     142 * @return              The packet identifier.
     143 * @return              Zero if the packet is not valid.
     144 */
     145packet_id_t packet_get_id(const packet_t *packet)
    146146{
    147147        return packet_is_valid(packet) ? packet->packet_id : 0;
     
    153153 * @param[out] src      The source address. May be NULL if not desired.
    154154 * @param[out] dest     The destination address. May be NULL if not desired.
    155  * @returns             The stored addresses length.
    156  * @returns             Zero if the addresses are not present.
    157  * @returns             EINVAL if the packet is not valid.
    158  */
    159 int packet_get_addr(const packet_t packet, uint8_t **src, uint8_t **dest)
     155 * @return              The stored addresses length.
     156 * @return              Zero if the addresses are not present.
     157 * @return              EINVAL if the packet is not valid.
     158 */
     159int packet_get_addr(const packet_t *packet, uint8_t **src, uint8_t **dest)
    160160{
    161161        if (!packet_is_valid(packet))
     
    174174 *
    175175 * @param[in] packet    The packet.
    176  * @returns             The packet content length in bytes.
    177  * @returns             Zero if the packet is not valid.
    178  */
    179 size_t packet_get_data_length(const packet_t packet)
     176 * @return              The packet content length in bytes.
     177 * @return              Zero if the packet is not valid.
     178 */
     179size_t packet_get_data_length(const packet_t *packet)
    180180{
    181181        if (!packet_is_valid(packet))
     
    188188 *
    189189 * @param[in] packet    The packet.
    190  * @returns             The pointer to the beginning of the packet content.
    191  * @returns             NULL if the packet is not valid.
    192  */
    193 void *packet_get_data(const packet_t packet)
     190 * @return              The pointer to the beginning of the packet content.
     191 * @return              NULL if the packet is not valid.
     192 */
     193void *packet_get_data(const packet_t *packet)
    194194{
    195195        if (!packet_is_valid(packet))
     
    205205 * @param[in] dest      The new destination address. May be NULL.
    206206 * @param[in] addr_len  The addresses length.
    207  * @returns             EOK on success.
    208  * @returns             EINVAL if the packet is not valid.
    209  * @returns             ENOMEM if there is not enough memory left.
     207 * @return              EOK on success.
     208 * @return              EINVAL if the packet is not valid.
     209 * @return              ENOMEM if there is not enough memory left.
    210210 */
    211211int
    212 packet_set_addr(packet_t packet, const uint8_t *src, const uint8_t *dest,
     212packet_set_addr(packet_t *packet, const uint8_t *src, const uint8_t *dest,
    213213    size_t addr_len)
    214214{
     
    254254 * @param[in] phone     The packet server module phone.
    255255 * @param[in] packet    The original packet.
    256  * @returns             The packet copy.
    257  * @returns             NULL on error.
    258  */
    259 packet_t packet_get_copy(int phone, packet_t packet)
    260 {
    261         packet_t copy;
     256 * @return              The packet copy.
     257 * @return              NULL on error.
     258 */
     259packet_t *packet_get_copy(int phone, packet_t *packet)
     260{
     261        packet_t *copy;
    262262        uint8_t * src = NULL;
    263263        uint8_t * dest = NULL;
Note: See TracChangeset for help on using the changeset viewer.