Changeset 3137
- Timestamp:
- 09/21/10 23:35:57 (14 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/globals.h
r3124 r3137 1238 1238 extern int network_tcp_connection_open(); 1239 1239 extern void network_tcp_connection_close(struct s_reader * reader, int); 1240 extern int casc_recv_timer(struct s_reader * reader, uchar *buf, int l, int msec); 1240 1241 1241 1242 // oscam-log -
trunk/module-cccam.c
r3133 r3137 474 474 int cc_msg_recv(uint8 *buf) { 475 475 struct s_client *cl = &client[cs_idx]; 476 struct s_reader *rdr = &reader[ridx];476 struct s_reader *rdr = is_server?NULL:&reader[ridx]; 477 477 478 478 int len; … … 536 536 int cc_cmd_send(uint8 *buf, int len, cc_msg_type_t cmd) { 537 537 struct s_client *cl = &client[cs_idx]; 538 struct s_reader *rdr = &reader[ridx];538 struct s_reader *rdr = is_server?NULL:&reader[ridx]; 539 539 540 540 int n; … … 864 864 if (!cc || (pfd < 1) || !rdr->tcp_connected) { 865 865 if (er) { 866 //er->rc = 0;867 //er->rcEx = 0x27;866 er->rc = 0; 867 er->rcEx = 0x27; 868 868 cs_debug_mask(D_TRACE, "%s server not init! ccinit=%d pfd=%d", 869 869 getprefix(), cc ? 1 : 0, pfd); 870 //write_ecm_answer(rdr, fd_c2m, er);870 write_ecm_answer(rdr, fd_c2m, er); 871 871 } 872 872 cc_cli_close(); … … 1602 1602 int cc_parse_msg(uint8 *buf, int l) { 1603 1603 struct s_client *cl = &client[cs_idx]; 1604 struct s_reader *rdr = &reader[ridx];1604 struct s_reader *rdr = is_server?NULL:&reader[ridx]; 1605 1605 1606 1606 int ret = buf[1]; … … 2309 2309 cc->just_logged_in = 1; 2310 2310 2311 return 0; 2311 //Receive Cards 2312 n = 0; 2313 do { 2314 n = casc_recv_timer(rdr, buf, sizeof(buf), 10); 2315 cs_log("n=%d", n); 2316 } while (n == MSG_NEW_CARD || n == MSG_SRV_DATA || n == MSG_CLI_DATA); 2317 2318 if (n>0) n = 0; 2319 return n; 2312 2320 } 2313 2321 … … 2766 2774 int pipe = open((char*) buf, O_WRONLY); 2767 2775 2768 if (!cc || rdr->tcp_connected == 0) 2776 if (!cc || rdr->tcp_connected == 0) { 2769 2777 cc_cli_init_int(); 2778 cc = cl->cc; 2779 } 2770 2780 2771 2781 if (cc && rdr->tcp_connected == 2) { -
trunk/oscam-config.c
r3135 r3137 4079 4079 } 4080 4080 4081 static char tmpdir[200] = {0x00};4082 4083 /**4084 * get tmp dir4085 **/4086 char * get_tmp_dir()4087 {4088 if (tmpdir[0])4089 return tmpdir;4090 4091 #ifdef OS_CYGWIN4092 char *d = getenv("TMPDIR");4093 if (!d || !d[0])4094 d = getenv("TMP");4095 if (!d || !d[0])4096 d = getenv("TEMP");4097 if (!d || !d[0])4098 getcwd(tmpdir, sizeof(tmpdir)-1);4099 4100 strcpy(tmpdir, d);4101 char *p = tmpdir;4102 while(*p) p++;4103 p--;4104 if (*p != '/' && *p != '\\')4105 strcat(tmpdir, "/");4106 strcat(tmpdir, "_oscam");4107 4108 #else4109 strcpy(tmpdir, "/tmp/.oscam");4110 #endif4111 mkdir(tmpdir, S_IRWXU);4112 return tmpdir;4113 }4114 4115 -
trunk/oscam-reader.c
r3112 r3137 90 90 } 91 91 92 staticint casc_recv_timer(struct s_reader * reader, uchar *buf, int l, int msec)92 int casc_recv_timer(struct s_reader * reader, uchar *buf, int l, int msec) 93 93 { 94 94 struct timeval tv; … … 720 720 while (1) 721 721 { 722 /* FIXME: this breaks newcamd/camd3 cascading as newcamd/camd35 only connects if server sends ecm/emm to client */723 //if (reader->typ == R_CCCAM && !reader->tcp_connected && client[cs_idx].typ == 'p') {724 // cs_log("%s not connected! Reconection in %d sec", reader->label, cfg->reader_restart_seconds);725 // cs_sleepms(1000 * cfg->reader_restart_seconds);726 // if (reader->ph.c_init() && reader->ph.cleanup) {727 // reader->ph.cleanup();728 // continue;729 // }730 //}731 722 switch(reader_listen(reader, client[reader->cs_idx].fd_m2c_c, pfd)) 732 723 { -
trunk/oscam.c
r3123 r3137 26 26 ushort len4caid[256]; // table for guessing caid (by len) 27 27 char cs_confdir[128]=CS_CONFDIR; 28 char cs_tmpdir[200]={0x00}; 28 29 uchar mbuf[1024]; // global buffer 29 30 pthread_mutex_t gethostbyname_lock; … … 139 140 fprintf(stderr, "\t-c <dir> : read configuration from <dir>\n"); 140 141 fprintf(stderr, "\t default = %s\n", CS_CONFDIR); 142 fprintf(stderr, "\t-t <dir> : tmp dir <dir>\n"); 143 #ifdef CS_CYGWIN32 144 fprintf(stderr, "\t default = (OS-TMP)\n"); 145 #else 146 fprintf(stderr, "\t default = /tmp/.oscam\n"); 147 #endif 141 148 fprintf(stderr, "\t-d <level> : debug level mask\n"); 142 149 fprintf(stderr, "\t 0 = no debugging (default)\n"); … … 3002 3009 // } 3003 3010 //} 3004 3011 3012 3013 /** 3014 * get tmp dir 3015 **/ 3016 char * get_tmp_dir() 3017 { 3018 if (cs_tmpdir[0]) 3019 return cs_tmpdir; 3020 3021 #ifdef OS_CYGWIN32 3022 char *d = getenv("TMPDIR"); 3023 if (!d || !d[0]) 3024 d = getenv("TMP"); 3025 if (!d || !d[0]) 3026 d = getenv("TEMP"); 3027 if (!d || !d[0]) 3028 getcwd(cs_tmpdir, sizeof(cs_tmpdir)-1); 3029 3030 strcpy(cs_tmpdir, d); 3031 char *p = cs_tmpdir; 3032 while(*p) p++; 3033 p--; 3034 if (*p != '/' && *p != '\\') 3035 strcat(cs_tmpdir, "/"); 3036 strcat(cs_tmpdir, ".oscam"); 3037 #else 3038 strcpy(cs_tmpdir, "/tmp/.oscam"); 3039 #endif 3040 mkdir(cs_tmpdir, S_IRWXU); 3041 return cs_tmpdir; 3042 } 3043 3044 3005 3045 int main (int argc, char *argv[]) 3006 3046 { … … 3039 3079 }; 3040 3080 3041 while ((i=getopt(argc, argv, "bc: d:hm:"))!=EOF)3081 while ((i=getopt(argc, argv, "bc:t:d:hm:"))!=EOF) 3042 3082 { 3043 3083 switch(i) … … 3049 3089 case 'd': cs_dblevel=atoi(optarg); 3050 3090 break; 3091 case 't': cs_strncpy(cs_tmpdir, optarg, sizeof(cs_tmpdir)); 3051 3092 case 'm': 3052 3093 #ifdef CS_NOSHM
Note:
See TracChangeset
for help on using the changeset viewer.