Changeset 10279
- Timestamp:
- 01/24/15 11:20:40 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/module-gbox.c
r10263 r10279 680 680 if ((data[11] & 0xf) != peer->next_hello) 681 681 { 682 cs_log("-> [gbx] receivedout of sync hello from %s %s, expected: %02X, received: %02X"682 cs_log("-> out of sync hello from %s %s, expected: %02X, received: %02X" 683 683 ,username(cli), cli->reader->device, peer->next_hello, data[11] & 0xf); 684 684 peer->next_hello = 0; … … 763 763 if(!cs_malloc(&card, sizeof(struct gbox_card))) 764 764 { 765 cs_log(" [gbx]:Can't allocate gbox card");765 cs_log("Can't allocate gbox card"); 766 766 continue; 767 767 } … … 817 817 { 818 818 //This is a good night / reset packet (good night data[0xA] / reset !data[0xA] 819 cs_log("-> [gbx] receivedGood Night from %s %s",username(cli), cli->reader->device);819 cs_log("-> Good Night from %s %s",username(cli), cli->reader->device); 820 820 write_goodnight_to_osd_file(cli); 821 821 gbox_reinit_proxy(cli); … … 835 835 if(!data[0xA]) 836 836 { 837 cs_log("<- HelloS in %d packets from %s (%s:%d) V2.%02X with %d cards filtered to %d cards", (data[0x0B] & 0x0f)+1, cli->reader->label, cs_inet_ntoa(cli->ip), cli->reader->r_port, peer->gbox.minor_version, ncards_in_msg,ll_count(peer->gbox.cards));837 cs_log("<- HelloS in %d packets from %s (%s:%d) V2.%02X with %d cards filtered to %d cards", (data[0x0B] & 0x0f)+1, cli->reader->label, cs_inet_ntoa(cli->ip), cli->reader->r_port, peer->gbox.minor_version, ncards_in_msg,ll_count(peer->gbox.cards)); 838 838 peer->hello_stat = GBOX_STAT_HELLOR; 839 839 gbox_send_hello(cli); … … 841 841 else 842 842 { 843 cs_log("<- HelloR in %d packets from %s (%s:%d) V2.%02X with %d cards filtered to %d cards", (data[0x0B] & 0x0f)+1, cli->reader->label, cs_inet_ntoa(cli->ip), cli->reader->r_port, peer->gbox.minor_version, ncards_in_msg,ll_count(peer->gbox.cards));843 cs_log("<- HelloR in %d packets from %s (%s:%d) V2.%02X with %d cards filtered to %d cards", (data[0x0B] & 0x0f)+1, cli->reader->label, cs_inet_ntoa(cli->ip), cli->reader->r_port, peer->gbox.minor_version, ncards_in_msg,ll_count(peer->gbox.cards)); 844 844 gbox_send_checkcode(cli); 845 845 } … … 969 969 break; 970 970 case MSG_GOODBYE: 971 cs_log("-> [gbx] receivedgoodbye message from %s",username(proxy));971 cs_log("-> goodbye message from %s",username(proxy)); 972 972 //needfix what to do after Goodbye? 973 973 //suspect: we get goodbye as signal of SID not found 974 974 break; 975 975 case MSG_UNKNWN: 976 cs_log("-> [gbx] receivedMSG_UNKNWN 48F9 from %s", username(proxy));976 cs_log("-> MSG_UNKNWN 48F9 from %s", username(proxy)); 977 977 break; 978 978 case MSG_GSMS_1: 979 979 if (!cfg.gsms_dis) 980 980 { 981 cs_log("-> [gbx] receivedMSG_GSMS_1 from %s", username(proxy));981 cs_log("-> MSG_GSMS_1 from %s", username(proxy)); 982 982 gbox_send_gsms_ack(proxy,1); 983 983 write_gsms_msg(proxy, data +4, data[3], data[2]); … … 991 991 if (!cfg.gsms_dis) 992 992 { 993 cs_log("-> [gbx] receivedMSG_GSMS_2 from %s", username(proxy));993 cs_log("-> MSG_GSMS_2 from %s", username(proxy)); 994 994 gbox_send_gsms_ack(proxy,2); 995 995 write_gsms_msg(proxy, data +16, data[14], data[15]); … … 1003 1003 if (!cfg.gsms_dis) 1004 1004 { 1005 cs_log("-> [gbx] receivedMSG_GSMS_ACK_1 from %s", username(proxy));1005 cs_log("-> MSG_GSMS_ACK_1 from %s", username(proxy)); 1006 1006 write_gsms_ack(proxy,1); 1007 1007 } … … 1014 1014 if (!cfg.gsms_dis) 1015 1015 { 1016 cs_log("-> [gbx] receivedMSG_GSMS_ACK_2 from %s", username(proxy));1016 cs_log("-> MSG_GSMS_ACK_2 from %s", username(proxy)); 1017 1017 write_gsms_ack(proxy,2); 1018 1018 } … … 1037 1037 break; 1038 1038 default: 1039 cs_log("-> [gbx]unknown command %04X received from %s", cmd, username(proxy));1039 cs_log("-> unknown command %04X received from %s", cmd, username(proxy)); 1040 1040 cs_ddump_mask(D_READER, data, n, "unknown data received (%d bytes):", n); 1041 1041 } // end switch … … 1266 1266 { 1267 1267 case GBOX_STAT_HELLOL: 1268 cs_log(" send HELLOL to %s", cli->reader->label);1268 cs_log("<- HelloL to %s", cli->reader->label); 1269 1269 if((number & 0x80) == 0x80) 1270 1270 { peer->hello_stat = GBOX_STAT_HELLOS; } 1271 1271 break; 1272 1272 case GBOX_STAT_HELLOS: 1273 cs_log(" send HELLOS total cards %d to %s", nbcards, cli->reader->label);1273 cs_log("<- HelloS total cards %d to %s", nbcards, cli->reader->label); 1274 1274 if((number & 0x80) == 0x80) 1275 1275 { peer->hello_stat = GBOX_STAT_HELLO3; } 1276 1276 break; 1277 1277 case GBOX_STAT_HELLOR: 1278 cs_log(" send HELLOR total cards %d to %s", nbcards, cli->reader->label);1278 cs_log("<- HelloR total cards %d to %s", nbcards, cli->reader->label); 1279 1279 if((number & 0x80) == 0x80) 1280 1280 { peer->hello_stat = GBOX_STAT_HELLO3; } 1281 1281 break; 1282 1282 default: 1283 cs_log(" sendhello total cards %d to %s", nbcards, cli->reader->label);1283 cs_log("<- hello total cards %d to %s", nbcards, cli->reader->label); 1284 1284 break; 1285 1285 } 1286 cs_ddump_mask(D_READER, outbuf, len, " sendhello, (len=%d):", len);1286 cs_ddump_mask(D_READER, outbuf, len, "<- hello, (len=%d):", len); 1287 1287 1288 1288 gbox_compress(outbuf, len, &len); … … 1487 1487 gbox_send(cli, buf, ere->gbox_hops + 44); 1488 1488 1489 cs_debug_mask(D_READER, " -> CW (->%d) from %s/%d (%04X) ", ere->gbox_hops, cli->reader->label, cli->port, ere->gbox_peer);1489 cs_debug_mask(D_READER, "<- CW (distance: %d) from %s/%d (%04X) ", ere->gbox_hops, cli->reader->label, cli->port, ere->gbox_peer); 1490 1490 } 1491 1491 … … 1782 1782 uint32_t crc = data[30] << 24 | data[31] << 16 | data[32] << 8 | data[33]; 1783 1783 char tmp[32]; 1784 cs_debug_mask(D_READER, " receivedcws=%s, peer=%04X, ecm_pid=%04X, sid=%04X, crc=%08X, type=%02X, dist=%01X, unkn1=%01X, unkn2=%02X, chid/0x0000/0xffff=%04X",1784 cs_debug_mask(D_READER, "-> cws=%s, peer=%04X, ecm_pid=%04X, sid=%04X, crc=%08X, type=%02X, dist=%01X, unkn1=%01X, unkn2=%02X, chid/0x0000/0xffff=%04X", 1785 1785 cs_hexdump(0, dcw, 32, tmp, sizeof(tmp)), 1786 1786 data[10] << 8 | data[11], data[6] << 8 | data[7], data[8] << 8 | data[9], crc, data[41], data[42] & 0x0f, data[42] >> 4, data[43], data[37] << 8 | data[38]); … … 2141 2141 if(!cs_malloc(&pending, sizeof(struct gbox_card_pending))) 2142 2142 { 2143 cs_log(" [gbx]:Can't allocate gbox card pending");2143 cs_log("Can't allocate gbox card pending"); 2144 2144 return -1; 2145 2145 } … … 2153 2153 it = ll_iter_create(er->gbox_cards_pending); 2154 2154 while ((pending = ll_iter_next(&it))) 2155 { cs_debug_mask(D_READER, " [gbx]:Pending Card ID: %04X Slot: %02X Time: %d", pending->id.peer, pending->id.slot, pending->pending_time); }2155 { cs_debug_mask(D_READER, "Pending Card ID: %04X Slot: %02X Time: %d", pending->id.peer, pending->id.slot, pending->pending_time); } 2156 2156 2157 2157 if(er->gbox_ecm_status > GBOX_ECM_NOT_ASKED) … … 2179 2179 else 2180 2180 { args.waittime = GBOX_REBROADCAST_TIMEOUT; } 2181 cs_debug_mask(D_READER, " [gbx]:Creating rebroadcast thread with waittime: %d", args.waittime);2181 cs_debug_mask(D_READER, "Creating rebroadcast thread with waittime: %d", args.waittime); 2182 2182 int32_t ret = pthread_create(&rbc_thread, NULL, (void *)gbox_rebroadcast_thread, &args); 2183 2183 if(ret) 2184 2184 { 2185 cs_log(" [gbx]:Can't create gbox rebroadcast thread (errno=%d %s)", ret, strerror(ret));2185 cs_log("Can't create gbox rebroadcast thread (errno=%d %s)", ret, strerror(ret)); 2186 2186 return -1; 2187 2187 } … … 2240 2240 //gbox peer apparently died without saying goodbye 2241 2241 peer = proxy->gbox; 2242 cs_debug_mask(D_READER, " gboxtime since last proxy activity in sec: %d => taking gbox peer offline",time_since_last);2242 cs_debug_mask(D_READER, "time since last proxy activity in sec: %d => taking gbox peer offline",time_since_last); 2243 2243 gbox_reinit_proxy(proxy); 2244 2244 } … … 2248 2248 { 2249 2249 peer = proxy->gbox; 2250 cs_debug_mask(D_READER, " gboxtime since last ecm in sec: %d => trigger keepalive hello",time_since_last);2250 cs_debug_mask(D_READER, "time since last ecm in sec: %d => trigger keepalive hello",time_since_last); 2251 2251 if (!peer->online) 2252 2252 { peer->hello_stat = GBOX_STAT_HELLOL; } … … 2258 2258 } 2259 2259 //prevent users from timing out 2260 cs_debug_mask(D_READER, " gboxclient idle prevented: %s", username(cl));2260 cs_debug_mask(D_READER, "client idle prevented: %s", username(cl)); 2261 2261 cl->last = time((time_t *)0); 2262 2262 } … … 2283 2283 memcpy(&outbuf[21], cfg.gbox_hostname, hostname_len); 2284 2284 outbuf[21 + hostname_len] = hostname_len; 2285 cs_log(" gbox sendgood night to %s:%d id: %04X", rdr->device, rdr->r_port, peer->gbox.id);2285 cs_log("<- good night to %s:%d id: %04X", rdr->device, rdr->r_port, peer->gbox.id); 2286 2286 gbox_compress(outbuf, len, &len); 2287 2287 gbox_send(proxy, outbuf, len);
Note:
See TracChangeset
for help on using the changeset viewer.