1 /*
2  * Copyright (C) 2003-2015 FreeIPMI Core Team
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16  *
17  */
18 
19 #ifndef IPMI_LAN_SESSION_COMMON_H
20 #define IPMI_LAN_SESSION_COMMON_H
21 
22 #include <stdint.h>
23 #include <freeipmi/api/ipmi-api.h>
24 #include <freeipmi/fiid/fiid.h>
25 
26 #define IPMI_INTERNAL_WORKAROUND_FLAGS_GET_SESSION_CHALLENGE         0x00000001
27 #define IPMI_INTERNAL_WORKAROUND_FLAGS_CHECK_UNEXPECTED_AUTHCODE     0x00000002
28 #define IPMI_INTERNAL_WORKAROUND_FLAGS_CLOSE_SESSION_SKIP_RETRANSMIT 0x00000004
29 
30 void api_lan_cmd_get_session_parameters (ipmi_ctx_t ctx,
31                                          uint8_t *authentication_type,
32                                          unsigned int *internal_workaround_flags);
33 
34 void api_lan_2_0_cmd_get_session_parameters (ipmi_ctx_t ctx,
35                                              uint8_t *payload_authenticated,
36                                              uint8_t *payload_encrypted);
37 
38 int api_lan_cmd_wrapper (ipmi_ctx_t ctx,
39                          unsigned int internal_workaround_flags,
40                          uint8_t lun,
41                          uint8_t net_fn,
42                          uint8_t authentication_type,
43                          int check_authentication_code,
44                          uint32_t *session_sequence_number,
45                          uint32_t session_id,
46                          uint8_t *rq_seq,
47                          const char *password,
48                          unsigned int password_len,
49                          fiid_obj_t obj_cmd_rq,
50                          fiid_obj_t obj_cmd_rs);
51 
52 int api_lan_cmd_wrapper_ipmb (ipmi_ctx_t ctx,
53                               fiid_obj_t obj_cmd_rq,
54                               fiid_obj_t obj_cmd_rs);
55 
56 int api_lan_open_session (ipmi_ctx_t ctx);
57 
58 int api_lan_close_session (ipmi_ctx_t ctx);
59 
60 int api_lan_2_0_cmd_wrapper (ipmi_ctx_t ctx,
61                              unsigned int internal_workaround_flags,
62                              uint8_t lun,
63                              uint8_t net_fn,
64                              uint8_t payload_type,
65                              uint8_t payload_authenticated,
66                              uint8_t payload_encrypted,
67                              uint8_t *message_tag,
68                              uint32_t *session_sequence_number,
69                              uint32_t session_id,
70                              uint8_t *rq_seq,
71                              uint8_t authentication_algorithm,
72                              uint8_t integrity_algorithm,
73                              uint8_t confidentiality_algorithm,
74                              const void *integrity_key,
75                              unsigned int integrity_key_len,
76                              const void *confidentiality_key,
77                              unsigned int confidentiality_key_len,
78                              const char *password,
79                              unsigned int password_len,
80                              fiid_obj_t obj_cmd_rq,
81                              fiid_obj_t obj_cmd_rs);
82 
83 int api_lan_2_0_cmd_wrapper_ipmb (ipmi_ctx_t ctx,
84                                   fiid_obj_t obj_cmd_rq,
85                                   fiid_obj_t obj_cmd_rs);
86 
87 int api_lan_2_0_open_session (ipmi_ctx_t ctx);
88 
89 int api_lan_2_0_close_session (ipmi_ctx_t ctx);
90 
91 #endif /* IPMI_LAN_SESSION_COMMON_H */
92