/*
 *========================================================================
 *
 *    : AZN_PLAZA_LANE APP
 *      : func_list.h
 *      : JBY (baarong@neighbor21.co.kr)
 *      : 2018.07.13
 *      : 
 *        : 
 *
 *========================================================================
*/

#ifndef    _FUNC_LIST
#define    _FUNC_LIST

#include "hi_ctrl.h"
#include "hi_packet_format.h"
#include "tagbl_struc.h"
#include "taglnk_frame.h"
#include "chg_struc.h"

/*** lane_main.c ***/
int    init_comm();
int    event_check();
int    chk_warr_snd_no();

/*** lane_stat.c ***/
int    hi_comm_ctrl2lane_stat();
int    lane_stat_info_read();
void   lane_stat_info_restore();
int    lane_stat2shm_update();
int    lane_stat2shared();
int    record_read();
int    cmp_seq_no();

/*** lane_comm.c ***/
int    lane_comm_open();
int    lane_comm_accept();
int    lane_comm_reopen();
void   lane_comm_close();
void   lane_comm_rcv();
int    lane_comm_snd();
int    lane_comm_proc(int rdflg, char *p);

/*** chk_chng.c ***/
int    get_data_time();
int    wkr_no2wrk_stat();
int    natoi();
int    int2nascii();
int    err_log();
int    lane_log( char *fmt, ... );

/*** recvdata_filecreation.c ***/
int    reding_termrecv_wrkno();
int    chgrq_f2t();
int    chkbit01();
int    chkbit02();
int    chkbit04();
int    chkbit08();
int    chkbit10();
int    chkbit20();
int    chkbit40();
int    chkbit80();
int    trmn_f2b();
int    passraw_f2b();
int    recv2shared();
int    fsave_passraw();
int    fsave_trmn_rcv();

/*** senddata_handle.pc ***/
int    rq_accuml_data_resnd();
int    confrm_reply_snd_hnd();
int    snd_warr_snd_no();
int    snd_tbl_cmd(int rsp);
int    snd_tm_dt();
int    snd_tbl_dt();
int    snd_bas_tbl();
int    wpi_record_cnt(int isfd, int fno);
int    snd_wrkr_crd_tbl();
int    pass_fare_record_cnt(int isfd, int fno);
int    snd_pass_fare_tbl();
int    snd_tag_bl_tbl();
int    snd_iss_comp_tbl();
int    snd_tag_pl_tbl();
int    lane_cir_test();
int    rq_plz_cir_test();
void   chg_asc_ks_code(uchar *ksc, int ksl, uchar *asc, int asl);
int    snd_iss_info(char *msg_buf);
int    snd_perd_tag_sale(char *msg_buf);
int    snd_rgstr_chrg_reply(char *msg_buf);
int    snd_tag_cncl_chrg(char *msg_buf);
int    snd_tag_info_srch(char *msg_buf);
int    snd_tag_cncl_chrg(char *msg_buf);
int    snd_prev_tr_info(char *msg_buf);
int    snd_rq_seq_no(char *msg_buf);

/*** senddata_filecreation.c ***/
int    tagblrq_send(struct bl_struct *rehnd);

/*** lcc_function.c ***/
int    lcc_open();
int    lcc_accept();
int    lcc_recv();
int    lcc_check();
int    lcc_proc_start();
int    lcc_proc_stop();
int    lcc_wrk_stop();
int    lcc_resnd();
int    lcc_tbl_dmp();
int    lcc_lane_test();
int    lcc_warr_seq();
int    lcc_tbl_ord();
int    lcc_voice_ord();
int    lcc_sms_data();
int    lcc_srch_rmotlane_stat();
int    lcc_lsam_info_rq();
int    lcc_psam_info_rq();
int    lcc_lsam_chrg_ok();
int    lcc_lsam_chrg_cmplt_ok();
int    lcc_lsam_chrg_rstr_ok();
int    lcc_lsam_chrg_rstr_cmplt_ok();
int    lcc_lsam_rfnd_ok();    
int    lcc_lsam_rfnd_cmplt_ok();
int    lcc_lsam_rfnd_ok();
int    lcc_lsam_rfnd_cmplt_ok();
int    lcc_lsam_rfnd_rstr_cmplt_ok();
int    lcc_lsam_rgst_ok();
int    lcc_lsam_para_ok();
int    lcc_psam_para_ok();
int    lcc_reply();    
int    lcc_epay_reply();
int    lcc_error();
int    lcc_job();    
int    lcc_traffic();
int    lcc_plz_lanestat();

/*** sock_function.c ***/
int    sock_open_port();
int    sock_accept_port();
int    sock_conn_port();
int    etc_recv_data();
int    sock_recv_data();
int    sock_send_data();
int    sock_close_port();
int    azn_recv_data();

