1
// Much of the reload protocol should be hidden from app level users of the
2
// transaction layer. Methods are opqaue to the tranport layer, but a certain
3
// amount of interaction will be required.
4
// 1. A mechanism to correleate requests and responses
5
// 2. Enough information to populate a Via list
6
// It is unclear how much more information should be required by the transaction
10
//this approach exposes a limited message concept which will contrcut transation
11
//ids...similar to how resip populates a tid when a via header is
12
//created. Subclasses(store_q, fetch_q, etc) will infer a destination list whenever possible.
13
//Dignature operations are hidden; signature check methods are expsoed where
16
class MessageFactory() // some sort sort of factory sigleton for pasing data from the
17
// wire and forming a new message of the correc type
18
// (like FetchReq for example)
21
static ReloadMeassage* parseData( Data msg );
24
// Show me what the elements of a DestinationList look like given they are a
30
DestinationList destinationList();
31
ViaList viaList(); //is this useful or just diagnostic? (CJ - have to use it )
32
TransactionId transactionId(); //populated at const. time(for requests)
33
MessageContents contents();
34
virtual Data encode();
39
//note that signature is not exposed
43
virtual u_int16 messageCode() const=0; //should we req. subclassing?
44
virtual Data payload();
48
// needs classes simular to this for all the message types
49
class FetchReq : public Message // Should we derive off Message or
50
// MEssageContents ????
54
class FetchAns : public Message
59
//base class for MessageContents which can hint at routing?
60
//shared ptr. for poly. list? Ownership should be clear.
61
class StoreReq : public MessageContents
64
typedef std::list<StoreKindData*> StoreList();
65
ResourceID resource();
66
StoreList storeList();
73
Generation generation();
79
/* Basic operation--2 phase
82
call reloadTrans->makeRequest(StoreQ);
83
custom modification if necessary, store tid
84
call reloadTrans->send(req)
88
Sepcifying a per-operation/per-kind sink will avoid unecessary demux cod ein the
100
void dhtSipRegister()
103
ReloadTransaction reloadTrans;
104
StoreQ s = reloadTrans->makeStoreQ(unhashedId, kind);
105
//install payload into s
106
//per-request handler model
107
reloadTrans->send(s, handler);
114
void onSuccess(StoreQResponse);
118
// Each peer in th dht is providing a service to store data; there are light
119
// validation rules, but it seems that the data can be treated as opaque. The
120
// main issue is that the kind-id must be supported. I'm not sure if generation
121
// calcuations should involve the app at all.
123
//one of these is installed for each kind/dm supported. There will be a subclass
124
//for each DM. We can use static_cast for the calls or do templates w/ no
125
//subclassing. Signature checking is done by the sig. service and hidden from
131
class ValidateDictionary : public ValidateCRUD
133
typedef vector<pair<Data, DictEntry>> Dictionary;
135
bool isValid(const Resourse& r, const Dictionary& d, Generation gen);
138
// storage services are also installed onse per kind/DM
144
class DictionaryService
146
Generation update(const Resourse& r, const Dictionary& d);
147
//not sure about generation here....
148
Generation delete(const Resourse& r);
155
map<KindId, Validate>;
167
//under the hood mechanisms that need to be fleshed out
168
// signature validation/signing service
170
/* How do we wire this into resip?
172
- Fetch-Q for location mapped into 3263 style dns lookup
173
- transactionState will convey that this is dht to the transportSelector
174
- TS will try various alternatives