Add rxgk_token.c
[openafs.git] / src / rxgk / rxgk_client.c
1 /* rxgk/rxgk_client.c - Client-only security object routines */
2 /*
3  * Copyright (C) 2013, 2014 by the Massachusetts Institute of Technology.
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  *
10  * * Redistributions of source code must retain the above copyright
11  *   notice, this list of conditions and the following disclaimer.
12  *
13  * * Redistributions in binary form must reproduce the above copyright
14  *   notice, this list of conditions and the following disclaimer in
15  *   the documentation and/or other materials provided with the
16  *   distribution.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
23  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29  * OF THE POSSIBILITY OF SUCH DAMAGE.
30  */
31
32 /*
33  * Client-only security object routines.
34  */
35
36 #include <afsconfig.h>
37 #include <afs/param.h>
38 #include <afs/stds.h>
39
40 /* OS-specific system headers go here */
41
42 #include <rx/rx.h>
43 #include <rx/rx_packet.h>
44 #include <rx/rxgk.h>
45
46 #include "rxgk_private.h"
47
48 /* Pre-declare the securityclass routines for the securityOps definition. */
49 static int rxgk_ClientClose(struct rx_securityClass *aobj);
50 static int rxgk_NewClientConnection(struct rx_securityClass *aobj,
51                                     struct rx_connection *aconn);
52 static int rxgk_ClientPreparePacket(struct rx_securityClass *aobj,
53                                     struct rx_call *acall,
54                                     struct rx_packet *apacket);
55 static int rxgk_GetResponse(struct rx_securityClass *aobj,
56                             struct rx_connection *aconn,
57                             struct rx_packet *apacket);
58 static int rxgk_ClientCheckPacket(struct rx_securityClass *aobj,
59                                   struct rx_call *acall,
60                                   struct rx_packet *apacket);
61 static int rxgk_DestroyClientConnection(struct rx_securityClass *aobj,
62                                         struct rx_connection *aconn);
63 static int rxgk_ClientGetStats(struct rx_securityClass *aobj,
64                                struct rx_connection *aconn,
65                                struct rx_securityObjectStats *astats);
66
67 static struct rx_securityOps rxgk_client_ops = {
68     rxgk_ClientClose,
69     rxgk_NewClientConnection,           /* every new connection */
70     rxgk_ClientPreparePacket,           /* once per packet creation */
71     0,                                  /* send packet (once per retrans) */
72     0,
73     0,
74     0,
75     rxgk_GetResponse,                   /* respond to challenge packet */
76     0,
77     rxgk_ClientCheckPacket,             /* check data packet */
78     rxgk_DestroyClientConnection,
79     rxgk_ClientGetStats,
80     0,
81     0,
82     0,
83 };
84
85 static struct rx_securityClass dummySC = {
86     &rxgk_client_ops,
87     NULL,
88     0
89 };
90
91 struct rx_securityClass *
92 rxgk_NewClientSecurityObject(RXGK_Level level, afs_int32 enctype, rxgk_key k0,
93                              RXGK_Data *token, afsUUID *uuid)
94 {
95     return &dummySC;
96 }
97
98 static int
99 rxgk_ClientClose(struct rx_securityClass *aobj)
100 {
101     return RXGK_INCONSISTENCY;
102 }
103
104 static int
105 rxgk_NewClientConnection(struct rx_securityClass *aobj,
106                          struct rx_connection *aconn)
107 {
108     return RXGK_INCONSISTENCY;
109 }
110
111 static int
112 rxgk_ClientPreparePacket(struct rx_securityClass *aobj, struct rx_call *acall,
113                          struct rx_packet *apacket)
114 {
115     return RXGK_INCONSISTENCY;
116 }
117
118 static int
119 rxgk_GetResponse(struct rx_securityClass *aobj, struct rx_connection *aconn,
120                  struct rx_packet *apacket)
121 {
122     return RXGK_INCONSISTENCY;
123 }
124
125 static int
126 rxgk_ClientCheckPacket(struct rx_securityClass *aobj, struct rx_call *acall,
127                        struct rx_packet *apacket)
128 {
129     return RXGK_INCONSISTENCY;
130 }
131
132 static int
133 rxgk_DestroyClientConnection(struct rx_securityClass *aobj,
134                              struct rx_connection *aconn)
135 {
136     return RXGK_INCONSISTENCY;
137 }
138
139 static int
140 rxgk_ClientGetStats(struct rx_securityClass *aobj, struct rx_connection *aconn,
141                     struct rx_securityObjectStats *astats)
142 {
143     return RXGK_INCONSISTENCY;
144 }