source: trunk/oscam-string.h@ 8434

Last change on this file since 8434 was 8434, checked in by gf, 9 years ago

webif: Create and use private templates array.

This allows storing of additional information along with templates
data (which is const).

For now we store name hash but in the future the data that comes from
struct templates (in webif/pages.c) may need to be preprocessed
(uncompressed for example) and the abstraction in this commit makes
it easier to do such changes.

File size: 1.4 KB
Line 
1#ifndef OSCAM_STRING_H_
2#define OSCAM_STRING_H_
3
4bool cs_malloc(void *result, size_t size) MUST_CHECK_RESULT;
5bool cs_realloc(void *result, size_t size) MUST_CHECK_RESULT;
6char *cs_strdup(const char *str);
7
8void cs_strncpy(char *destination, const char *source, size_t num);
9char *strtolower(char *txt);
10char *strtoupper(char *txt);
11char *trim(char *txt);
12char *remove_white_chars(char *txt);
13bool streq(const char *s1, const char *s2);
14
15char *cs_hexdump(int32_t m, const uchar *buf, int32_t n, char *target, int32_t len);
16
17int32_t gethexval(char c);
18
19int32_t cs_atob(uchar *buf, char *asc, int32_t n);
20uint32_t cs_atoi(char *asc, int32_t l, int32_t val_on_err);
21int32_t byte_atob(char *asc);
22int32_t word_atob(char *asc);
23int32_t dyn_word_atob(char *asc);
24int32_t key_atob_l(char *asc, uchar *bin, int32_t l);
25uint32_t b2i(int32_t n, const uchar *b);
26uint64_t b2ll(int32_t n, uchar *b);
27uchar *i2b_buf(int32_t n, uint32_t i, uchar *b);
28uint32_t a2i(char *asc, int32_t bytes);
29
30int32_t boundary(int32_t exp, int32_t n);
31
32int32_t check_filled(uchar *value, int32_t length);
33
34void get_random_bytes_init(void);
35void get_random_bytes(uint8_t *dst, uint32_t dst_len);
36
37unsigned long crc32(unsigned long crc, const unsigned char *buf, unsigned int len);
38uint32_t jhash(const char *key, size_t len);
39
40char to_hex(char code);
41void char_to_hex(const unsigned char *p_array, uint32_t p_array_len, unsigned char *result);
42
43#endif
Note: See TracBrowser for help on using the repository browser.