diff options
| author | Jon Grimm <jgrimm@touki.austin.ibm.com> | 2003-02-24 03:56:02 -0600 |
|---|---|---|
| committer | Jon Grimm <jgrimm@touki.austin.ibm.com> | 2003-02-24 03:56:02 -0600 |
| commit | 1402a73c6615ff2d0419401764086bb8214c0540 (patch) | |
| tree | b97f9082702e2a37557b0deebe85fbf14bd2fc94 /include/net | |
| parent | 294cb923593ab08df3fbec89bbe57662c1791e7e (diff) | |
[SCTP] Add SCTP_SET_PEER_PRIMARY get/setsockopt.
Also, rename all sctp_protocol_t -> struct sctp_protocol.
Non-UDP-style SCTP sockets should ignore associd fields, so added
this function into sctp_id2assoc() in anticipation of Sridhar's
TCP-style work.
Diffstat (limited to 'include/net')
| -rw-r--r-- | include/net/sctp/sctp.h | 34 | ||||
| -rw-r--r-- | include/net/sctp/structs.h | 25 |
2 files changed, 22 insertions, 37 deletions
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h index b2e19ebde563..bf8aaa165bd9 100644 --- a/include/net/sctp/sctp.h +++ b/include/net/sctp/sctp.h @@ -121,9 +121,10 @@ /* * sctp_protocol.c */ -extern sctp_protocol_t sctp_proto; +extern struct sctp_protocol sctp_proto; extern struct sock *sctp_get_ctl_sock(void); -extern int sctp_copy_local_addr_list(sctp_protocol_t *, sctp_bind_addr_t *, +extern int sctp_copy_local_addr_list(struct sctp_protocol *, + struct sctp_bind_addr *, sctp_scope_t, int priority, int flags); extern struct sctp_pf *sctp_get_pf_specific(sa_family_t family); extern int sctp_register_pf(struct sctp_pf *, sa_family_t); @@ -348,25 +349,10 @@ static inline sctp_assoc_t sctp_assoc2id(const sctp_association_t *asoc) return (sctp_assoc_t) asoc; } + /* Look up the association by its id. */ -static inline sctp_association_t *sctp_id2assoc(const struct sock *sk, sctp_assoc_t id) -{ - sctp_association_t *asoc = NULL; - - /* First, verify that this is a kernel address. */ - if (sctp_is_valid_kaddr((unsigned long) id)) { - sctp_association_t *temp = (sctp_association_t *) id; - - /* Verify that this _is_ an sctp_association_t - * data structure and if so, that the socket matches. - */ - if ((SCTP_ASSOC_EYECATCHER == temp->eyecatcher) && - (temp->base.sk == sk)) - asoc = temp; - } +sctp_association_t *sctp_id2assoc(struct sock *sk, sctp_assoc_t id); - return asoc; -} /* A macro to walk a list of skbs. */ #define sctp_skb_for_each(pos, head, tmp) \ @@ -494,7 +480,7 @@ extern void sctp_put_port(struct sock *sk); /* Static inline functions. */ /* Return the SCTP protocol structure. */ -static inline sctp_protocol_t *sctp_get_protocol(void) +static inline struct sctp_protocol *sctp_get_protocol(void) { return &sctp_proto; } @@ -523,21 +509,21 @@ static inline int ipver2af(__u8 ipver) /* This is the hash function for the SCTP port hash table. */ static inline int sctp_phashfn(__u16 lport) { - sctp_protocol_t *sctp_proto = sctp_get_protocol(); + struct sctp_protocol *sctp_proto = sctp_get_protocol(); return (lport & (sctp_proto->port_hashsize - 1)); } /* This is the hash function for the endpoint hash table. */ static inline int sctp_ep_hashfn(__u16 lport) { - sctp_protocol_t *sctp_proto = sctp_get_protocol(); + struct sctp_protocol *sctp_proto = sctp_get_protocol(); return (lport & (sctp_proto->ep_hashsize - 1)); } /* This is the hash function for the association hash table. */ static inline int sctp_assoc_hashfn(__u16 lport, __u16 rport) { - sctp_protocol_t *sctp_proto = sctp_get_protocol(); + struct sctp_protocol *sctp_proto = sctp_get_protocol(); int h = (lport << 16) + rport; h ^= h>>8; return (h & (sctp_proto->assoc_hashsize - 1)); @@ -549,7 +535,7 @@ static inline int sctp_assoc_hashfn(__u16 lport, __u16 rport) */ static inline int sctp_vtag_hashfn(__u16 lport, __u16 rport, __u32 vtag) { - sctp_protocol_t *sctp_proto = sctp_get_protocol(); + struct sctp_protocol *sctp_proto = sctp_get_protocol(); int h = (lport << 16) + rport; h ^= vtag; return (h & (sctp_proto->assoc_hashsize-1)); diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index d136122af892..2cc13c137a18 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h @@ -118,7 +118,6 @@ struct sctp_opt; struct sctp_endpoint_common; struct sctp_ssnmap; -typedef struct sctp_protocol sctp_protocol_t; typedef struct sctp_endpoint sctp_endpoint_t; typedef struct sctp_association sctp_association_t; typedef struct sctp_packet sctp_packet_t; @@ -254,7 +253,7 @@ struct sctp_af { void (*get_saddr) (struct sctp_association *asoc, struct dst_entry *dst, union sctp_addr *daddr, - union sctp_addr *saddr); + union sctp_addr *saddr); void (*copy_addrlist) (struct list_head *, struct net_device *); void (*dst_saddr) (union sctp_addr *saddr, @@ -1130,8 +1129,9 @@ static inline sctp_endpoint_t *sctp_ep(sctp_endpoint_common_t *base) } /* These are function signatures for manipulating endpoints. */ -sctp_endpoint_t *sctp_endpoint_new(sctp_protocol_t *, struct sock *, int); -sctp_endpoint_t *sctp_endpoint_init(sctp_endpoint_t *, sctp_protocol_t *, +sctp_endpoint_t *sctp_endpoint_new(struct sctp_protocol *, struct sock *, int); +sctp_endpoint_t *sctp_endpoint_init(struct sctp_endpoint *, + struct sctp_protocol *, struct sock *, int priority); void sctp_endpoint_free(sctp_endpoint_t *); void sctp_endpoint_put(sctp_endpoint_t *); @@ -1143,7 +1143,6 @@ sctp_association_t *sctp_endpoint_lookup_assoc(const sctp_endpoint_t *ep, int sctp_endpoint_is_peeled_off(sctp_endpoint_t *, const union sctp_addr *); sctp_endpoint_t *sctp_endpoint_is_match(sctp_endpoint_t *, const union sctp_addr *); - int sctp_has_association(const union sctp_addr *laddr, const union sctp_addr *paddr); @@ -1619,7 +1618,7 @@ struct sctp_transport *sctp_assoc_lookup_paddr(const sctp_association_t *, struct sctp_transport *sctp_assoc_add_peer(sctp_association_t *, const union sctp_addr *address, const int priority); -void sctp_assoc_control_transport(sctp_association_t *, +void sctp_assoc_control_transport(struct sctp_association *, struct sctp_transport *, sctp_transport_cmd_t, sctp_sn_error_t); struct sctp_transport *sctp_assoc_lookup_tsn(sctp_association_t *, __u32); @@ -1629,14 +1628,14 @@ struct sctp_transport *sctp_assoc_is_match(sctp_association_t *, void sctp_assoc_migrate(sctp_association_t *, struct sock *); void sctp_assoc_update(sctp_association_t *dst, sctp_association_t *src); -__u32 __sctp_association_get_next_tsn(sctp_association_t *); -__u32 __sctp_association_get_tsn_block(sctp_association_t *, int); -__u16 __sctp_association_get_next_ssn(sctp_association_t *, __u16 sid); - -void sctp_assoc_sync_pmtu(sctp_association_t *); -void sctp_assoc_rwnd_increase(sctp_association_t *, int); -void sctp_assoc_rwnd_decrease(sctp_association_t *, int); +__u32 sctp_association_get_next_tsn(struct sctp_association *); +__u32 sctp_association_get_tsn_block(struct sctp_association *, int); +void sctp_assoc_sync_pmtu(struct sctp_association *); +void sctp_assoc_rwnd_increase(struct sctp_association *, int); +void sctp_assoc_rwnd_decrease(struct sctp_association *, int); +void sctp_assoc_set_primary(struct sctp_association *, + struct sctp_transport *); int sctp_assoc_set_bind_addr_from_ep(sctp_association_t *, int); int sctp_assoc_set_bind_addr_from_cookie(sctp_association_t *, sctp_cookie_t *, int); |
