summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorRemi Denis-Courmont2008-09-23 05:05:19 +0200
committerDavid S. Miller2008-09-23 05:05:19 +0200
commitba113a94b7503ee23ffe819e7045134b0c1d31de (patch)
treeb6236bbb36ffa311d7bc952066d2adc2b00c8d0c /include
parentPhonet: Netlink interface (diff)
downloadkernel-qcow2-linux-ba113a94b7503ee23ffe819e7045134b0c1d31de.tar.gz
kernel-qcow2-linux-ba113a94b7503ee23ffe819e7045134b0c1d31de.tar.xz
kernel-qcow2-linux-ba113a94b7503ee23ffe819e7045134b0c1d31de.zip
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>
Diffstat (limited to 'include')
-rw-r--r--include/linux/phonet.h3
-rw-r--r--include/net/phonet/phonet.h23
2 files changed, 26 insertions, 0 deletions
diff --git a/include/linux/phonet.h b/include/linux/phonet.h
index 6a764f8584a4..001c0e679099 100644
--- a/include/linux/phonet.h
+++ b/include/linux/phonet.h
@@ -32,6 +32,9 @@
#define PNADDR_ANY 0
#define PNPORT_RESOURCE_ROUTING 0
+/* ioctls */
+#define SIOCPNGETOBJECT (SIOCPROTOPRIVATE + 0)
+
/* Phonet protocol header */
struct phonethdr {
__u8 pn_rdev;
diff --git a/include/net/phonet/phonet.h b/include/net/phonet/phonet.h
index 8b777943d201..2ae5cbb59b60 100644
--- a/include/net/phonet/phonet.h
+++ b/include/net/phonet/phonet.h
@@ -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;
};