Correct PPTP server firewall rules chain.
[tomato/davidwu.git] / release / src / router / vsftpd / str.h
blobab0a9a443f117f92ae70722db93e24d6baf04454
1 #ifndef VSFTP_STR_H
2 #define VSFTP_STR_H
4 /* TODO - document these functions ;-) */
6 #ifndef VSF_FILESIZE_H
7 #include "filesize.h"
8 #endif
10 struct mystr
12 char* PRIVATE_HANDS_OFF_p_buf;
13 /* Internally, EXCLUDES trailing null */
14 unsigned int PRIVATE_HANDS_OFF_len;
15 unsigned int PRIVATE_HANDS_OFF_alloc_bytes;
18 #define INIT_MYSTR \
19 { (void*)0, 0, 0 }
21 #ifdef VSFTP_STRING_HELPER
22 #define str_alloc_memchunk private_str_alloc_memchunk
23 #endif
24 void private_str_alloc_memchunk(struct mystr* p_str, const char* p_src,
25 unsigned int len);
27 void str_alloc_text(struct mystr* p_str, const char* p_src);
28 /* NOTE: String buffer data does NOT include terminating character */
29 void str_alloc_alt_term(struct mystr* p_str, const char* p_src, char term);
30 void str_alloc_ulong(struct mystr* p_str, unsigned long the_ulong);
31 void str_alloc_filesize_t(struct mystr* p_str, filesize_t the_filesize);
32 void str_copy(struct mystr* p_dest, const struct mystr* p_src);
33 const char* str_strdup(const struct mystr* p_str);
34 void str_empty(struct mystr* p_str);
35 void str_free(struct mystr* p_str);
36 void str_trunc(struct mystr* p_str, unsigned int trunc_len);
37 void str_reserve(struct mystr* p_str, unsigned int res_len);
39 int str_isempty(const struct mystr* p_str);
40 unsigned int str_getlen(const struct mystr* p_str);
41 const char* str_getbuf(const struct mystr* p_str);
43 int str_strcmp(const struct mystr* p_str1, const struct mystr* p_str2);
44 int str_equal(const struct mystr* p_str1, const struct mystr* p_str2);
45 int str_equal_text(const struct mystr* p_str, const char* p_text);
47 void str_append_str(struct mystr* p_str, const struct mystr* p_other);
48 void str_append_text(struct mystr* p_str, const char* p_src);
49 void str_append_ulong(struct mystr* p_str, unsigned long the_long);
50 void str_append_filesize_t(struct mystr* p_str, filesize_t the_filesize);
51 void str_append_char(struct mystr* p_str, char the_char);
52 void str_append_double(struct mystr* p_str, double the_double);
54 void str_upper(struct mystr* p_str);
55 void str_rpad(struct mystr* p_str, const unsigned int min_width);
56 void str_lpad(struct mystr* p_str, const unsigned int min_width);
57 void str_replace_char(struct mystr* p_str, char from, char to);
58 void str_replace_text(struct mystr* p_str, const char* p_from,
59 const char* p_to);
61 void str_split_char(struct mystr* p_src, struct mystr* p_rhs, char c);
62 void str_split_char_reverse(struct mystr* p_src, struct mystr* p_rhs, char c);
63 void str_split_text(struct mystr* p_src, struct mystr* p_rhs,
64 const char* p_text);
65 void str_split_text_reverse(struct mystr* p_src, struct mystr* p_rhs,
66 const char* p_text);
68 struct str_locate_result
70 int found;
71 unsigned int index;
72 char char_found;
75 struct str_locate_result str_locate_char(
76 const struct mystr* p_str, char look_char);
77 struct str_locate_result str_locate_str(
78 const struct mystr* p_str, const struct mystr* p_look_str);
79 struct str_locate_result str_locate_str_reverse(
80 const struct mystr* p_str, const struct mystr* p_look_str);
81 struct str_locate_result str_locate_text(
82 const struct mystr* p_str, const char* p_text);
83 struct str_locate_result str_locate_text_reverse(
84 const struct mystr* p_str, const char* p_text);
85 struct str_locate_result str_locate_chars(
86 const struct mystr* p_str, const char* p_chars);
88 void str_left(const struct mystr* p_str, struct mystr* p_out,
89 unsigned int chars);
90 void str_right(const struct mystr* p_str, struct mystr* p_out,
91 unsigned int chars);
92 void str_mid_to_end(const struct mystr* p_str, struct mystr* p_out,
93 unsigned int indexx);
95 char str_get_char_at(const struct mystr* p_str, const unsigned int indexx);
96 int str_contains_space(const struct mystr* p_str);
97 int str_all_space(const struct mystr* p_str);
98 int str_contains_unprintable(const struct mystr* p_str);
99 void str_replace_unprintable(struct mystr* p_str, char new_char);
100 int str_atoi(const struct mystr* p_str);
101 filesize_t str_a_to_filesize_t(const struct mystr* p_str);
102 unsigned int str_octal_to_uint(const struct mystr* p_str);
104 /* PURPOSE: Extract a line of text (delimited by \n or EOF) from a string
105 * buffer, starting at character position 'p_pos'. The extracted line will
106 * not contain the '\n' terminator.
108 * RETURNS: 0 if no more lines are available, 1 otherwise.
109 * The extracted text line is stored in 'p_line_str', which is
110 * emptied if there are no more lines. 'p_pos' is updated to point to the
111 * first character after the end of the line just extracted.
113 int str_getline(const struct mystr* p_str, struct mystr* p_line_str,
114 unsigned int* p_pos);
116 /* PURPOSE: Detect whether or not a string buffer contains a specific line
117 * of text (delimited by \n or EOF).
119 * RETURNS: 1 if there is a matching line, 0 otherwise.
121 int str_contains_line(const struct mystr* p_str,
122 const struct mystr* p_line_str);
124 #endif /* VSFTP_STR_H */