pex.h 777 B

1234567891011121314151617181920212223242526272829
  1. #pragma once
  2. #include <stdint.h>
  3. #include <stdio.h>
  4. typedef struct pex_packet {
  5. uintptr_t source;
  6. size_t size;
  7. uint8_t data[];
  8. } pex_packet_t;
  9. #define MAX_PACKET_SIZE 1024
  10. #define PACKET_SIZE (sizeof(pex_packet_t) + MAX_PACKET_SIZE)
  11. typedef struct pex_header {
  12. uintptr_t target;
  13. uint8_t data[];
  14. } pex_header_t;
  15. extern size_t pex_send(FILE * sock, unsigned int rcpt, size_t size, char * blob);
  16. extern size_t pex_broadcast(FILE * sock, size_t size, char * blob);
  17. extern size_t pex_listen(FILE * sock, pex_packet_t * packet);
  18. extern size_t pex_reply(FILE * sock, size_t size, char * blob);
  19. extern size_t pex_recv(FILE * sock, char * blob);
  20. extern size_t pex_query(FILE * sock);
  21. extern FILE * pex_bind(char * target);
  22. extern FILE * pex_connect(char * target);