Lines Matching refs:buf

17 unsigned int asn1buf_free(const asn1buf *buf);
19 * requires *buf is allocated
20 * effects Returns the number of unused, allocated octets in *buf.
22 #define asn1buf_free(buf) \
23 (((buf) == NULL || (buf)->base == NULL) \
25 : (unsigned int)((buf)->bound - (buf)->next + 1))
28 asn1_error_code asn1buf_ensure_space(asn1buf *buf, const unsigned int amount);
30 * requires *buf is allocated
31 * modifies *buf
32 * effects If buf has less than amount octets of free space, then it is
36 #define asn1buf_ensure_space(buf,amount) \
37 ((asn1buf_free(buf) < (amount)) \
38 ? (asn1buf_expand((buf), (amount)-asn1buf_free(buf))) \
41 asn1_error_code asn1buf_expand(asn1buf *buf, unsigned int inc);
43 * requires *buf is allocated
44 * modifies *buf
45 * effects Expands *buf by allocating space for inc more octets.
50 int asn1buf_len(const asn1buf *buf);
52 * requires *buf is allocated
53 * effects Returns the length of the encoding in *buf.
55 #define asn1buf_len(buf) ((buf)->next - (buf)->base)
96 asn1_error_code asn1buf_create(asn1buf **buf);
98 * effects Creates a new encoding buffer pointed to by *buf.
102 asn1_error_code asn1buf_wrap_data(asn1buf *buf, const krb5_data *code);
104 * requires *buf has already been allocated
105 * effects Turns *buf into a "wrapper" for *code. i.e. *buf is set up
111 asn1_error_code asn1buf_imbed(asn1buf *subbuf, const asn1buf *buf,
115 * requires *subbuf and *buf are allocated
116 * effects *subbuf becomes a sub-buffer of *buf. *subbuf begins
117 * at *buf's current position and is length octets long.
118 * (Unless this would exceed the bounds of *buf -- in
123 asn1_error_code asn1buf_sync(asn1buf *buf, asn1buf *subbuf, asn1_class Class,
128 * requires *subbuf is a sub-buffer of *buf, as created by asn1buf_imbed.
130 * effects Synchronizes *buf's current position to match that of *subbuf.
133 asn1_error_code asn1buf_skiptail(asn1buf *buf, const unsigned int length,
136 * requires *buf is a subbuffer used in a decoding of a
141 void asn1buf_destroy(asn1buf **buf);
142 /* effects Deallocates **buf, sets *buf to NULL. */
144 asn1_error_code asn1buf_insert_octet(asn1buf *buf, const int o);
146 * requires *buf is allocated
147 * effects Inserts o into the buffer *buf, expanding the buffer if
151 extern __inline__ asn1_error_code asn1buf_insert_octet(asn1buf *buf, const int o)
155 retval = asn1buf_ensure_space(buf,1U);
157 *(buf->next) = (char)o;
158 (buf->next)++;
165 asn1buf *buf,
169 * requires *buf is allocated
170 * modifies *buf
172 * into the buffer *buf, expanding the buffer if necessary.
179 asn1_error_code asn1buf_remove_octet(asn1buf *buf, asn1_octet *o);
181 * requires *buf is allocated
182 * effects Returns *buf's current octet in *o and advances to
184 * Returns ASN1_OVERRUN if *buf has already been exhausted.
186 #define asn1buf_remove_octet(buf,o) \
187 (((buf)->next > (buf)->bound) \
189 : ((*(o) = (asn1_octet)(*(((buf)->next)++))),0))
193 asn1buf *buf,
197 * requires *buf is allocated
198 * effects Removes the next len octets of *buf and returns them in **s.
200 * left in *buf.
205 asn1buf_remove_charstring(asn1buf *buf, const unsigned int len, char **s);
207 * requires *buf is allocated
208 * effects Removes the next len octets of *buf and returns them in **s.
210 * left in *buf.
214 asn1_error_code asn1buf_unparse(const asn1buf *buf, char **s);
217 * effects Returns a human-readable representation of *buf in *s,
218 * where each octet in *buf is represented by a character in *s.
221 asn1_error_code asn1buf_hex_unparse(const asn1buf *buf, char **s);
224 * effects Returns a human-readable representation of *buf in *s,
225 * where each octet in *buf is represented by a 2-digit
229 asn1_error_code asn12krb5_buf(const asn1buf *buf, krb5_data **code);
232 * effects Instantiates **code with the krb5_data representation of **buf.
235 int asn1buf_remains(asn1buf *buf, int indef);
237 * requires *buf is a buffer containing an asn.1 structure or array
238 * modifies *buf
239 * effects Returns the number of unprocessed octets remaining in *buf.