aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp/feat.c
diff options
context:
space:
mode:
authorGerrit Renker <gerrit@erg.abdn.ac.uk>2008-09-04 01:30:19 -0400
committerGerrit Renker <gerrit@erg.abdn.ac.uk>2008-09-04 01:45:27 -0400
commitd4c8741c431e07cfc66eb2b4c3a17b8d4975d9c0 (patch)
treef7639e6ffb4ca9c71c60df14733a78341453e65e /net/dccp/feat.c
parent093e1f46cf162913d05e1d4eeb01baa3e297b683 (diff)
dccp: Mechanism to resolve CCID dependencies
This adds a hook to resolve features whose value depends on the choice of CCID. It is done at the server since it can only be done after the CCID values have been negotiated; i.e. the client will add its CCID preference list on the Change options sent in the Request, which will be reconciled with the local preference list of the server. The concept is documented on http://www.erg.abdn.ac.uk/users/gerrit/dccp/notes/feature_negotiation/\ implementation_notes.html#ccid_dependencies Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk> Acked-by: Ian McDonald <ian.mcdonald@jandi.co.nz>
Diffstat (limited to 'net/dccp/feat.c')
-rw-r--r--net/dccp/feat.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/net/dccp/feat.c b/net/dccp/feat.c
index ed9f50b1c34a..6852960bb0a9 100644
--- a/net/dccp/feat.c
+++ b/net/dccp/feat.c
@@ -601,6 +601,31 @@ int dccp_feat_finalise_settings(struct dccp_sock *dp)
601 return 0; 601 return 0;
602} 602}
603 603
604/**
605 * dccp_feat_server_ccid_dependencies - Resolve CCID-dependent features
606 * It is the server which resolves the dependencies once the CCID has been
607 * fully negotiated. If no CCID has been negotiated, it uses the default CCID.
608 */
609int dccp_feat_server_ccid_dependencies(struct dccp_request_sock *dreq)
610{
611 struct list_head *fn = &dreq->dreq_featneg;
612 struct dccp_feat_entry *entry;
613 u8 is_local, ccid;
614
615 for (is_local = 0; is_local <= 1; is_local++) {
616 entry = dccp_feat_list_lookup(fn, DCCPF_CCID, is_local);
617
618 if (entry != NULL && !entry->empty_confirm)
619 ccid = entry->val.sp.vec[0];
620 else
621 ccid = dccp_feat_default_value(DCCPF_CCID);
622
623 if (dccp_feat_propagate_ccid(fn, ccid, is_local))
624 return -1;
625 }
626 return 0;
627}
628
604static int dccp_feat_update_ccid(struct sock *sk, u8 type, u8 new_ccid_nr) 629static int dccp_feat_update_ccid(struct sock *sk, u8 type, u8 new_ccid_nr)
605{ 630{
606 struct dccp_sock *dp = dccp_sk(sk); 631 struct dccp_sock *dp = dccp_sk(sk);