Changeset 89c57b6 in mainline for uspace/lib/c/include/adt/char_map.h


Ignore:
Timestamp:
2011-04-13T14:45:41Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
88634420
Parents:
cefb126 (diff), 17279ead (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 moved

Legend:

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

    rcefb126 r89c57b6  
    2727 */
    2828
    29 /** @addtogroup arp
     29/** @addtogroup libc
    3030 *  @{
    3131 */
    3232
    3333/** @file
    34  *  ARP module functions.
    35  *  The functions are used as ARP module entry points.
     34 *  Character string to integer map.
    3635 */
    3736
    38 #ifndef __NET_ARP_MODULE_H__
    39 #define __NET_ARP_MODULE_H__
     37#ifndef LIBC_CHAR_MAP_H_
     38#define LIBC_CHAR_MAP_H_
    4039
    41 #include <ipc/ipc.h>
     40#include <libarch/types.h>
    4241
    43 /** Initializes the ARP module.
    44  *  @param[in] client_connection The client connection processing function. The module skeleton propagates its own one.
    45  *  @returns EOK on success.
    46  *  @returns ENOMEM if there is not enough memory left.
     42/** Invalid assigned value used also if an&nbsp;entry does not exist. */
     43#define CHAR_MAP_NULL  (-1)
     44
     45/** Type definition of the character string to integer map.
     46 *  @see char_map
    4747 */
    48 int arp_initialize(async_client_conn_t client_connection);
     48typedef struct char_map char_map_t;
    4949
    50 /** Processes the ARP message.
    51  *  @param[in] callid The message identifier.
    52  *  @param[in] call The message parameters.
    53  *  @param[out] answer The message answer parameters.
    54  *  @param[out] answer_count The last parameter for the actual answer in the answer parameter.
    55  *  @returns EOK on success.
    56  *  @returns ENOTSUP if the message is not known.
    57  *  @see arp_interface.h
    58  *  @see IS_NET_ARP_MESSAGE()
     50/** Character string to integer map item.
     51 *
     52 * This structure recursivelly contains itself as a character by character tree.
     53 * The actually mapped character string consists of all the parent characters
     54 * and the actual one.
    5955 */
    60 int arp_message_standalone(ipc_callid_t callid, ipc_call_t * call, ipc_call_t * answer, int * answer_count);
     56struct char_map {
     57        /** Actually mapped character. */
     58        uint8_t c;
     59        /** Stored integral value. */
     60        int value;
     61        /** Next character array size. */
     62        int size;
     63        /** First free position in the next character array. */
     64        int next;
     65        /** Next character array. */
     66        char_map_t **items;
     67        /** Consistency check magic value. */
     68        int magic;
     69};
     70
     71extern int char_map_initialize(char_map_t *);
     72extern void char_map_destroy(char_map_t *);
     73extern int char_map_exclude(char_map_t *, const uint8_t *, size_t);
     74extern int char_map_add(char_map_t *, const uint8_t *, size_t, const int);
     75extern int char_map_find(const char_map_t *, const uint8_t *, size_t);
     76extern int char_map_update(char_map_t *, const uint8_t *, size_t, const int);
    6177
    6278#endif
Note: See TracChangeset for help on using the changeset viewer.