* pops an integer value from the current position in the buffer * @info: pointer to store the result * * @return: * 0 (success): info retrieved * 1 (success): nothing returned, all data has been consumed! * < 0: error */
| 371 | * < 0: error |
| 372 | */ |
| 373 | int bin_pop_int(bin_packet_t *packet, void *info) |
| 374 | { |
| 375 | if (packet->front_pointer - packet->buffer.s == packet->buffer.len) |
| 376 | return 1; |
| 377 | |
| 378 | if (packet->front_pointer - packet->buffer.s + sizeof(int) > packet->buffer.len) { |
| 379 | LM_ERR("Receive binary packet buffer overflow\n"); |
| 380 | return -1; |
| 381 | } |
| 382 | |
| 383 | memcpy(info, packet->front_pointer, sizeof(int)); |
| 384 | packet->front_pointer += sizeof(int); |
| 385 | |
| 386 | return 0; |
| 387 | } |
| 388 | |
| 389 | /* |
| 390 | * pops an integer value from the end of the packet |
no outgoing calls
no test coverage detected