Commit 0de902286156e4b44c04f39dfe6bbc731dea0455
1 parent
e3ca74d8
allow variable arguments for response and request generation
Showing
2 changed files
with
18 additions
and
8 deletions
... | ... | @@ -32,8 +32,8 @@ |
32 | 32 | #include "tr/proto_message.h" |
33 | 33 | |
34 | 34 | typedef TR_ProtoMessage (* fptr_TR_protoCreateMessage)(void *); |
35 | -typedef TR_ProtoMessage (* fptr_TR_protoCreateRequest)(void *); | |
36 | -typedef TR_ProtoMessage (* fptr_TR_protoCreateResponse)(void *); | |
35 | +typedef TR_ProtoMessage (* fptr_TR_protoCreateRequest)(void *, va_list *); | |
36 | +typedef TR_ProtoMessage (* fptr_TR_protoCreateResponse)(void *, va_list *); | |
37 | 37 | typedef TR_RemoteData (* fptr_TR_protoCompose)(void *, TR_ProtoMessage); |
38 | 38 | typedef size_t (* fptr_TR_protoParse)(void *, TR_ProtoMessage, TR_RemoteData); |
39 | 39 | |
... | ... | @@ -47,8 +47,8 @@ TR_INTERFACE(TR_Protocol) { |
47 | 47 | }; |
48 | 48 | |
49 | 49 | TR_ProtoMessage TR_protoCreateMessage(void *, TR_Socket); |
50 | -TR_ProtoMessage TR_protoCreateRequest(void *, TR_Socket); | |
51 | -TR_ProtoMessage TR_protoCreateResponse(void *, TR_Socket); | |
50 | +TR_ProtoMessage TR_protoCreateRequest(void *, TR_Socket, ...); | |
51 | +TR_ProtoMessage TR_protoCreateResponse(void *, TR_Socket, ...); | |
52 | 52 | size_t TR_protoParse(void *, TR_ProtoMessage, TR_RemoteData); |
53 | 53 | TR_RemoteData TR_protoCompose(void *, TR_ProtoMessage); |
54 | 54 | ... | ... |
... | ... | @@ -42,24 +42,34 @@ TR_protoCreateMessage(void * _this, TR_Socket remote) |
42 | 42 | } |
43 | 43 | |
44 | 44 | TR_ProtoMessage |
45 | -TR_protoCreateRequest(void * _this, TR_Socket remote) | |
45 | +TR_protoCreateRequest(void * _this, TR_Socket remote, ...) | |
46 | 46 | { |
47 | 47 | TR_ProtoMessage callret; |
48 | - TR_RETCALL(_this, TR_Protocol, createRequest, callret); | |
48 | + va_list params; | |
49 | + | |
50 | + va_start(params, remote); | |
51 | + TR_RETCALL(_this, TR_Protocol, createRequest, callret, params); | |
49 | 52 | if (callret != NULL) { |
50 | 53 | callret->remote = remote; |
51 | 54 | } |
55 | + va_end(params); | |
56 | + | |
52 | 57 | return callret; |
53 | 58 | } |
54 | 59 | |
55 | 60 | TR_ProtoMessage |
56 | -TR_protoCreateResponse(void * _this, TR_Socket remote) | |
61 | +TR_protoCreateResponse(void * _this, TR_Socket remote, ...) | |
57 | 62 | { |
58 | 63 | TR_ProtoMessage callret; |
59 | - TR_RETCALL(_this, TR_Protocol, createResponse, callret); | |
64 | + va_list params; | |
65 | + | |
66 | + va_start(params, remote); | |
67 | + TR_RETCALL(_this, TR_Protocol, createResponse, callret, params); | |
60 | 68 | if (callret != NULL) { |
61 | 69 | callret->remote = remote; |
62 | 70 | } |
71 | + va_end(params); | |
72 | + | |
63 | 73 | return callret; |
64 | 74 | } |
65 | 75 | ... | ... |
Please
register
or
login
to post a comment