Back to the Résumé
#ifndef __P2P_PUBLIC_H
#define __P2P_PUBLIC_H
/* a 32-bit value for key/block crypto */
typedef unsigned int crypt_t;
/* p2p_init - initialize peer-to-peer networking library
*
* argument 1: an encryption key to be used on outgoing and incoming
* p2p library packets. This key must be the same on all
* p2p instances that wish to communicate. If 0 is passed,
* no encryption will occur.
*
* Returns 0 on success, -1 on error.
*/
extern int p2p_init(crypt_t);
/* p2p_send - function to send datagrams to remote p2p library
*
* argument 1: destination name/address - may be broadcast addr
* argument 2: piece of data to send
* argument 3: length of argument 2 in bytes
*
* Returns 0 on success, -1 on error.
*/
extern int p2p_send(char *, char *, size_t);
/* p2p_recv_handler - user defined function to handle incoming datagrams.
*
* This is callback function parented by the process that initializes
* the p2p library via p2p_init(). For each incoming datagram, this
* function will be called with the contents of the datagram as argument.
*
* argument 1: the contents of the received datagram
* argument 2: size of argument 1
* argument 3: sockaddr_in structure describing the sender
* argument 4: size of argument 3
*
* Return value is user defined.
*/
int p2p_recv_handler(void *, size_t, struct sockaddr_in *, socklen_t);
/* p2p_stop - shutdown p2p networking library. */
extern void p2p_stop(void);
#endif /* __P2P_PUBLIC_H */
Back to the Résumé