Changeset 3159 for trunk/module-newcamd.c
- Timestamp:
- 09/22/10 15:07:06 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/module-newcamd.c
r3157 r3159 84 84 uint8 netbuf[CWS_NETMSGSIZE]; 85 85 int head_size; 86 head_size = ( client[cs_idx].ncd_proto==NCD_524)?8:12;86 head_size = (reader[client[cs_idx].ridx].ncd_proto==NCD_524)?8:12; 87 87 88 88 if (len < 3 || len + head_size > CWS_NETMSGSIZE || handle < 0) … … 107 107 else 108 108 netbuf[2] = netbuf[3] = 0; 109 memset(netbuf+4, 0, ( client[cs_idx].ncd_proto==NCD_524)?4:8);109 memset(netbuf+4, 0, (reader[client[cs_idx].ridx].ncd_proto==NCD_524)?4:8); 110 110 if( sid ) { 111 netbuf[( client[cs_idx].ncd_proto==NCD_524)?6:4] = (uchar)(sid>>8); //sid112 netbuf[( client[cs_idx].ncd_proto==NCD_524)?7:5] = (uchar)(sid);111 netbuf[(reader[client[cs_idx].ridx].ncd_proto==NCD_524)?6:4] = (uchar)(sid>>8); //sid 112 netbuf[(reader[client[cs_idx].ridx].ncd_proto==NCD_524)?7:5] = (uchar)(sid); 113 113 } 114 114 //if ((!ncd_proto==NCD_524) && (buffer[0] >= 0xd1) && (buffer[0]<= 0xd8)) { // extended proto for mg … … 179 179 msgid = (netbuf[2] << 8) | netbuf[3]; 180 180 181 if( client[cs_idx].ncd_proto==NCD_AUTO ) {181 if( reader[client[cs_idx].ridx].ncd_proto==NCD_AUTO ) { 182 182 // auto detect 183 183 int l5 = (((netbuf[13] & 0x0f) << 8) | netbuf[14]) + 3; … … 185 185 186 186 if( (l5<=len-12) && ((netbuf[12]&0xF0)==0xE0 || (netbuf[12]&0xF0)==0x80) ) 187 client[cs_idx].ncd_proto = NCD_525;187 reader[client[cs_idx].ridx].ncd_proto = NCD_525; 188 188 else if( (l4<=len-8) && ((netbuf[8]&0xF0)==0xE0 || (netbuf[9]&0xF0)==0x80) ) 189 client[cs_idx].ncd_proto = NCD_524;189 reader[client[cs_idx].ridx].ncd_proto = NCD_524; 190 190 else { 191 191 cs_debug("nmr: 4 return -1"); … … 193 193 } 194 194 195 cs_debug("nmr: autodetect: newcamd52%d used", ( client[cs_idx].ncd_proto==NCD_525)?5:4);195 cs_debug("nmr: autodetect: newcamd52%d used", (reader[client[cs_idx].ridx].ncd_proto==NCD_525)?5:4); 196 196 } 197 197 198 ncd_off=( client[cs_idx].ncd_proto==NCD_525)?4:0;198 ncd_off=(reader[client[cs_idx].ridx].ncd_proto==NCD_525)?4:0; 199 199 200 200 returnLen = (((netbuf[9+ncd_off] & 0x0f) << 8) | netbuf[10+ncd_off]) + 3; … … 229 229 { 230 230 case COMMTYPE_SERVER: 231 buffer[0]=( client[cs_idx].ncd_proto==NCD_525)?netbuf[4]:netbuf[6]; // sid232 buffer[1]=( client[cs_idx].ncd_proto==NCD_525)?netbuf[5]:netbuf[7];231 buffer[0]=(reader[client[cs_idx].ridx].ncd_proto==NCD_525)?netbuf[4]:netbuf[6]; // sid 232 buffer[1]=(reader[client[cs_idx].ridx].ncd_proto==NCD_525)?netbuf[5]:netbuf[7]; 233 233 break; 234 234 case COMMTYPE_CLIENT: … … 1237 1237 client[cs_idx].udp_sa.sin_port = htons((u_short)reader[client[cs_idx].ridx].r_port); 1238 1238 1239 client[cs_idx].ncd_proto = reader[client[cs_idx].ridx].ncd_proto;1240 1241 1239 cs_log("proxy %s:%d newcamd52%d (fd=%d%s)", 1242 1240 reader[client[cs_idx].ridx].device, reader[client[cs_idx].ridx].r_port, 1243 ( client[cs_idx].ncd_proto==NCD_525)?5:4, client[cs_idx].udp_fd, ptxt);1241 (reader[client[cs_idx].ridx].ncd_proto==NCD_525)?5:4, client[cs_idx].udp_fd, ptxt); 1244 1242 1245 1243 return(0);
Note:
See TracChangeset
for help on using the changeset viewer.