Go to the documentation of this file.
51 #include <sys/types.h>
57 #include <gnumalloc.h>
74 #include <sys/socket.h>
77 #include <netinet/in.h>
80 #include <arpa/inet.h>
113 printf(
"VARS: Creating.\n");
140 printf(
"VARS: Copying name, size (%d)\n", Len);
145 memcpy((
char *) New->
name, (
char *) Name, Len *
sizeof(
oid));
170 printf(
"VARS: Cloning.\n");
179 printf(
"VARS: Copying entire variable list. (Size %d)\n",
183 memcpy((
char *) Dest, (
char *) Src,
sizeof(
struct variable_list));
185 if (Src->name !=
NULL) {
186 Dest->name = (
oid *)
xmalloc(Src->name_length *
sizeof(
oid));
187 if (Dest->name ==
NULL) {
193 printf(
"VARS: Copying name OID. (Size %d)\n", Src->name_length);
195 memcpy((
char *) Dest->name, (
char *) Src->name,
196 Src->name_length *
sizeof(
oid));
199 if ((Src->val.string !=
NULL) &&
201 Dest->val.string = (u_char *)
xmalloc(Src->val_len);
202 if (Dest->val.string ==
NULL) {
209 printf(
"VARS: Copying value (Size %d)\n", Src->val_len);
211 memcpy((
char *) Dest->val.string, (
char *) Src->val.string, Src->val_len);
214 printf(
"VARS: Cloned %x.\n", (
unsigned int) Dest);
216 #if DEBUG_VARS_MALLOC
217 printf(
"VARS: Cloned (%x)\n", (
unsigned int) Dest);
218 printf(
"VARS: Name is (%x)\n", (
unsigned int) Dest->name);
267 int FakeArg = *BufLenP;
281 if (HeaderEnd ==
NULL)
294 switch (Vars->
type) {
357 if (HeaderEnd ==
NULL)
380 int AllVarLen = *BufLen;
384 #if DEBUG_VARS_DECODE
385 printf(
"VARS: Decoding buffer of length %d\n", *BufLen);
397 #if DEBUG_VARS_DECODE
398 printf(
"VARS: All Variable length %d\n", AllVarLen);
401 #define PARSE_ERROR { snmp_var_free(Var); return(NULL); }
404 while ((
int) AllVarLen > 0) {
412 ThisVarLen = AllVarLen;
420 AllVarLen = AllVarLen - (ThisVarLen + (tmp - bufp));
428 #if DEBUG_VARS_DECODE
429 printf(
"VARS: Header type 0x%x (%d bytes left)\n", VarBindType, ThisVarLen);
444 #if DEBUG_VARS_DECODE
445 printf(
"VARS: Decoded OBJID (%d bytes). (%d bytes left)\n",
451 DataLen = ThisVarLen;
457 ThisVarLen = DataLen;
459 #if DEBUG_VARS_DECODE
460 printf(
"VARS: Data type %d\n", Var->
type);
465 switch ((
short) Var->
type) {
477 #if DEBUG_VARS_DECODE
478 printf(
"VARS: Decoded integer '%d' (%d bytes left)\n",
496 #if DEBUG_VARS_DECODE
497 printf(
"VARS: Decoded timeticks '%d' (%d bytes left)\n",
511 int terminatorPos = Var->
val_len - 1;
515 if (Var->
val_len < terminatorPos) {
519 #if DEBUG_VARS_DECODE
520 printf(
"VARS: Decoded string '%s' (length %d) (%d bytes left)\n",
539 #if DEBUG_VARS_DECODE
540 printf(
"VARS: Decoded OBJID (length %d) (%d bytes left)\n",
565 #if DEBUG_VARS_DECODE
566 printf(
"VARS: Adding to list.\n");
union variable_list::@19 val
u_char * asn_build_int(u_char *, int *, u_char, int *, int)
u_char * asn_build_objid(u_char *, int *, u_char, oid *, int)
u_char * snmp_var_EncodeVarBind(u_char *Buffer, int *BufLenP, variable_list *VarList, int Version)
u_char * asn_build_unsigned_int(u_char *, int *, u_char, u_int *, int)
struct variable_list * snmp_var_new_integer(oid *Name, int Len, int ival, unsigned char type)
u_char * asn_build_header(u_char *, int *, u_char, int)
u_char * asn_build_null(u_char *, int *, u_char)
struct variable_list * snmp_var_new(oid *Name, int Len)
#define SMI_NOSUCHINSTANCE
u_char * asn_parse_string(u_char *, int *, u_char *, u_char *, int *)
u_char * snmp_var_DecodeVarBind(u_char *Buffer, int *BufLen, struct variable_list **VarP, int Version)
u_char * asn_parse_header(u_char *, int *, u_char *)
#define SNMPERR_PDU_PARSE
u_char * asn_parse_objid(u_char *, int *, u_char *, oid *, int *)
u_char * asn_build_string(u_char *, int *, u_char, u_char *, int)
void snmp_set_api_error(int)
u_char * asn_parse_unsigned_int(u_char *, int *, u_char *, u_int *, int)
#define SNMPERR_UNSUPPORTED_TYPE
SQUIDCEXTERN void snmplib_debug(int, const char *,...) PRINTF_FORMAT_ARG2
u_char * asn_parse_int(u_char *, int *, u_char *, int *, int)
struct variable_list * next_variable
void snmp_var_free(struct variable_list *Ptr)
u_char * asn_build_exception(u_char *, int *, u_char)
struct variable_list * snmp_var_clone(struct variable_list *Src)