/*
 *========================================================================
 *
 *    : во 
 *      : eps_main.c
 *      :  (baarong@neighbor21.co.kr)
 *      : 2018.11.15
 *      :
 *        :
 *
 *========================================================================
*/

#ifndef  _EPS_PACK_H_
#define  _EPS_PACK_H_
#include <stdio.h>
#include <string.h>
#include <signal.h>
#include <sys/types.h>
#include <fcntl.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>

#define ClearingCenter "CCGW00"
#define HQ_Center "HQCC00"
#define HEADdata_LEN     43
#define saledata_LEN     106
#define chrgdata_LEN     86
#define canceldata_LEN   100

typedef struct
{
    char  stx;
    int   len;
    char  send[7];
    char  recv[7];
    int   work;
    int   job;
    char  date[15];
    char  reply[5];
    char  path[61];
    char  file_id[17];
    int   file_size;
    char  etx;
} PACKET_RQ;

typedef struct _HEADdata
{
      char stx          ;  //STX
      char length    [4];  //length - STX, lengh, ETX 
      char plz_id    [6];  //PLAZA_ID
      char grp_id    [6];  //GROUP_ID
      char job       [4];  // WORK
      char work      [4];  // JOB
      char send_date[14];  // 
      char rply_code [4];  //
} HEADdata;

typedef struct _saledata
{
    char OCRN_DTTM     [ 14 ]; /* AN  */           
    char TAG_ID        [ 24 ]; /* AN TAG ID */             
    char TAG_ISSC_CD   [ 2  ]; /* AN TAG   */    
    char WORK_DATES    [ 8  ]; /* AN  */           
    char TOLOF_CD      [ 6  ]; /* AN   */        
    char WORK_NO       [ 4  ]; /* AN  */           
    char PROS_SEQ      [ 8  ]; /* N  */        
    char WORKER_NO     [ 6  ]; /* AN  */         
    char TAG_ATR       [ 1  ]; /* AN TAG  */           
    char TAG_HND_CD    [ 2  ]; /* AN TAG  */       
    char TAG_KNCR      [ 1  ]; /* AN TAG  */           
    char TAG_EXPT      [ 10 ]; /* AN TAG   */
    char TAG_RGST_VHNO [ 6  ]; /* AN TAG  */   
    char ISNC_VHNO     [ 12 ]; /* AN   */    
    char TAG_CRC       [ 2  ]; /* AN TAG CRC */            

} saledata;

typedef struct _chrgdata
{
    char   OCRN_DTTM   [14];    /*AN */
    char   TAG_ID      [24];    /*AN TAG ID*/
    char   TAG_ISSC_CD [2 ];    /*AN  */
    char   WORK_DATES  [8 ];    /*AN */
    char   TOLOF_CD    [6 ];    /*AN  */
    char   WORK_NO     [4 ];    /*AN */
    char   PROS_SEQ    [8 ];    /* N */
    char   WORKER_NO   [6 ];    /*AN */
    char   CHRGG_AMT   [8 ];    /* N */
    char   RFID_SGNT   [4 ];    /*AN RFID */
    char   TAG_CRC     [2 ];    /*AN TAG CRC*/

} chrgdata;

typedef struct _canceldata
{
    char   OCRN_DTTM       [14];    /*AN */
    char   TAG_ID          [24];    /*AN TAG ID*/
    char   TAG_ISSC_CD     [2 ];    /*AN  */
    char   WORK_DATES      [8 ];    /*AN */
    char   TOLOF_CD        [6 ];    /*AN  */
    char   WORK_NO         [4 ];    /*AN */
    char   PROS_SEQ        [8 ];    /* N */
    char   WORKER_NO       [6 ];    /*AN */
    char   BFEQ_CHRGG_DTTM [14];    /*AN    */
    char   CHRGG_AMT       [8 ];    /* N */
    char   RFID_SGNT       [4 ];    /*AN RFID */
    char   TAG_CRC         [2 ];    /*AN TAG CRC*/

} canceldata;


#endif
