Go to the source code of this file.
 | 
| #define  | ATTR(attr,  type,  string,  min,  max) | 
|   | 
| #define  | UNASSIGNED(attr) | 
|   | 
| #define  | ATTRIBUTES(fields) | 
|   | 
| #define  | INTEGER(name,  octets) | 
|   | 
| #define  | OCTETS(name,  field_giving_octets) | 
|   | 
| #define  | PDU(name,  id,  fields)   name = id, | 
|   | 
| #define  | ATTR(attr,  type,  string,  min,  max) | 
|   | 
| #define  | UNASSIGNED(attr) | 
|   | 
| #define  | ATTRIBUTES(fields) | 
|   | 
| #define  | INTEGER(name,  octets)   unsigned long name; | 
|   | 
| #define  | NULTERMINATED(name,  max_octets)   Octstr *name; | 
|   | 
| #define  | OCTETS(name,  field_giving_octets)   Octstr *name; | 
|   | 
| #define  | PDU(name,  id,  fields)   struct name { fields } name; | 
|   | 
◆ ATTR [1/2]
      
        
          | #define ATTR | 
          ( | 
            | 
          attr,  | 
        
        
           | 
           | 
            | 
          type,  | 
        
        
           | 
           | 
            | 
          string,  | 
        
        
           | 
           | 
            | 
          min,  | 
        
        
           | 
           | 
            | 
          max  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
 
◆ ATTR [2/2]
      
        
          | #define ATTR | 
          ( | 
            | 
          attr,  | 
        
        
           | 
           | 
            | 
          type,  | 
        
        
           | 
           | 
            | 
          string,  | 
        
        
           | 
           | 
            | 
          min,  | 
        
        
           | 
           | 
            | 
          max  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
 
◆ ATTRIBUTES [1/2]
      
        
          | #define ATTRIBUTES | 
          ( | 
            | 
          fields | ) | 
           | 
        
      
 
 
◆ ATTRIBUTES [2/2]
      
        
          | #define ATTRIBUTES | 
          ( | 
            | 
          fields | ) | 
           | 
        
      
 
 
◆ INTEGER [1/2]
      
        
          | #define INTEGER | 
          ( | 
            | 
          name,  | 
        
        
           | 
           | 
            | 
          octets  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
 
◆ INTEGER [2/2]
      
        
          | #define INTEGER | 
          ( | 
            | 
          name,  | 
        
        
           | 
           | 
            | 
          octets  | 
        
        
           | 
          ) | 
           |    unsigned long name; | 
        
      
 
 
◆ NULTERMINATED
◆ OCTETS [1/2]
      
        
          | #define OCTETS | 
          ( | 
            | 
          name,  | 
        
        
           | 
           | 
            | 
          field_giving_octets  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
 
◆ OCTETS [2/2]
◆ PDU [1/2]
      
        
          | #define PDU | 
          ( | 
            | 
          name,  | 
        
        
           | 
           | 
            | 
          id,  | 
        
        
           | 
           | 
            | 
          fields  | 
        
        
           | 
          ) | 
           |    name = id, | 
        
      
 
 
◆ PDU [2/2]
      
        
          | #define PDU | 
          ( | 
            | 
          name,  | 
        
        
           | 
           | 
            | 
          id,  | 
        
        
           | 
           | 
            | 
          fields  | 
        
        
           | 
          ) | 
           |    struct name { fields } name; | 
        
      
 
 
◆ UNASSIGNED [1/2]
      
        
          | #define UNASSIGNED | 
          ( | 
            | 
          attr | ) | 
           | 
        
      
 
 
◆ UNASSIGNED [2/2]
      
        
          | #define UNASSIGNED | 
          ( | 
            | 
          attr | ) | 
           | 
        
      
 
 
◆ RADIUS_PDU
◆ anonymous enum
| Enumerator | 
|---|
| t_int  |  | 
| t_string  |  | 
| t_ipaddr  |  | 
Definition at line 72 of file radius_pdu.h.
 
 
◆ anonymous enum
| Enumerator | 
|---|
| ATTRIBUTES  |  | 
| ATTRIBUTES  |  | 
Definition at line 76 of file radius_pdu.h.
   77     #define ATTR(attr, type, string, min, max)    78     #define UNASSIGNED(attr)    79     #define ATTRIBUTES(fields)    81     #define INTEGER(name, octets)    82     #define OCTETS(name, field_giving_octets)    83     #define PDU(name, id, fields) name = id, 
 
 
 
◆ radius_authenticate_pdu()
Definition at line 416 of file radius_pdu.c.
References md5(), octstr_append(), octstr_append_data(), octstr_compare(), octstr_copy, octstr_delete(), octstr_destroy(), octstr_duplicate, octstr_insert(), octstr_len(), RADIUS_PDU::type, and RADIUS_PDU::u.
Referenced by main(), proxy_thread(), and server().
  423     stream = attributes = digest = NULL;
   437             digest = 
md5(stream);
   439                                 digest) == 0 ? 1 : 0;
   444             digest = 
md5(stream);
 Octstr * md5(Octstr *data)
 
void octstr_append_data(Octstr *ostr, const char *data, long len)
 
void octstr_append(Octstr *ostr1, const Octstr *ostr2)
 
#define octstr_copy(ostr, from, len)
 
void octstr_insert(Octstr *ostr1, const Octstr *ostr2, long pos)
 
void octstr_delete(Octstr *ostr1, long pos, long len)
 
#define octstr_duplicate(ostr)
 
void octstr_destroy(Octstr *ostr)
 
long octstr_len(const Octstr *ostr)
 
int octstr_compare(const Octstr *ostr1, const Octstr *ostr2)
 
 
 
 
◆ radius_get_attribute()
◆ radius_pdu_create()
Definition at line 123 of file radius_pdu.c.
References error(), RADIUS_PDU::type, and type.
Referenced by main(), proxy_thread(), radius_pdu_unpack(), and server().
  127     pdu = gw_malloc(
sizeof(*pdu));
   131     #define INTEGER(name, octets) \   132     if (strcmp(#name, "code") == 0) p->name = type; \   134     #define OCTETS(name, field_giving_octets) p->name = NULL;   135     #define PDU(name, id, fields) \   137         struct name *p = &pdu->u.name; \   138         pdu->type_name = #name; \   143         error(0, 
"Unknown RADIUS_PDU type, internal error.");
   147     #define ATTR(attr, type, string, min, max)   148     #define UNASSIGNED(attr)   149     #define ATTRIBUTES(fields) \   150         pdu->attr = dict_create(20, (void (*)(void *))octstr_destroy); void error(int err, const char *fmt,...)
 
 
 
 
◆ radius_pdu_destroy()
Definition at line 156 of file radius_pdu.c.
References error(), and RADIUS_PDU::type.
Referenced by main(), proxy_thread(), and server().
  162     #define INTEGER(name, octets) p->name = 0;   163     #define OCTETS(name, field_giving_octets) octstr_destroy(p->name);   164     #define PDU(name, id, fields) \   165         case id: { struct name *p = &pdu->u.name; fields } break;   168         error(0, 
"Unknown RADIUS_PDU type, internal error while destroying.");
   171     #define ATTR(attr, type, string, min, max)   172     #define UNASSIGNED(attr)   173     #define ATTRIBUTES(fields) dict_destroy(pdu->attr); void error(int err, const char *fmt,...)
 
 
 
 
◆ radius_pdu_dump()
Definition at line 478 of file radius_pdu.c.
References debug(), and error().
  480     debug(
"radius", 0, 
"RADIUS PDU %p dump:", (
void *) pdu);
   483     #define INTEGER(name, octets) \   484         debug("radius", 0, "  %s: %lu = 0x%08lx", #name, p->name, p->name);   485     #define OCTETS(name, field_giving_octets) \   486         octstr_dump_short(p->name, 2, #name);   487     #define PDU(name, id, fields) \   488         case id: { struct name *p = &pdu->u.name; fields; \   489                    radius_attr_dump(pdu); } break;   492         error(0, 
"Unknown RADIUS_PDU type, internal error.");
   495     debug(
"radius", 0, 
"RADIUS PDU dump ends.");
 void error(int err, const char *fmt,...)
 
