freeradius-client.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564
  1. /*
  2. * $Id: freeradius-client.h,v 1.18 2010/06/15 09:22:51 aland Exp $
  3. *
  4. * Copyright (C) 1995,1996,1997,1998 Lars Fenneberg
  5. *
  6. * Copyright 1992 Livingston Enterprises, Inc.
  7. *
  8. * Copyright 1992,1993, 1994,1995 The Regents of the University of Michigan
  9. * and Merit Network, Inc. All Rights Reserved
  10. *
  11. * See the file COPYRIGHT for the respective terms and conditions.
  12. * If the file is missing contact me at lf@elemental.net
  13. * and I'll send you a copy.
  14. *
  15. */
  16. #ifndef FREERADIUS_CLIENT_H
  17. #define FREERADIUS_CLIENT_H
  18. //#define CP_DEBUG
  19. #ifdef CP_DEBUG
  20. #define DEBUG(args, ...) rc_log(## args)
  21. #else
  22. #define DEBUG(args, ...) ;
  23. #endif
  24. //#include <sys/types.h>
  25. #include "radius_config.h"
  26. /*
  27. * Include for C99 uintX_t defines is stdint.h on most systems. Solaris uses
  28. * inttypes.h instead. Comment out the stdint include if you get an error,
  29. * and uncomment the inttypes.h include.
  30. */
  31. #include <stdint.h>
  32. /* #include <inttypes.h> */
  33. #ifdef PRINTF_STDLIB
  34. #include <stdio.h>
  35. #endif
  36. #ifdef PRINTF_CUSTOM
  37. #include "tinystdio.h"
  38. #endif
  39. #include <time.h>
  40. /* for struct addrinfo and sockaddr_storage */
  41. //#include <sys/socket.h>
  42. #include <netdb.h>
  43. #undef __BEGIN_DECLS
  44. #undef __END_DECLS
  45. #ifdef __cplusplus
  46. # define __BEGIN_DECLS extern "C" {
  47. # define __END_DECLS }
  48. #else
  49. # define __BEGIN_DECLS /* empty */
  50. # define __END_DECLS /* empty */
  51. #endif
  52. #define AUTH_VECTOR_LEN 16
  53. #define AUTH_PASS_LEN (3 * 16) /* multiple of 16 */
  54. #define AUTH_ID_LEN 64
  55. #define AUTH_STRING_LEN 253 /* maximum of 253 */
  56. #define BUFFER_LEN 8192
  57. #define NAME_LENGTH 32
  58. #define GETSTR_LENGTH 128 //!< must be bigger than AUTH_PASS_LEN.
  59. #define MAX_SECRET_LENGTH (3 * 16) /* MUST be multiple of 16 */
  60. #define VENDOR(x) (((x) >> 16) & 0xffff)
  61. #define ATTRID(x) ((x) & 0xffff)
  62. #define PW_MAX_MSG_SIZE 256//4096
  63. /* codes for radius_buildreq, radius_getport, etc. */
  64. #define AUTH 0
  65. #define ACCT 1
  66. /* defines for config.c */
  67. #define SERVER_MAX 8
  68. #define AUTH_LOCAL_FST (1<<0)
  69. #define AUTH_RADIUS_FST (1<<1)
  70. #define AUTH_LOCAL_SND (1<<2)
  71. #define AUTH_RADIUS_SND (1<<3)
  72. typedef struct server {
  73. int max;
  74. char *name[SERVER_MAX];
  75. uint16_t port[SERVER_MAX];
  76. char *secret[SERVER_MAX];
  77. double deadtime_ends[SERVER_MAX];
  78. } SERVER;
  79. typedef struct pw_auth_hdr
  80. {
  81. uint8_t code;
  82. uint8_t id;
  83. uint16_t length;
  84. uint8_t vector[AUTH_VECTOR_LEN];
  85. uint8_t data[2];
  86. } AUTH_HDR;
  87. struct rc_conf
  88. {
  89. struct _option *config_options;
  90. struct sockaddr_storage own_bind_addr;
  91. unsigned own_bind_addr_set;
  92. struct map2id_s *map2id_list;
  93. struct dict_attr *dictionary_attributes;
  94. struct dict_value *dictionary_values;
  95. struct dict_vendor *dictionary_vendors;
  96. char buf[GETSTR_LENGTH];
  97. char buf1[14];
  98. char ifname[512];
  99. };
  100. typedef struct rc_conf rc_handle;
  101. #define AUTH_HDR_LEN 20
  102. #define CHAP_VALUE_LENGTH 16
  103. #define PW_AUTH_UDP_PORT 1645
  104. #define PW_ACCT_UDP_PORT 1646
  105. #define PW_TYPE_STRING 0
  106. #define PW_TYPE_INTEGER 1
  107. #define PW_TYPE_IPADDR 2
  108. #define PW_TYPE_DATE 3
  109. #define PW_TYPE_IPV6ADDR 4
  110. #define PW_TYPE_IPV6PREFIX 5
  111. /* standard RADIUS codes */
  112. #define PW_ACCESS_REQUEST 1
  113. #define PW_ACCESS_ACCEPT 2
  114. #define PW_ACCESS_REJECT 3
  115. #define PW_ACCOUNTING_REQUEST 4
  116. #define PW_ACCOUNTING_RESPONSE 5
  117. #define PW_ACCOUNTING_STATUS 6
  118. #define PW_PASSWORD_REQUEST 7
  119. #define PW_PASSWORD_ACK 8
  120. #define PW_PASSWORD_REJECT 9
  121. #define PW_ACCOUNTING_MESSAGE 10
  122. #define PW_ACCESS_CHALLENGE 11
  123. #define PW_STATUS_SERVER 12
  124. #define PW_STATUS_CLIENT 13
  125. /* standard RADIUS attribute-value pairs */
  126. #define PW_ACCESS 244
  127. #define PW_USER_NAME 1 //!< string.
  128. #define PW_USER_PASSWORD 2 //!< string.
  129. #define PW_CHAP_PASSWORD 3 //!< string.
  130. #define PW_NAS_IP_ADDRESS 4 //!< ipaddr.
  131. #define PW_NAS_PORT 5 //!< integer.
  132. #define PW_SERVICE_TYPE 6 //!< integer.
  133. #define PW_FRAMED_PROTOCOL 7 //!< integer.
  134. #define PW_FRAMED_IP_ADDRESS 8 //!< ipaddr.
  135. #define PW_FRAMED_IP_NETMASK 9 //!< ipaddr.
  136. #define PW_FRAMED_ROUTING 10 //!< integer.
  137. #define PW_FILTER_ID 11 //!< string.
  138. #define PW_FRAMED_MTU 12 //!< integer.
  139. #define PW_FRAMED_COMPRESSION 13 //!< integer.
  140. #define PW_LOGIN_IP_HOST 14 //!< ipaddr.
  141. #define PW_LOGIN_SERVICE 15 //!< integer.
  142. #define PW_LOGIN_PORT 16 //!< integer.
  143. #define PW_OLD_PASSWORD 17 //!< string */ /* deprecated.
  144. #define PW_REPLY_MESSAGE 18 //!< string.
  145. #define PW_LOGIN_CALLBACK_NUMBER 19 //!< string.
  146. #define PW_FRAMED_CALLBACK_ID 20 //!< string.
  147. #define PW_EXPIRATION 21 //!< date */ /* deprecated.
  148. #define PW_FRAMED_ROUTE 22 //!< string.
  149. #define PW_FRAMED_IPX_NETWORK 23 //!< integer.
  150. #define PW_STATE 24 //!< string.
  151. #define PW_CLASS 25 //!< string.
  152. #define PW_VENDOR_SPECIFIC 26 //!< string.
  153. #define PW_SESSION_TIMEOUT 27 //!< integer.
  154. #define PW_IDLE_TIMEOUT 28 //!< integer.
  155. #define PW_TERMINATION_ACTION 29 //!< integer.
  156. #define PW_CALLED_STATION_ID 30 //!< string.
  157. #define PW_CALLING_STATION_ID 31 //!< string.
  158. #define PW_NAS_IDENTIFIER 32 //!< string.
  159. #define PW_PROXY_STATE 33 //!< string.
  160. #define PW_LOGIN_LAT_SERVICE 34 //!< string.
  161. #define PW_LOGIN_LAT_NODE 35 //!< string.
  162. #define PW_LOGIN_LAT_GROUP 36 //!< string.
  163. #define PW_FRAMED_APPLETALK_LINK 37 //!< integer.
  164. #define PW_FRAMED_APPLETALK_NETWORK 38 //!< integer.
  165. #define PW_FRAMED_APPLETALK_ZONE 39 //!< string.
  166. #define PW_ACCT_STATUS_TYPE 40 //!< integer.
  167. #define PW_ACCT_DELAY_TIME 41 //!< integer.
  168. #define PW_ACCT_INPUT_OCTETS 42 //!< integer.
  169. #define PW_ACCT_OUTPUT_OCTETS 43 //!< integer.
  170. #define PW_ACCT_SESSION_ID 44 //!< string.
  171. #define PW_ACCT_AUTHENTIC 45 //!< integer.
  172. #define PW_ACCT_SESSION_TIME 46 //!< integer.
  173. #define PW_ACCT_INPUT_PACKETS 47 //!< integer.
  174. #define PW_ACCT_OUTPUT_PACKETS 48 //!< integer.
  175. #define PW_ACCT_TERMINATE_CAUSE 49 //!< integer.
  176. #define PW_ACCT_MULTI_SESSION_ID 50 //!< string.
  177. #define PW_ACCT_LINK_COUNT 51 //!< integer.
  178. #define PW_ACCT_INPUT_GIGAWORDS 52 //!< integer.
  179. #define PW_ACCT_OUTPUT_GIGAWORDS 53 //!< integer.
  180. #define PW_EVENT_TIMESTAMP 55 //!< integer.
  181. #define PW_EGRESS_VLANID 56 //!< string.
  182. #define PW_INGRESS_FILTERS 57 //!< integer.
  183. #define PW_EGRESS_VLAN_NAME 58 //!< string.
  184. #define PW_USER_PRIORITY_TABLE 59 //!< string.
  185. #define PW_CHAP_CHALLENGE 60 //!< string.
  186. #define PW_NAS_PORT_TYPE 61 //!< integer.
  187. #define PW_PORT_LIMIT 62 //!< integer.
  188. #define PW_LOGIN_LAT_PORT 63 //!< string.
  189. #define PW_TUNNEL_TYPE 64 //!< string.
  190. #define PW_TUNNEL_MEDIUM_TYPE 65 //!< integer.
  191. #define PW_TUNNEL_CLIENT_ENDPOINT 66 //!< string.
  192. #define PW_TUNNEL_SERVER_ENDPOINT 67 //!< string.
  193. #define PW_ACCT_TUNNEL_CONNECTION 68 //!< string.
  194. #define PW_TUNNEL_PASSWORD 69 //!< string.
  195. #define PW_ARAP_PASSWORD 70 //!< string.
  196. #define PW_ARAP_FEATURES 71 //!< string.
  197. #define PW_ARAP_ZONE_ACCESS 72 //!< integer.
  198. #define PW_ARAP_SECURITY 73 //!< integer.
  199. #define PW_ARAP_SECURITY_DATA 74 //!< string.
  200. #define PW_PASSWORD_RETRY 75 //!< integer.
  201. #define PW_PROMPT 76 //!< integer.
  202. #define PW_CONNECT_INFO 77 //!< string.
  203. #define PW_CONFIGURATION_TOKEN 78 //!< string.
  204. #define PW_EAP_MESSAGE 79 //!< string.
  205. #define PW_MESSAGE_AUTHENTICATOR 80 //!< string.
  206. #define PW_TUNNEL_PRIVATE_GROUP_ID 81 //!< string.
  207. #define PW_TUNNEL_ASSIGNMENT_ID 82 //!< string.
  208. #define PW_TUNNEL_PREFERENCE 83 //!< string.
  209. #define PW_ARAP_CHALLENGE_RESPONSE 84 //!< string.
  210. #define PW_ACCT_INTERIM_INTERVAL 85 //!< integer.
  211. #define PW_ACCT_TUNNEL_PACKETS_LOST 86 //!< integer.
  212. #define PW_NAS_PORT_ID_STRING 87 //!< string.
  213. #define PW_FRAMED_POOL 88 //!< string.
  214. #define PW_CHARGEABLE_USER_IDENTITY 89 //!< string.
  215. #define PW_CUI 89 //!< string.
  216. #define PW_TUNNEL_CLIENT_AUTH_ID 90 //!< string.
  217. #define PW_TUNNEL_SERVER_AUTH_ID 91 //!< string.
  218. #define PW_NAS_FILTER_RULE 92 //!< string.
  219. #define PW_ORIGINATING_LINE_INFO 94 //!< string.
  220. #define PW_NAS_IPV6_ADDRESS 95 //!< string.
  221. #define PW_FRAMED_INTERFACE_ID 96 //!< string.
  222. #define PW_FRAMED_IPV6_PREFIX 97 //!< string.
  223. #define PW_LOGIN_IPV6_HOST 98 //!< string.
  224. #define PW_FRAMED_IPV6_ROUTE 99 //!< string.
  225. #define PW_FRAMED_IPV6_POOL 100 //!< string.
  226. #define PW_ERROR_CAUSE 101 //!< integer.
  227. #define PW_EAP_KEY_NAME 102 //!< string.
  228. #define PW_FRAMED_IPV6_ADDRESS 168 //!< ipaddr6.
  229. #define PW_DNS_SERVER_IPV6_ADDRESS 169 //!< ipaddr6.
  230. #define PW_ROUTE_IPV6_INFORMATION 170 //!< ipv6prefix.
  231. /* Experimental SIP-specific attributes (draft-sterman-aaa-sip-00.txt etc) */
  232. #define PW_DIGEST_RESPONSE 206 //!< string.
  233. #define PW_DIGEST_ATTRIBUTES 207 //!< string.
  234. #define PW_DIGEST_REALM 1063 //!< string.
  235. #define PW_DIGEST_NONCE 1064 //!< string.
  236. #define PW_DIGEST_METHOD 1065 //!< string.
  237. #define PW_DIGEST_URI 1066 //!< string.
  238. #define PW_DIGEST_QOP 1067 //!< string.
  239. #define PW_DIGEST_ALGORITHM 1068 //!< string.
  240. #define PW_DIGEST_BODY_DIGEST 1069 //!< string.
  241. #define PW_DIGEST_CNONCE 1070 //!< string.
  242. #define PW_DIGEST_NONCE_COUNT 1071 //!< string.
  243. #define PW_DIGEST_USER_NAME 1072 //!< string.
  244. /* Integer Translations */
  245. /* SERVICE TYPES */
  246. #define PW_LOGIN 1
  247. #define PW_FRAMED 2
  248. #define PW_CALLBACK_LOGIN 3
  249. #define PW_CALLBACK_FRAMED 4
  250. #define PW_OUTBOUND 5
  251. #define PW_ADMINISTRATIVE 6
  252. #define PW_NAS_PROMPT 7
  253. #define PW_AUTHENTICATE_ONLY 8
  254. #define PW_CALLBACK_NAS_PROMPT 9
  255. /* FRAMED PROTOCOLS */
  256. #define PW_PPP 1
  257. #define PW_SLIP 2
  258. #define PW_ARA 3
  259. #define PW_GANDALF 4
  260. #define PW_XYLOGICS 5
  261. /* FRAMED ROUTING VALUES */
  262. #define PW_NONE 0
  263. #define PW_BROADCAST 1
  264. #define PW_LISTEN 2
  265. #define PW_BROADCAST_LISTEN 3
  266. /* FRAMED COMPRESSION TYPES */
  267. #define PW_VAN_JACOBSON_TCP_IP 1
  268. #define PW_IPX_HEADER_COMPRESSION 2
  269. /* LOGIN SERVICES */
  270. #define PW_TELNET 0
  271. #define PW_RLOGIN 1
  272. #define PW_TCP_CLEAR 2
  273. #define PW_PORTMASTER 3
  274. #define PW_LAT 4
  275. #define PW_X25_PAD 5
  276. #define PW_X25_T3POS 6
  277. /* TERMINATION ACTIONS */
  278. #define PW_DEFAULT 0
  279. #define PW_RADIUS_REQUEST 1
  280. /* PROHIBIT PROTOCOL */
  281. #define PW_DUMB 0 //!< 1 and 2 are defined in FRAMED PROTOCOLS.
  282. #define PW_AUTH_ONLY 3
  283. #define PW_ALL 255
  284. /* ACCOUNTING STATUS TYPES */
  285. #define PW_STATUS_START 1
  286. #define PW_STATUS_STOP 2
  287. #define PW_STATUS_ALIVE 3
  288. #define PW_STATUS_MODEM_START 4
  289. #define PW_STATUS_MODEM_STOP 5
  290. #define PW_STATUS_CANCEL 6
  291. #define PW_ACCOUNTING_ON 7
  292. #define PW_ACCOUNTING_OFF 8
  293. /* ACCOUNTING TERMINATION CAUSES */
  294. #define PW_USER_REQUEST 1
  295. #define PW_LOST_CARRIER 2
  296. #define PW_LOST_SERVICE 3
  297. #define PW_ACCT_IDLE_TIMEOUT 4
  298. #define PW_ACCT_SESSION_TIMEOUT 5
  299. #define PW_ADMIN_RESET 6
  300. #define PW_ADMIN_REBOOT 7
  301. #define PW_PORT_ERROR 8
  302. #define PW_NAS_ERROR 9
  303. #define PW_NAS_REQUEST 10
  304. #define PW_NAS_REBOOT 11
  305. #define PW_PORT_UNNEEDED 12
  306. #define PW_PORT_PREEMPTED 13
  307. #define PW_PORT_SUSPENDED 14
  308. #define PW_SERVICE_UNAVAILABLE 15
  309. #define PW_CALLBACK 16
  310. #define PW_USER_ERROR 17
  311. #define PW_HOST_REQUEST 18
  312. /* NAS PORT TYPES */
  313. #define PW_ASYNC 0
  314. #define PW_SYNC 1
  315. #define PW_ISDN_SYNC 2
  316. #define PW_ISDN_SYNC_V120 3
  317. #define PW_ISDN_SYNC_V110 4
  318. #define PW_VIRTUAL 5
  319. /* AUTHENTIC TYPES */
  320. #define PW_RADIUS 1
  321. #define PW_LOCAL 2
  322. #define PW_REMOTE 3
  323. /* Server data structures */
  324. typedef struct dict_attr
  325. {
  326. char name[NAME_LENGTH + 1]; //!< attribute name.
  327. int value; //!< attribute index.
  328. int type; //!< string, int, etc..
  329. struct dict_attr *next;
  330. } DICT_ATTR;
  331. typedef struct dict_value
  332. {
  333. char attrname[NAME_LENGTH +1];
  334. char name[NAME_LENGTH + 1];
  335. int value;
  336. struct dict_value *next;
  337. } DICT_VALUE;
  338. typedef struct dict_vendor
  339. {
  340. char vendorname[NAME_LENGTH +1];
  341. int vendorpec;
  342. struct dict_vendor *next;
  343. } DICT_VENDOR;
  344. typedef struct value_pair
  345. {
  346. char name[NAME_LENGTH + 1];
  347. int attribute;
  348. int type;
  349. uint32_t lvalue;
  350. char strvalue[AUTH_STRING_LEN + 1];
  351. struct value_pair *next;
  352. } VALUE_PAIR;
  353. /* Define return codes from "SendServer" utility */
  354. #define NET_ERR_RC -3 // Ошибка создания сокета, соединения/отправки/приема
  355. #define BADRESP_RC -2 // Неверный пароль
  356. #define ERROR_RC -1
  357. #define OK_RC 0
  358. #define TIMEOUT_RC 1
  359. #define REJECT_RC 2 // Неверный логин
  360. #define USER_RC 3
  361. #define ADMIN_RC 4
  362. typedef struct send_data /* Used to pass information to sendserver() function */
  363. {
  364. uint8_t code; //!< RADIUS packet code.
  365. uint8_t seq_nbr; //!< Packet sequence number.
  366. char *server; //!< Name/addrress of RADIUS server.
  367. int svc_port; //!< RADIUS protocol destination port.
  368. char *secret; //!< Shared secret of RADIUS server.
  369. int timeout; //!< Session timeout in seconds.
  370. int retries;
  371. VALUE_PAIR *send_pairs; //!< More a/v pairs to send.
  372. VALUE_PAIR *receive_pairs; //!< Where to place received a/v pairs.
  373. } SEND_DATA;
  374. #ifndef MIN
  375. #define MIN(a, b) ((a) < (b) ? (a) : (b))
  376. #endif
  377. #ifndef MAX
  378. #define MAX(a, b) ((a) > (b) ? (a) : (b))
  379. #endif
  380. #ifndef PATH_MAX
  381. #define PATH_MAX 1024
  382. #endif
  383. typedef struct env
  384. {
  385. int maxsize, size;
  386. char **env;
  387. } ENV;
  388. #define ENV_SIZE 128
  389. __BEGIN_DECLS
  390. /* Function prototypes */
  391. /* avpair.c */
  392. VALUE_PAIR *rc_avpair_add(rc_handle const *, VALUE_PAIR **, int, void const *, int, int);
  393. int rc_avpair_assign(VALUE_PAIR *, void const *, int);
  394. VALUE_PAIR *rc_avpair_new(rc_handle const *, int, void const *, int, int);
  395. VALUE_PAIR *rc_avpair_gen(rc_handle const *, VALUE_PAIR *, unsigned char const *, int, int);
  396. VALUE_PAIR *rc_avpair_get(VALUE_PAIR *, int, int);
  397. void rc_avpair_insert(VALUE_PAIR **, VALUE_PAIR *, VALUE_PAIR *);
  398. void rc_avpair_free(VALUE_PAIR *);
  399. int rc_avpair_parse(rc_handle const *, char const *, VALUE_PAIR **);
  400. int rc_avpair_tostr(rc_handle const *, VALUE_PAIR *, char *, int, char *, int);
  401. char *rc_avpair_log(rc_handle const *, VALUE_PAIR *, char *buf, size_t buf_len);
  402. //VALUE_PAIR *rc_avpair_readin(rc_handle const *, FILE *);
  403. /* buildreq.c */
  404. void rc_buildreq(rc_handle const *, SEND_DATA *, int, char *, unsigned short, char *, int, int);
  405. unsigned char rc_get_id();
  406. int rc_auth(rc_handle *, uint32_t, VALUE_PAIR *, VALUE_PAIR **, char *);
  407. int rc_auth_proxy(rc_handle *, VALUE_PAIR *, VALUE_PAIR **, char *);
  408. int rc_acct(rc_handle *, uint32_t, VALUE_PAIR *);
  409. int rc_acct_proxy(rc_handle *, VALUE_PAIR *);
  410. int rc_check(rc_handle *, char *, char *, unsigned short, char *);
  411. int rc_aaa(rc_handle *rh, uint32_t client_port, VALUE_PAIR *send, VALUE_PAIR **received,
  412. char *msg, int add_nas_port, int request_type);
  413. /* clientid.c */
  414. int rc_read_mapfile(rc_handle *, char const *);
  415. uint32_t rc_map2id(rc_handle const *, char const *);
  416. void rc_map2id_free(rc_handle *);
  417. /* config.c */
  418. //rc_handle *rc_read_config(char const *);
  419. void rc_read_config(rc_handle* rh);
  420. char *rc_conf_str(rc_handle const *, char const *);
  421. int rc_conf_int(rc_handle const *, char const *);
  422. SERVER *rc_conf_srv(rc_handle const *, char const *);
  423. void rc_config_free(rc_handle *);
  424. int rc_add_config(rc_handle *, char const *, char const *, char const *, int);
  425. rc_handle *rc_config_init(rc_handle *);
  426. int test_config(rc_handle const *, char const *);
  427. /* dict.c */
  428. int rc_read_dictionary(rc_handle *, char const *);
  429. DICT_ATTR *rc_dict_getattr(rc_handle const *, int);
  430. DICT_ATTR *rc_dict_findattr(rc_handle const *, char const *);
  431. DICT_VALUE *rc_dict_findval(rc_handle const *, char const *);
  432. DICT_VENDOR *rc_dict_findvend(rc_handle const *, char const *);
  433. DICT_VENDOR *rc_dict_getvend(rc_handle const *, int);
  434. DICT_VALUE * rc_dict_getval(rc_handle const *, uint32_t, char const *);
  435. void rc_dict_free(rc_handle *);
  436. /* ip_util.c */
  437. int rc_good_ipaddr(char const *);
  438. unsigned short rc_getport(int);
  439. int rc_own_hostname(char *, int);
  440. struct sockaddr;
  441. int rc_get_srcaddr(struct sockaddr *, const struct sockaddr *);
  442. /* log.c */
  443. void rc_openlog(char const *);
  444. void rc_log(int, char const *, ...);
  445. /* sendserver.c */
  446. int rc_send_server(rc_handle *, SEND_DATA *, char *, unsigned flags);
  447. /* util.c */
  448. void rc_str2tm(char const *, struct tm *);
  449. char *rc_getifname(rc_handle *, char const *);
  450. char *rc_getstr(rc_handle *, char const *, int);
  451. void rc_mdelay(int);
  452. char *rc_mksid(rc_handle *);
  453. rc_handle *rc_new(void);
  454. void rc_destroy(rc_handle *);
  455. //char *rc_fgetln(FILE *, size_t *);
  456. double rc_getctime(void);
  457. /* env.c */
  458. struct env *rc_new_env(int);
  459. void rc_free_env(struct env *);
  460. int rc_add_env(struct env *, char const *, char const *);
  461. int rc_import_env(struct env *, char const **);
  462. /* md5.c */
  463. void rc_md5_calc(unsigned char *, unsigned char const *, unsigned int);
  464. __END_DECLS
  465. #endif /* FREERADIUS_CLIENT_H */