8 #define DEFAULT_GBOX_MAX_DIST 2
9 #define DEFAULT_GBOX_MAX_ECM_SEND 3
10 #define DEFAULT_GBOX_RESHARE 2
11 #define DEFAULT_GBOX_RECONNECT 180
12 #define GBOX_MIN_RECONNECT 60
13 #define GBOX_MAX_RECONNECT 300
14 #define CS_GBOX_MAX_LOCAL_CARDS 16
15 #define GBOX_REBROADCAST_TIMEOUT 1250
16 #define GBOX_MIN_REBROADCAST_TIME 100
17 #define GBOX_SID_CONFIRM_TIME 3600
18 #define GBOX_DEFAULT_CW_TIME 500
20 #define MSG_ECM 0x445C
22 #define MSG_HELLO 0xDDAB
23 #define MSG_HELLO1 0x4849
24 #define MSG_CHECKCODE 0x41C0
25 #define MSG_GOODBYE 0x9091
26 #define MSG_GSMS_ACK 0x9099
27 #define MSG_GSMS 0x0FFF
28 #define MSG_HERE 0xA0A1
30 #define GBOX_ECM_NOT_ASKED 0
31 #define GBOX_ECM_SENT 1
32 #define GBOX_ECM_SENT_ALL 2
33 #define GBOX_ECM_SENT_ALL_TWICE 3
34 #define GBOX_ECM_ANSWERED 4
36 #define GBOX_CARD_TYPE_GBOX 0
37 #define GBOX_CARD_TYPE_LOCAL 1
38 #define GBOX_CARD_TYPE_BETUN 2
39 #define GBOX_CARD_TYPE_CCCAM 3
40 #define GBOX_CARD_TYPE_PROXY 4
42 #define FILE_GBOX_VERSION "gbox.ver"
43 #define FILE_SHARED_CARDS_INFO "share.info"
44 #define FILE_BACKUP_CARDS_INFO "expired.info"
45 #define FILE_ATTACK_INFO "attack.txt"
46 #define FILE_GBOX_PEER_ONL "share.onl"
47 #define FILE_STATS "stats.info"
48 #define FILE_MSG_INFO "msg.info"
49 #define FILE_LOCAL_CARDS_INFO "sc.info"
51 #define MSGID_GOODNIGHT 0
53 #define MSGID_GONEOFFLINE 2
54 #define MSGID_COMEONLINE 3
55 #define MSGID_GOODBYE 4
56 #define MSGID_LOSTCONNECT 5
57 #define MSGID_ATTACK 6
58 #define MSGID_IPCHANGE 7
59 #define MSGID_GBOXONL 8
60 #define MSGID_UNKNOWNMSG 9
62 #define GBOX_STAT_HELLOL 0
63 #define GBOX_STAT_HELLOS 1
64 #define GBOX_STAT_HELLOR 2
66 #define GBOX_DELETE_FROM_PEER 0
67 #define GBOX_DELETE_WITH_ID 1
68 #define GBOX_DELETE_WITH_TYPE 2
70 #define GBOX_PEER_OFFLINE 0
71 #define GBOX_PEER_ONLINE 1
73 #define GBOX_ATTACK_LOCAL_PW 0
74 #define GBOX_ATTACK_PEER_IGNORE 1
75 #define GBOX_ATTACK_PEER_PW 2
76 #define GBOX_ATTACK_AUTH_FAIL 3
77 #define GBOX_ATTACK_ECM_BLOCKED 4
78 #define GBOX_ATTACK_REMM_REQ_BLOCKED 5
80 struct gbox_rbc_thread_args
93 struct gbox_good_srvid
95 struct gbox_srvid srvid
;
96 time_t last_cw_received
;
101 struct gbox_srvid srvid
;
111 struct gbox_card_pending
113 struct gbox_card_id id
;
114 uint32_t pending_time
;
119 struct gbox_card_id id
;
124 LLIST
*badsids
; // sids that have failed to decode (struct gbox_srvid)
125 LLIST
*goodsids
; //sids that could be decoded (struct gbox_srvid)
126 uint32_t no_cws_returned
;
127 uint32_t average_cw_time
;
128 struct gbox_peer
*origin_peer
;
135 uint8_t minor_version
;
141 struct gbox_data gbox
;
151 struct s_client
*my_user
;
152 uint16_t filtered_cards
;
153 uint16_t total_cards
;
157 struct gbox_ecm_request_ext
161 uint16_t gbox_mypeer
;
163 uint8_t gbox_version
;
166 uchar gbox_routing_info
[GBOX_MAXHOPS
];
169 void handle_attack(struct s_client
*cli
, uint8_t txt_id
, uint16_t rcvd_id
);
170 char *get_gbox_tmp_fname(char *fext
);
171 uint16_t gbox_get_local_gbox_id(void);
172 uint32_t gbox_get_local_gbox_password(void);
173 void gbox_send(struct s_client
*cli
, uchar
*buf
, int32_t l
);
174 int8_t gbox_message_header(uchar
*buf
, uint16_t cmd
, uint32_t peer_password
, uint32_t local_password
);
175 void gbox_free_cards_pending(ECM_REQUEST
*er
);
176 void gbox_send_good_night(void);
177 void gbox_send_goodbye(struct s_client
*cli
);
178 extern void gbx_local_card_changed(void);
180 static inline void gbox_free_cards_pending(ECM_REQUEST
*UNUSED(er
)) { }
181 static inline void gbox_send_good_night(void) { }
182 static inline void gbx_local_card_changed(void) { }