#ifndef	_RADIUS_FUNCTION_H
#define	_RADIUS_FUNCTION_H

RADIUS_PID *radius_get_pid_ptr(int pid);
int radius_init_pid(int pid);
int radius_init_socket(void);

int radius_attr_parse_init();
int radius_send_msg(int pid);

int radius_set_udp_dest_addr(struct sockaddr_in *dst_addr, RADIUS_ADDR *addr);
int radius_get_sock_fd_according_msg_type(BYTE msg_type);

int radius_msg_to_fmt(const BYTE *bcd, int bcd_len, char *str, int str_buff_size);

int radius_authenticate_nas(BYTE *authenticator, RADIUS_NAS_INFO *nas_info_ptr, RADIUS_ACCESS_REQUEST * access_request, BYTE *msg, int msg_len, int msg_auth_attr_offset);
int radius_calculate_authenticator(BYTE *rep_auth, const BYTE *msg, int msg_len, BYTE *share_key);

RADIUS_NAS_INFO *radius_get_nas_info_ptr(int id);
int radius_accord_ip_search_nas_info(DWORD nas_ip);

int radius_udp_msg_handling(BYTE *msg, int len, RADIUS_ADDR *addr, int nas_id);

int radius_encode_access_request(BYTE sap_index, BYTE *identifier, BYTE *authenticator, BYTE *msg, RADIUS_ACCESS_REQUEST *access_request, int nas_id);
int radius_encode_access_accept(BYTE identifier, BYTE *request_authenticator, BYTE *msg, RADIUS_ACCESS_ACCEPT *access_accept, int nas_id);
int radius_encode_access_reject(BYTE identifier, BYTE *request_authenticator, BYTE *msg, RADIUS_ACCESS_REJECT *access_reject, int nas_id);
int radius_encode_accounting_response(BYTE identifier, BYTE *request_authenticator, BYTE *msg, RADIUS_ACCOUNTING_RESPONSE *accounting_response, int nas_id);
int radius_encode_disconnect_request(BYTE *identifier, BYTE *authenticator, BYTE *msg, RADIUS_DISCONNECT_REQUEST *disconnect_request, int nas_id);

int radius_get_pid();

#endif