/*** typ_chng.c ***/
int    smemcpy(int how, int way, char *des, char *src, int len, int bitmask);
int    btosh(char *des, char *src);
int    shtob(char *des, char *src);
int    dtoa(char *des, char *src, int len, int bitmask);
int    atod(char *des, char *src, int len, int bitmask);
int    dtoi(char *des, char *src, int len, int bitmask);
int    itoD(char *des, char *src, int len, int bitmask);
int    stob(char *src, char *des, int len);
int    itob(char *des, char *src, int len);
int    btod(char *des, char *src, int len, int bitmask);
int    shtod(char *des, char *src, int len, int bitmask);
int    dtos(char *des, char *src, int len, int bitmask);
int    dtob(char *des, char *src, int len, int bitmask);
int    btoi(char *des, char *src, int len);
int    btos(char *des, char *src, int len);
int    Packet( char *fmt, ... );
void   log_open(char *date, FILE *packet_f);
void   packet_open(char *date, FILE *packet_f);
void   packet_close(FILE *packet_f);
void   log_close();

int    tagbl_Packet( char *fmt, ... );
void   tagbl_packet_close();
void   tagbl_log_close();

/*** rcv_function.c ***/
#if 1
int    recv_process();
#else
int   *recv_process(void *pData);
#endif
int    chk_seq_no();
int    trace_high();
int    trace_low();

/*** azn_packet_chng.c ***/
int azn_packet_h2l(unsigned char *buf, int len);
int azn_packet_l2h(unsigned char *buf, int len);

/*** ft_parsing.sc ***/
#if 0
int file_tbl_chng(struct chg_struc *cs);
#else
int file_tbl_chng(char *buffer);
#endif
/*** ft_basictbl.sc ***/
int chng_t2f_basictbl(struct chg_struc *cs);
int chng_t2f_wrkrpersonalinfo(struct chg_struc *cs);
int chng_t2f_passfaretbl(struct chg_struc *cs);
int chng_t2f_isscomptbl();
int chng_t2f_rtagmst();
int chng_t2f_rtagcng();
int chng_t2f_ptagmst();
int chng_t2f_ptagcng();

/*** wrk_data_handle.sc ***/
int proc_rq_snd_no(char *target, char *rep);
int proc_lane_stat_info(char *target);
int proc_rpr_data(char *target);
int proc_cls_pass(char *target);
int proc_sens_data(char *target);
int inst_day_chg(char *target);
int inst_day_end(char *target);
int proc_wrk_start(char *target);
int proc_outwrk_end(char *target);
int proc_inwrk_end(char *target);
int proc_out_way(char *target);
int proc_car_no(char *target);
int proc_in_way(char *target);
int proc_iss_info(char *target, char *rep);
int proc_prev_tr_info(char *target, char *rep);
int proc_tag_info(char *target, char *rep);
int proc_in_spcl(char *target);
int proc_ofc_data(char *target);
int proc_etcs_vio(char *target);

/*** wrk_data_comm_lb.sc ***/
int wrksvr_log( char *form, ... );
void wrklog_open(char *date);
void wrklog_close();
int wait_reply(int fd, int time_out);
int lo_lane_re_snd_rq(struct write_info *wf, int re_snd_rq);
int bind2socket(char *proc_name);

/*** wrk_data_lb.sc ***/
int chk_wrk_end_dt();
int chk_wrk_endhnd_yn();
int chk_lane_stat(struct rcv_lane_data *rd);
int fsave_write_info(struct write_info *wf);

/*** tagbl_packet_chng.c ***/
int tcrdbl_hd_packet_chng(unsigned char *h_buf, unsigned char *l_buf);
int tcrdbl_fr_packet_chng(unsigned char *h_buf, unsigned char *l_buf);
int tcrdpl_hd_packet_chng(unsigned char *h_buf, unsigned char *l_buf);
int tcrdpl_fr_packet_chng(unsigned char *h_buf, unsigned char *l_buf);
int carno_hd_packet_chng(unsigned char *h_buf, unsigned char *l_buf);
int carno_fr_packet_chng(unsigned char *h_buf, unsigned char *l_buf);

/*** send_tagbl.sc ***/
int send_tagbl(struct bl_struct *cs);

/*** lane_comm.c[tagbl] ***/
int lane_bk_comm_open(char *device, char *plz, int lane);
int lane_bk_comm_accept(char *device);
int lane_bk_comm_reopen();

/*** Message Que ***/
int MessageSender(int type, char *packet, char *path, char *rtn);
int GetLength(int type);
#endif
