Obtains the routing information for a given destination address.
The x25_route_s data structure takes the following form:
typedef struct x25_route_s { uint32_t index; /* used for reading next route */ u_char r_type; #define R_NONE 0 #define R_X121_HOST 1 #define R_X121_PREFIX 2 #define R_AEF_HOST 3 #define R_AEF_PREFIX 4 #define R_AEF_SOURCE 5 CONN_ADR x121; u_char pid_len; #define MAX_PID_LEN 4 u_char pid[MAX_PID_LEN]; AEF aef; int linkid; X25_MACADDR mac; int use_count; char pstn_number[16]; } X25_ROUTE;
#include <sys/strupts.h> struct strioctl ioc ; int fd ; X25_ROUTE r; fd = open("/dev/x25", O,RDW); /*prepare route*/ initialize io.ic_cmd = N_X25_GET_ROUTE; io.ic_timeout = 0; /*system default : 15 secs */ io.ic_len = sizeof(X25_ROUTE); io.ic_dp = (char *)&r; if (ioctl (fd, I_STR, &ioc) <0) { perror(" xxxioctl"); } }