00001
00035 #ifndef __WANPIPE_API_LEGACY__
00036 #define __WANPIPE_API_LEGACY__
00037
00038 #pragma pack(1)
00039
00040
00041
00046 #define WAN_API_MAX_DATA 4096
00047 typedef struct{
00048 unsigned char pktType;
00049 unsigned short length;
00050 unsigned char result;
00051 union {
00052 struct {
00053 unsigned char arg1;
00054 unsigned short time_stamp;
00055 } chdlc;
00056 struct {
00057 unsigned char attr;
00058 unsigned short time_stamp;
00059 } fr;
00060 struct {
00061 unsigned char qdm;
00062 unsigned char cause;
00063 unsigned char diagn;
00064 unsigned short lcn;
00065 } x25;
00066 struct {
00067 unsigned char station;
00068 unsigned char PF_bit;
00069 unsigned short poll_interval;
00070 unsigned char general_mailbox_byte;
00071 }sdlc;
00072 struct {
00073 unsigned char exception;
00074 }xdlc;
00075 } wan_protocol;
00076 #define wan_apihdr_chdlc_error_flag wan_protocol.chdlc.arg1
00077 #define wan_apihdr_chdlc_attr wan_protocol.chdlc.arg1
00078 #define wan_apihdr_chdlc_time_stamp wan_protocol.chdlc.time_stamp
00079 #define wan_apihdr_fr_attr wan_protocol.fr.attr
00080 #define wan_apihdr_fr_time_stamp wan_protocol.fr.time_stamp
00081 #define wan_apihdr_x25_qdm wan_protocol.x25.qdm
00082 #define wan_apihdr_x25_cause wan_protocol.x25.cause
00083 #define wan_apihdr_x25_diagn wan_protocol.x25.diagn
00084 #define wan_apihdr_x25_lcn wan_protocol.x25.lcn
00085
00086 #define wan_apihdr_sdlc_station wan_protocol.sdlc.station
00087 #define wan_apihdr_sdlc_pf wan_protocol.sdlc.PF_bit
00088 #define wan_apihdr_sdlc_poll_interval wan_protocol.sdlc.poll_interval
00089 #define wan_apihdr_sdlc_general_mb_byte wan_protocol.sdlc.general_mailbox_byte
00090
00091 #define wan_apihdr_xdlc_exception wan_protocol.xdlc.exception
00092 } wan_api_hdr_t;
00093
00094 typedef struct{
00095 wan_api_hdr_t api_hdr;
00096 unsigned char data[WAN_API_MAX_DATA];
00097 #define wan_api_pktType api_hdr.pktType
00098 #define wan_api_length api_hdr.length
00099 #define wan_api_result api_hdr.result
00100 #define wan_api_chdlc_error_flag api_hdr.wan_apihdr_chdlc_error_flag
00101 #define wan_api_chdlc_time_stamp api_hdr.wan_apihdr_chdlc_time_stamp
00102 #define wan_api_chdlc_attr api_hdr.wan_apihdr_chdlc_attr
00103 #define wan_api_chdlc_misc_Tx_bits api_hdr.wan_apihdr_chdlc_misc_Tx_bits
00104 #define wan_api_fr_attr api_hdr.wan_apihdr_fr_attr
00105 #define wan_api_fr_time_stamp api_hdr.wan_apihdr_fr_time_stamp
00106 #define wan_api_x25_qdm api_hdr.wan_apihdr_x25_qdm
00107 #define wan_api_x25_cause api_hdr.wan_apihdr_x25_cause
00108 #define wan_api_x25_diagn api_hdr.wan_apihdr_x25_diagn
00109 #define wan_api_x25_lcn api_hdr.wan_apihdr_x25_lcn
00110 #define wan_api_sdlc_station api_hdr.wan_apihdr_sdlc_station
00111 #define wan_api_sdlc_pf api_hdr.wan_apihdr_sdlc_pf
00112 #define wan_api_sdlc_poll_interval api_hdr.wan_apihdr_sdlc_poll_interval
00113 #define wan_api_sdlc_general_mb_byte api_hdr.wan_apihdr_sdlc_general_mb_byte
00114 #define wan_api_xdlc_exception api_hdr.wan_apihdr_xdlc_exception
00115 } wan_api_t;
00116
00117
00118 #define WAN_MAX_DATA_SIZE 5000
00119 #define MAX_LGTH_UDP_MGNT_PKT WAN_MAX_DATA_SIZE
00120
00121 #define WAN_MAILBOX_SIZE 16
00122 #define WAN_MAX_POS_DATA_SIZE 1030
00123 #define WAN_MAX_MBOX_DATA_SIZE 2032
00124
00125 #define WAN_MAX_CMD_DATA_SIZE 1024
00126
00133 typedef struct wan_cmd_api_
00134 {
00135 unsigned int cmd;
00136 unsigned short len;
00137 unsigned char bar;
00138 u_int32_t offset;
00139 int ret;
00140 unsigned char data[WAN_MAX_CMD_DATA_SIZE];
00141 } wan_cmd_api_t;
00142
00143
00144
00145
00155 typedef struct wan_cmd {
00156 union {
00157 struct {
00158 unsigned char opp_flag;
00159 unsigned char command;
00160 unsigned short data_len;
00161 unsigned char return_code;
00162 union {
00163 struct {
00164 unsigned char PF_bit;
00165 } hdlc;
00166 struct {
00167 unsigned short dlci;
00168 unsigned char attr;
00169 unsigned short rxlost1;
00170 u_int32_t rxlost2;
00171 } fr;
00172 struct {
00173 unsigned char pf;
00174 unsigned short lcn;
00175 unsigned char qdm;
00176 unsigned char cause;
00177 unsigned char diagn;
00178 unsigned char pktType;
00179 } x25;
00180 struct {
00181 unsigned char misc_Tx_Rx_bits;
00182 unsigned char Rx_error_bits;
00183 unsigned short Rx_time_stamp;
00184 unsigned char port;
00185 } bscstrm;
00186 struct {
00187 unsigned char misc_tx_rx_bits;
00188 unsigned short heading_length;
00189 unsigned short notify;
00190 unsigned char station;
00191 unsigned char poll_address;
00192 unsigned char select_address;
00193 unsigned char device_address;
00194 unsigned char notify_extended;
00195 } bsc;
00196 struct {
00197 unsigned char sdlc_address;
00198 unsigned char PF_bit;
00199 unsigned short poll_interval;
00200 unsigned char general_mailbox_byte;
00201 } sdlc;
00202 struct {
00203 unsigned char force;
00204 } fe;
00205 } wan_protocol;
00206 } wan_p_cmd;
00207 struct {
00208 unsigned char opp_flag;
00209 unsigned char pos_state;
00210 unsigned char async_state;
00211 } wan_pos_cmd;
00212 unsigned char mbox[WAN_MAILBOX_SIZE];
00213 } wan_cmd_u;
00214 #define wan_cmd_opp_flag wan_cmd_u.wan_p_cmd.opp_flag
00215 #define wan_cmd_command wan_cmd_u.wan_p_cmd.command
00216 #define wan_cmd_data_len wan_cmd_u.wan_p_cmd.data_len
00217 #define wan_cmd_return_code wan_cmd_u.wan_p_cmd.return_code
00218 #define wan_cmd_hdlc_PF_bit wan_cmd_u.wan_p_cmd.wan_protocol.hdlc.PF_bit
00219 #define wan_cmd_fe_force wan_cmd_u.wan_p_cmd.wan_protocol.fe.force
00220 #define wan_cmd_fr_dlci wan_cmd_u.wan_p_cmd.wan_protocol.fr.dlci
00221 #define wan_cmd_fr_attr wan_cmd_u.wan_p_cmd.wan_protocol.fr.attr
00222 #define wan_cmd_fr_rxlost1 wan_cmd_u.wan_p_cmd.wan_protocol.fr.rxlost1
00223 #define wan_cmd_fr_rxlost2 wan_cmd_u.wan_p_cmd.wan_protocol.fr.rxlost2
00224 #define wan_cmd_x25_pf wan_cmd_u.wan_p_cmd.wan_protocol.x25.pf
00225 #define wan_cmd_x25_lcn wan_cmd_u.wan_p_cmd.wan_protocol.x25.lcn
00226 #define wan_cmd_x25_qdm wan_cmd_u.wan_p_cmd.wan_protocol.x25.qdm
00227 #define wan_cmd_x25_cause wan_cmd_u.wan_p_cmd.wan_protocol.x25.cause
00228 #define wan_cmd_x25_diagn wan_cmd_u.wan_p_cmd.wan_protocol.x25.diagn
00229 #define wan_cmd_x25_pktType wan_cmd_u.wan_p_cmd.wan_protocol.x25.pktType
00230 #define wan_cmd_bscstrm_misc_bits wan_cmd_u.wan_p_cmd.wan_protocol.bscstrm.misc_Tx_Rx_bits
00231 #define wan_cmd_bscstrm_Rx_err_bits wan_cmd_u.wan_p_cmd.wan_protocol.bscstrm.Rx_error_bits
00232 #define wan_cmd_bscstrm_Rx_time_stamp wan_cmd_u.wan_p_cmd.wan_protocol.bscstrm.Rx_time_stamp
00233 #define wan_cmd_bscstrm_port wan_cmd_u.wan_p_cmd.wan_protocol.bscstrm.port
00234 #define wan_cmd_bsc_misc_bits wan_cmd_u.wan_p_cmd.wan_protocol.bsc.misc_tx_rx_bits
00235 #define wan_cmd_bsc_heading_len wan_cmd_u.wan_p_cmd.wan_protocol.bsc.heading_length
00236 #define wan_cmd_bsc_notify wan_cmd_u.wan_p_cmd.wan_protocol.bsc.notify
00237 #define wan_cmd_bsc_station wan_cmd_u.wan_p_cmd.wan_protocol.bsc.station
00238 #define wan_cmd_bsc_poll_addr wan_cmd_u.wan_p_cmd.wan_protocol.bsc.poll_address
00239 #define wan_cmd_bsc_select_addr wan_cmd_u.wan_p_cmd.wan_protocol.bsc.select_address
00240 #define wan_cmd_bsc_device_addr wan_cmd_u.wan_p_cmd.wan_protocol.bsc.device_address
00241 #define wan_cmd_bsc_notify_ext wan_cmd_u.wan_p_cmd.wan_protocol.bsc.notify_extended
00242 #define wan_cmd_sdlc_address wan_cmd_u.wan_p_cmd.wan_protocol.sdlc.sdlc_address
00243 #define wan_cmd_sdlc_pf wan_cmd_u.wan_p_cmd.wan_protocol.sdlc.PF_bit
00244 #define wan_cmd_sdlc_poll_interval wan_cmd_u.wan_p_cmd.wan_protocol.sdlc.poll_interval
00245 #define wan_cmd_sdlc_general_mb_byte wan_cmd_u.wan_p_cmd.wan_protocol.sdlc.general_mailbox_byte
00246
00247 #define wan_cmd_pos_opp_flag wan_cmd_u.wan_pos_cmd.opp_flag
00248 #define wan_cmd_pos_pos_state wan_cmd_u.wan_pos_cmd.pos_state
00249 #define wan_cmd_pos_async_state wan_cmd_u.wan_pos_cmd.async_state
00250 } wan_cmd_t;
00251
00252
00253 typedef struct {
00254 wan_cmd_t wan_cmd;
00255 union {
00256 struct {
00257 unsigned char command;
00258 unsigned short data_len;
00259 unsigned char return_code;
00260 unsigned char port_num;
00261 unsigned char attr;
00262 unsigned char reserved[10];
00263 unsigned char data[WAN_MAX_POS_DATA_SIZE];
00264 } pos_data;
00265 unsigned char data[WAN_MAX_MBOX_DATA_SIZE];
00266 } wan_u_data;
00267 #define wan_opp_flag wan_cmd.wan_cmd_opp_flag
00268 #define wan_command wan_cmd.wan_cmd_command
00269 #define wan_data_len wan_cmd.wan_cmd_data_len
00270 #define wan_return_code wan_cmd.wan_cmd_return_code
00271 #define wan_hdlc_PF_bit wan_cmd.wan_cmd_hdlc_PF_bit
00272 #define wan_fr_dlci wan_cmd.wan_cmd_fr_dlci
00273 #define wan_fr_attr wan_cmd.wan_cmd_fr_attr
00274 #define wan_fr_rxlost1 wan_cmd.wan_cmd_fr_rxlost1
00275 #define wan_fr_rxlost2 wan_cmd.wan_cmd_fr_rxlost2
00276 #define wan_x25_pf wan_cmd.wan_cmd_x25_pf
00277 #define wan_x25_lcn wan_cmd.wan_cmd_x25_lcn
00278 #define wan_x25_qdm wan_cmd.wan_cmd_x25_qdm
00279 #define wan_x25_cause wan_cmd.wan_cmd_x25_cause
00280 #define wan_x25_diagn wan_cmd.wan_cmd_x25_diagn
00281 #define wan_x25_pktType wan_cmd.wan_cmd_x25_pktType
00282 #define wan_bscstrm_misc_bits wan_cmd.wan_cmd_bscstrm_misc_bits
00283 #define wan_bscstrm_Rx_err_bits wan_cmd.wan_cmd_bscstrm_Rx_error_bits
00284 #define wan_bscstrm_Rx_time_stamp wan_cmd.wan_cmd_bscstrm_Rx_time_stamp
00285 #define wan_bscstrm_port wan_cmd.wan_cmd_bscstrm_port
00286 #define wan_bsc_misc_bits wan_cmd.wan_cmd_bsc_misc_bits
00287 #define wan_bsc_heading_len wan_cmd.wan_cmd_bsc_heading_length
00288 #define wan_bsc_notify wan_cmd.wan_cmd_bsc_notify
00289 #define wan_bsc_station wan_cmd.wan_cmd_bsc_station
00290 #define wan_bsc_poll_addr wan_cmd.wan_cmd_bsc_poll_address
00291 #define wan_bsc_select_addr wan_cmd.wan_cmd_bsc_select_address
00292 #define wan_bsc_device_addr wan_cmd.wan_cmd_bsc_device_address
00293 #define wan_bsc_notify_ext wan_cmd.wan_cmd_bsc_notify_extended
00294 #define wan_sdlc_address wan_cmd.wan_cmd_sdlc_address
00295 #define wan_sdlc_pf wan_cmd.wan_cmd_sdlc_pf
00296 #define wan_sdlc_poll_interval wan_cmd.wan_cmd_sdlc_poll_interval
00297 #define wan_sdlc_general_mb_byte wan_cmd.wan_cmd_sdlc_general_mb_byte
00298 #define wan_data wan_u_data.data
00299
00300 #define wan_pos_opp_flag wan_cmd.wan_cmd_pos_opp_flag
00301 #define wan_pos_pos_state wan_cmd.wan_cmd_pos_pos_state
00302 #define wan_pos_async_state wan_cmd.wan_cmd_pos_async_state
00303 #define wan_pos_command wan_u_data.pos_data.command
00304 #define wan_pos_data_len wan_u_data.pos_data.data_len
00305 #define wan_pos_return_code wan_u_data.pos_data.return_code
00306 #define wan_pos_port_num wan_u_data.pos_data.port_num
00307 #define wan_pos_attr wan_u_data.pos_data.attr
00308 #define wan_pos_data wan_u_data.pos_data.data
00309 } wan_mbox_t;
00310
00311 #define WAN_MBOX_INIT(mbox) memset(mbox, 0, sizeof(wan_cmd_t));
00312
00313
00314 #pragma pack()
00315
00316 #endif