5 Author: Pekka Riikonen <priikone@silcnet.org>
7 Copyright (C) 2001 Pekka Riikonen
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; version 2 of the License.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
20 /****h* silccore/SilcArgumentAPI
24 * Implementation of the Arugment Payload, that is used to include
25 * argument to other payload that needs arguments.
32 /****f* silccore/SilcArgumentAPI/silc_argument_payload_parse
37 * silc_argument_payload_parse(const unsigned char *payload,
43 * Parses arguments and returns them into Argument Payload structure.
44 * the `buffer' is raw Argument Payload data buffer. The `argc' is
45 * the number of arguments in the Argument Payload. The caller must
46 * know the number of the arguments. This is always known as the
47 * Argument payload is associated with other payloads which defines
48 * the number of the arguments.
51 SilcArgumentPayload silc_argument_payload_parse(const unsigned char *payload,
55 /****f* silccore/SilcArgumentAPI/silc_argument_payload_encode
59 * SilcBuffer silc_argument_payload_encode(uint32 argc,
60 * unsigned char **argv,
62 * uint32 *argv_types);
66 * Encodes arguments in to Argument Paylods returning them to SilcBuffer.
67 * The `argv' is the array of the arguments, the `argv_lens' array of
68 * the length of the `argv' arguments and the `argv_types' array of
69 * the argument types of the `argv' arguments. The `argc' is the
70 * number of arguments.
73 SilcBuffer silc_argument_payload_encode(uint32 argc,
78 /****f* silccore/SilcArgumentAPI/silc_argument_payload_encode_payload
83 * silc_argument_payload_encode_payload(SilcArgumentPayload payload);
87 * Same as silc_argument_payload_encode but encodes the payload from
88 * already allocated SilcArgumentPayload structure instead of raw data.
91 SilcBuffer silc_argument_payload_encode_payload(SilcArgumentPayload payload);
93 /****f* silccore/SilcArgumentAPI/silc_argument_payload_free
97 * void silc_argument_payload_free(SilcArgumentPayload payload);
101 * Frees the Argument Payload and all data in it.
104 void silc_argument_payload_free(SilcArgumentPayload payload);
106 /****f* silccore/SilcArgumentAPI/silc_argument_get_arg_num
110 * uint32 silc_argument_get_arg_num(SilcArgumentPayload payload);
114 * Returns the number of argument in the Argument Payload.
117 uint32 silc_argument_get_arg_num(SilcArgumentPayload payload);
119 /****f* silccore/SilcArgumentAPI/silc_argument_get_first_arg
123 * unsigned char *silc_argument_get_first_arg(SilcArgumentPayload payload,
128 * Returns the first argument in the Argument Payload. The lenght
129 * of the argument is returned to `ret_len'. The caller must not
130 * free the returned argument. Returns NULL on error.
133 unsigned char *silc_argument_get_first_arg(SilcArgumentPayload payload,
136 /****f* silccore/SilcArgumentAPI/silc_argument_get_next_arg
140 * unsigned char *silc_argument_get_next_arg(SilcArgumentPayload payload,
145 * Returns next argument from the Argument Payload. The length of
146 * the argument is returned to `ret_len'. The caller must not free
147 * the returned argument. This returns NULL when there are no more
148 * arguments in the payload.
151 unsigned char *silc_argument_get_next_arg(SilcArgumentPayload payload,
154 /****f* silccore/SilcArgumentAPI/silc_argument_get_arg_type
158 * unsigned char *silc_argument_get_arg_type(SilcArgumentPayload payload,
164 * Returns argument by type. The returned argument has type `type'
165 * in the Argument Payload. Each argument has their own type (or zero
166 * if no specific type is set). The length of the argument is returned
167 * to the `ret_len'. The caller must not free the returned argument.
168 * Returns NULL on error.
171 unsigned char *silc_argument_get_arg_type(SilcArgumentPayload payload,