| 45 | } |
| 46 | |
| 47 | void send_message(PeerId peer, MessageType type, const char* text, int size) |
| 48 | { |
| 49 | if (size > 255) { |
| 50 | return; |
| 51 | } |
| 52 | uint8_t buff[MAX_MESSAGE_SIZE]; |
| 53 | |
| 54 | buff[0] = (uint8_t)type; |
| 55 | buff[1] = (uint8_t)size; |
| 56 | if (size > 0) { |
| 57 | memcpy(buff + 2, text, size); |
| 58 | } |
| 59 | humblenet_p2p_sendto(buff, size + 2, peer, SEND_RELIABLE, CHANNEL); |
| 60 | } |
| 61 | |
| 62 | void process_message(PeerId remotePeer, const uint8_t* buffer, int buffer_size, int message_size) |
| 63 | { |
no outgoing calls
no test coverage detected