| 282 | char *next_data_chunk; |
| 283 | |
| 284 | int cl_sync_chunk_iter(bin_packet_t *packet) |
| 285 | { |
| 286 | str bin_buffer; |
| 287 | int next_chunk_sz, start_marker; |
| 288 | int rc; |
| 289 | |
| 290 | if (!packet) { |
| 291 | LM_ERR("No sync packet\n"); |
| 292 | return 0; |
| 293 | } |
| 294 | |
| 295 | if (next_data_chunk) { |
| 296 | bin_get_buffer(packet, &bin_buffer); |
| 297 | if (next_data_chunk < bin_buffer.s || |
| 298 | next_data_chunk >= bin_buffer.s + bin_buffer.len) { |
| 299 | next_data_chunk = NULL; /* no more chunks */ |
| 300 | return 0; |
| 301 | } |
| 302 | |
| 303 | packet->front_pointer = next_data_chunk; |
| 304 | } |
| 305 | |
| 306 | rc = bin_pop_int(packet, &next_chunk_sz); |
| 307 | if (rc < 0) { |
| 308 | LM_ERR("error retrieving next sync chunk size\n"); |
| 309 | return 0; |
| 310 | } else if (rc > 0) { |
| 311 | /* no more chunks in this packet */ |
| 312 | return 0; |
| 313 | } |
| 314 | |
| 315 | rc = bin_pop_int(packet, &start_marker); |
| 316 | if (rc < 0) { |
| 317 | LM_ERR("Error retrieving sync chunk start marker\n"); |
| 318 | return 0; |
| 319 | } else if (rc > 0) { |
| 320 | LM_ERR("no more data: failed to read sync chunk start marker\n"); |
| 321 | return 0; |
| 322 | } else if (start_marker != SYNC_CHUNK_START_MARKER) { |
| 323 | LM_ERR("Bad sync chunk start marker\n"); |
| 324 | return 0; |
| 325 | } |
| 326 | |
| 327 | no_sync_chunks_iter++; |
| 328 | |
| 329 | next_data_chunk = packet->front_pointer + next_chunk_sz; |
| 330 | return 1; |
| 331 | } |
| 332 | |
| 333 | void send_sync_repl(int sender, void *param) |
| 334 | { |
nothing calls this directly
no test coverage detected