Add rxgk boilerplate
[openafs.git] / src / rxgk / rxgk_server.c
1 /* rxgk/rxgk_server.c - server-specific 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  * Server-specific security object routines.
34  */
35
36 #include <afsconfig.h>
37 #include <afs/param.h>
38 #include <afs/stds.h>
39
40 #include <afs/opr.h>
41 #include <rx/rx.h>
42 #include <rx/rx_packet.h>
43 #include <rx/rxgk.h>
44
45 #include "rxgk_private.h"
46
47 /* Pre-declare the securityclass routines for the securityOps definition. */
48 struct rx_securityClass *rxgk_NewServerSecurityObject(void *getkey_rock,
49                                                       rxgk_getkey_func getkey);
50 static int rxgk_ServerClose(struct rx_securityClass *aobj);
51 static int rxgk_NewServerConnection(struct rx_securityClass *aobj,
52                                     struct rx_connection *aconn);
53 static int rxgk_ServerPreparePacket(struct rx_securityClass *aobj,
54                                     struct rx_call *acall,
55                                     struct rx_packet *apacket);
56 static int rxgk_CheckAuthentication(struct rx_securityClass *aobj,
57                                     struct rx_connection *aconn);
58 static int rxgk_CreateChallenge(struct rx_securityClass *aobj,
59                                 struct rx_connection *aconn);
60 static int rxgk_GetChallenge(struct rx_securityClass *aobj,
61                              struct rx_connection *aconn,
62                              struct rx_packet *apacket);
63 static int rxgk_CheckResponse(struct rx_securityClass *aobj,
64                               struct rx_connection *aconn,
65                               struct rx_packet *apacket);
66 static int rxgk_ServerCheckPacket(struct rx_securityClass *aobj,
67                                   struct rx_call *acall, struct rx_packet *apacket);
68 static int rxgk_DestroyServerConnection(struct rx_securityClass *aobj,
69                                         struct rx_connection *aconn);
70 static int rxgk_ServerGetStats(struct rx_securityClass *aobj,
71                                struct rx_connection *aconn,
72                                struct rx_securityObjectStats *astats);
73
74
75 static struct rx_securityOps rxgk_server_ops = {
76     rxgk_ServerClose,
77     rxgk_NewServerConnection,
78     rxgk_ServerPreparePacket,           /* once per packet creation */
79     0,                                  /* send packet (once per retrans) */
80     rxgk_CheckAuthentication,
81     rxgk_CreateChallenge,
82     rxgk_GetChallenge,
83     0,
84     rxgk_CheckResponse,
85     rxgk_ServerCheckPacket,             /* check data packet */
86     rxgk_DestroyServerConnection,
87     rxgk_ServerGetStats,
88     0,
89     0,                          /* spare 1 */
90     0,                          /* spare 2 */
91 };
92
93 static struct rx_securityClass dummySC = {
94     &rxgk_server_ops,
95     NULL,
96     0
97 };
98
99 struct rx_securityClass *
100 rxgk_NewServerSecurityObject(void *getkey_rock, rxgk_getkey_func getkey)
101 {
102     return &dummySC;
103 }
104
105 static int
106 rxgk_ServerClose(struct rx_securityClass *aobj)
107 {
108     return RXGK_INCONSISTENCY;
109 }
110
111 static int
112 rxgk_NewServerConnection(struct rx_securityClass *aobj, struct rx_connection *aconn)
113 {
114     return RXGK_INCONSISTENCY;
115 }
116
117 static int
118 rxgk_ServerPreparePacket(struct rx_securityClass *aobj, struct rx_call *acall,
119                          struct rx_packet *apacket)
120 {
121     return RXGK_INCONSISTENCY;
122 }
123
124 static int
125 rxgk_CheckAuthentication(struct rx_securityClass *aobj,
126                          struct rx_connection *aconn)
127 {
128     return RXGK_INCONSISTENCY;
129 }
130
131 static int
132 rxgk_CreateChallenge(struct rx_securityClass *aobj,
133                      struct rx_connection *aconn)
134 {
135     return RXGK_INCONSISTENCY;
136 }
137
138 static int
139 rxgk_GetChallenge(struct rx_securityClass *aobj, struct rx_connection *aconn,
140                   struct rx_packet *apacket)
141 {
142     return RXGK_INCONSISTENCY;
143 }
144
145 static int
146 rxgk_CheckResponse(struct rx_securityClass *aobj,
147                    struct rx_connection *aconn, struct rx_packet *apacket)
148 {
149     return RXGK_INCONSISTENCY;
150 }
151
152 static int
153 rxgk_ServerCheckPacket(struct rx_securityClass *aobj, struct rx_call *acall,
154                        struct rx_packet *apacket)
155 {
156     return RXGK_INCONSISTENCY;
157 }
158
159 static int
160 rxgk_DestroyServerConnection(struct rx_securityClass *aobj,
161                              struct rx_connection *aconn)
162 {
163     return RXGK_INCONSISTENCY;
164 }
165
166 static int
167 rxgk_ServerGetStats(struct rx_securityClass *aobj, struct rx_connection *aconn,
168                     struct rx_securityObjectStats *astats)
169 {
170     return RXGK_INCONSISTENCY;
171 }