X-Git-Url: http://p2p-next.cs.pub.ro/gitweb/?a=blobdiff_plain;f=src%2Flibswift_udp%2Fserialize.h;fp=src%2Flibswift_udp%2Fserialize.h;h=cc10b4b7d035c900da397abb1520bb8980c03fb5;hb=46f3ca346fe499ba3e8f595fc5c2aa2b3e3c4d5f;hp=0000000000000000000000000000000000000000;hpb=d8da6fc1273a2acee935a15761b77a73424faef5;p=swifty.git diff --git a/src/libswift_udp/serialize.h b/src/libswift_udp/serialize.h new file mode 100644 index 0000000..cc10b4b --- /dev/null +++ b/src/libswift_udp/serialize.h @@ -0,0 +1,23 @@ +/* + * serialize.h + * + * Created by Arno Bakker + * Copyright 2010-2012 TECHNISCHE UNIVERSITEIT DELFT. All rights reserved. + * + */ + +#ifndef SWIFT_SERIALIZE_H_ +#define SWIFT_SERIALIZE_H_ + +#include + +#define fprintf_retiffail(...) { if (fprintf(__VA_ARGS__) < 0) { return -1; }} +#define fscanf_retiffail(...) { if (fscanf(__VA_ARGS__) == EOF) { return -1; }} + +class Serializable { + public: + virtual int serialize(FILE *fp) = 0; + virtual int deserialize(FILE *fp) = 0; +}; + +#endif /* SWIFT_SERIALIZE_H_ */