Phonet: common socket glue

This provides the socket API for the Phonet protocols family.

Signed-off-by: Remi Denis-Courmont <remi.denis-courmont@nokia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Remi Denis-Courmont
2008-09-22 20:05:19 -07:00
committed by David S. Miller
parent 8fb397406f
commit ba113a94b7
5 changed files with 363 additions and 3 deletions

View File

@@ -29,6 +29,28 @@
*/
#define MAX_PHONET_HEADER 8
/*
* Every Phonet* socket has this structure first in its
* protocol-specific structure under name c.
*/
struct pn_sock {
struct sock sk;
u16 sobject;
u8 resource;
};
static inline struct pn_sock *pn_sk(struct sock *sk)
{
return (struct pn_sock *)sk;
}
extern const struct proto_ops phonet_dgram_ops;
struct sock *pn_find_sock_by_sa(const struct sockaddr_pn *sa);
void pn_sock_hash(struct sock *sk);
void pn_sock_unhash(struct sock *sk);
int pn_sock_get_port(struct sock *sk, unsigned short sport);
static inline struct phonethdr *pn_hdr(struct sk_buff *skb)
{
return (struct phonethdr *)skb_network_header(skb);
@@ -64,6 +86,7 @@ void pn_skb_get_dst_sockaddr(struct sk_buff *skb, struct sockaddr_pn *sa)
/* Protocols in Phonet protocol family. */
struct phonet_protocol {
const struct proto_ops *ops;
struct proto *prot;
int sock_type;
};