void debug(const char *place, int err, const char *fmt,...)
 
 
 
 
◆ radius_pdu_pack()
Definition at line 237 of file radius_pdu.c.
References append_encoded_integer(), error(), gw_assert(), octstr_create, octstr_delete(), octstr_destroy(), octstr_insert(), octstr_len(), and RADIUS_PDU::type.
Referenced by main(), proxy_thread(), and server().
  261     #define INTEGER(name, octets) \   262         append_encoded_integer(os, p->name, octets);   263     #define OCTETS(name, field_giving_octets) \   264         octstr_append(os, p->name);   265     #define PDU(name, id, fields) \   266         case id: { struct name *p = &pdu->u.name; fields; oos = radius_attr_pack(pdu); \   267                    octstr_append(os, oos);octstr_destroy(oos); } break;   270         error(0, 
"Unknown RADIUS_PDU type, internal error while packing.");
 void error(int err, const char *fmt,...)
 
gw_assert(wtls_machine->packet_to_send !=NULL)
 
void octstr_insert(Octstr *ostr1, const Octstr *ostr2, long pos)
 
void octstr_delete(Octstr *ostr1, long pos, long len)
 
static void append_encoded_integer(Octstr *os, unsigned long u, long octets)
 
void octstr_destroy(Octstr *ostr)
 
#define octstr_create(cstr)
 
long octstr_len(const Octstr *ostr)
 
 
 
 
◆ radius_pdu_unpack()
Definition at line 360 of file radius_pdu.c.
References debug(), decode_integer(), error(), octstr_destroy(), octstr_dump_short(), octstr_len(), parse_context_create(), parse_context_destroy(), parse_get_char(), parse_get_octets(), parse_skip(), radius_pdu_create(), and type.
Referenced by main(), proxy_thread(), and server().
  371         error(0, 
"RADIUS: PDU was too short (%ld bytes).",
   386     debug(
"radius", 0, 
"RADIUS: Attributes len is %ld", len);
   396     #define INTEGER(name, octets) \   397         pos = octstr_len(data_without_len) - parse_octets_left(context); \   398         p->name = decode_integer(data_without_len, pos, octets); \   399         parse_skip(context, octets);   400     #define OCTETS(name, field_giving_octets) \   401         p->name = parse_get_octets(context, field_giving_octets);    402     #define PDU(name, id, fields) \   403         case id: { struct name *p = &pdu->u.name; fields; \   404                    radius_attr_unpack(&context, &pdu); } break;   407         error(0, 
"Unknown RADIUS_PDU type, internal error while unpacking.");
 void error(int err, const char *fmt,...)
 
int parse_get_char(ParseContext *context)
 
void octstr_dump_short(Octstr *ostr, int level, const char *name)
 
Octstr * parse_get_octets(ParseContext *context, long length)
 
void octstr_destroy(Octstr *ostr)
 
long octstr_len(const Octstr *ostr)
 
int parse_skip(ParseContext *context, long count)
 
void parse_context_destroy(ParseContext *context)
 
RADIUS_PDU * radius_pdu_create(int type, RADIUS_PDU *req)
 
void debug(const char *place, int err, const char *fmt,...)
 
static unsigned long decode_integer(Octstr *os, long pos, int octets)
 
ParseContext * parse_context_create(Octstr *str)