Skip to content

Instantly share code, notes, and snippets.

@AlexsJones
Last active August 29, 2015 13:57
Show Gist options
  • Save AlexsJones/9462395 to your computer and use it in GitHub Desktop.
Save AlexsJones/9462395 to your computer and use it in GitHub Desktop.
#ifndef __CONNECTION_CONTROL_H__
#define __CONNECTION_CONTROL_H__
typedef enum cstate { PRECONNECTION, HANDSHAKING, ENCRYPTING, DECRYPTING, SENDING };
typedef struct connection_state {
raw_peer *local; //raw peer will contain an RSA keypair
raw_peer *foreign; //foreign peer will contain half an RSA keypair
char *shared_secret;
cstate state;
} connection_state;
connection_state* connectioncontrol_setup(connection_state *cs);
void connectioncontrol_stop(connection_state *cs);
void connectioncontrol_start(raw_peer *cA,raw_peer *cB);
int connectioncontrol_isconnected(connection_state *cs);
int connectioncontrol_secure_message(connection_state *cs,char *msg);
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment