77 Octstr *client_ip, *msisdn;
81 client_ip = msisdn = NULL;
84 if (pdu->
type == 0x04) {
97 info(0,
"RADIUS: Mapping `%s <-> %s' added.",
101 warning(0,
"RADIUS: Duplicate mapping for `%s <-> %s' received",
111 error(0,
"RADIUS: unknown Acct-Status-Type `%s' received.",
137 panic(0,
"Couldn't set up server socket for port %d.", lport);
150 panic(0,
"Couldn't receive request data from NAS");
151 info(0,
"Got data from NAS <%s:%d>",
177 r->
u.Accounting_Response.identifier = pdu->
u.Accounting_Request.identifier;
178 r->
u.Accounting_Response.authenticator =
189 panic(0,
"Couldn't send to remote RADIUS.");
191 panic(0,
"Couldn't receive from remote RADIUS.");
192 info(0,
"Got data from remote RADIUS <%s:%d>",
198 panic(0,
"Couldn't send response data to NAS.");
206 debug(
"",0,
"Mapping table contains %ld elements",
211 int main(
int argc,
char **argv) {
217 panic(0,
"usage: test_radius_acct <your RADIUS acct port> <remote RADIUS port>");
219 lport = atoi(argv[1]);
220 pport = atoi(argv[2]);
Dict * dict_create(long size_hint, void(*destroy_value)(void *))
void error(int err, const char *fmt,...)
void info(int err, const char *fmt,...)
void dict_put(Dict *dict, Octstr *key, void *value)
RADIUS_PDU * radius_pdu_unpack(Octstr *data_without_len)
int udp_get_port(Octstr *addr)
#define octstr_get_cstr(ostr)
void radius_pdu_destroy(RADIUS_PDU *pdu)
int radius_authenticate_pdu(RADIUS_PDU *pdu, Octstr **data, Octstr *secret)
Octstr * octstr_imm(const char *cstr)
void * dict_remove(Dict *dict, Octstr *key)
int udp_bind(int port, const char *source_addr)
int udp_client_socket(void)
void * dict_get(Dict *dict, Octstr *key)
#define octstr_duplicate(ostr)
long dict_key_count(Dict *dict)
void warning(int err, const char *fmt,...)
void octstr_destroy(Octstr *ostr)
#define octstr_create(cstr)
RADIUS_PDU * radius_pdu_create(int type, RADIUS_PDU *req)
static Dict * radius_table
void debug(const char *place, int err, const char *fmt,...)
static void server(int lport, int pport)
int udp_sendto(int s, Octstr *datagram, Octstr *addr)
Octstr * radius_pdu_pack(RADIUS_PDU *pdu)
int main(int argc, char **argv)
static int update_table(RADIUS_PDU *pdu, Dict **table)
int udp_recvfrom(int s, Octstr **datagram, Octstr **addr)
Octstr * udp_create_address(Octstr *host_or_ip, int port)
Octstr * udp_get_ip(Octstr *addr)
int octstr_compare(const Octstr *ostr1, const Octstr *ostr2)