00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include "includes.h"
00022
00023 #undef DBGC_CLASS
00024 #define DBGC_CLASS DBGC_RPC_SRV
00025
00026 static BOOL api_eventlog_open_eventlog(pipes_struct *p)
00027 {
00028 EVENTLOG_Q_OPEN_EVENTLOG q_u;
00029 EVENTLOG_R_OPEN_EVENTLOG r_u;
00030 prs_struct *data = &p->in_data.data;
00031 prs_struct *rdata = &p->out_data.rdata;
00032
00033 ZERO_STRUCT(q_u);
00034 ZERO_STRUCT(r_u);
00035
00036 if (!(eventlog_io_q_open_eventlog("", &q_u, data, 0))) {
00037 DEBUG(0, ("eventlog_io_q_open_eventlog: unable to unmarshall EVENTLOG_Q_OPEN_EVENTLOG.\n"));
00038 return False;
00039 }
00040
00041 r_u.status = _eventlog_open_eventlog(p, &q_u, &r_u);
00042
00043 if (!(eventlog_io_r_open_eventlog("", &r_u, rdata, 0))) {
00044 DEBUG(0, ("eventlog_io_r_open_eventlog: unable to marshall EVENTLOG_R_OPEN_EVENTLOG.\n"));
00045 return False;
00046 }
00047
00048 return True;
00049 }
00050
00051 static BOOL api_eventlog_close_eventlog(pipes_struct *p)
00052 {
00053 EVENTLOG_Q_CLOSE_EVENTLOG q_u;
00054 EVENTLOG_R_CLOSE_EVENTLOG r_u;
00055 prs_struct *data = &p->in_data.data;
00056 prs_struct *rdata = &p->out_data.rdata;
00057
00058 ZERO_STRUCT(q_u);
00059 ZERO_STRUCT(r_u);
00060
00061 if (!(eventlog_io_q_close_eventlog("", &q_u, data, 0))) {
00062 DEBUG(0, ("eventlog_io_q_close_eventlog: unable to unmarshall EVENTLOG_Q_CLOSE_EVENTLOG.\n"));
00063 return False;
00064 }
00065
00066 r_u.status = _eventlog_close_eventlog(p, &q_u, &r_u);
00067
00068 if (!(eventlog_io_r_close_eventlog("", &r_u, rdata, 0))) {
00069 DEBUG(0, ("eventlog_io_r_close_eventlog: unable to marshall EVENTLOG_R_CLOSE_EVENTLOG.\n"));
00070 return False;
00071 }
00072
00073 return True;
00074 }
00075
00076 static BOOL api_eventlog_get_num_records(pipes_struct *p)
00077 {
00078 EVENTLOG_Q_GET_NUM_RECORDS q_u;
00079 EVENTLOG_R_GET_NUM_RECORDS r_u;
00080 prs_struct *data = &p->in_data.data;
00081 prs_struct *rdata = &p->out_data.rdata;
00082
00083 ZERO_STRUCT(q_u);
00084 ZERO_STRUCT(r_u);
00085
00086 if (!(eventlog_io_q_get_num_records("", &q_u, data, 0))) {
00087 DEBUG(0, ("eventlog_io_q_get_num_records: unable to unmarshall EVENTLOG_Q_GET_NUM_RECORDS.\n"));
00088 return False;
00089 }
00090
00091 r_u.status = _eventlog_get_num_records(p, &q_u, &r_u);
00092
00093 if (!(eventlog_io_r_get_num_records("", &r_u, rdata, 0))) {
00094 DEBUG(0, ("eventlog_io_r_get_num_records: unable to marshall EVENTLOG_R_GET_NUM_RECORDS.\n"));
00095 return False;
00096 }
00097
00098 return True;
00099 }
00100
00101 static BOOL api_eventlog_get_oldest_entry(pipes_struct *p)
00102 {
00103 EVENTLOG_Q_GET_OLDEST_ENTRY q_u;
00104 EVENTLOG_R_GET_OLDEST_ENTRY r_u;
00105 prs_struct *data = &p->in_data.data;
00106 prs_struct *rdata = &p->out_data.rdata;
00107
00108 ZERO_STRUCT(q_u);
00109 ZERO_STRUCT(r_u);
00110
00111 if (!(eventlog_io_q_get_oldest_entry("", &q_u, data, 0))) {
00112 DEBUG(0, ("eventlog_io_q_get_oldest_entry: unable to unmarshall EVENTLOG_Q_GET_OLDEST_ENTRY.\n"));
00113 return False;
00114 }
00115
00116 r_u.status = _eventlog_get_oldest_entry(p, &q_u, &r_u);
00117
00118 if (!(eventlog_io_r_get_oldest_entry("", &r_u, rdata, 0))) {
00119 DEBUG(0, ("eventlog_io_r_get_oldest_entry: unable to marshall EVENTLOG_R_GET_OLDEST_ENTRY.\n"));
00120 return False;
00121 }
00122
00123 return True;
00124 }
00125
00126 static BOOL api_eventlog_read_eventlog(pipes_struct *p)
00127 {
00128 EVENTLOG_Q_READ_EVENTLOG q_u;
00129 EVENTLOG_R_READ_EVENTLOG r_u;
00130 prs_struct *data = &p->in_data.data;
00131 prs_struct *rdata = &p->out_data.rdata;
00132
00133 ZERO_STRUCT(q_u);
00134 ZERO_STRUCT(r_u);
00135
00136 if (!(eventlog_io_q_read_eventlog("", &q_u, data, 0))) {
00137 DEBUG(0, ("eventlog_io_q_read_eventlog: unable to unmarshall EVENTLOG_Q_READ_EVENTLOG.\n"));
00138 return False;
00139 }
00140
00141 r_u.status = _eventlog_read_eventlog(p, &q_u, &r_u);
00142
00143 if (!(eventlog_io_r_read_eventlog("", &q_u, &r_u, rdata, 0))) {
00144 DEBUG(0, ("eventlog_io_r_read_eventlog: unable to marshall EVENTLOG_R_READ_EVENTLOG.\n"));
00145 return False;
00146 }
00147
00148 return True;
00149 }
00150
00151 static BOOL api_eventlog_clear_eventlog(pipes_struct *p)
00152 {
00153 EVENTLOG_Q_CLEAR_EVENTLOG q_u;
00154 EVENTLOG_R_CLEAR_EVENTLOG r_u;
00155 prs_struct *data = &p->in_data.data;
00156 prs_struct *rdata = &p->out_data.rdata;
00157
00158 ZERO_STRUCT(q_u);
00159 ZERO_STRUCT(r_u);
00160
00161 if (!(eventlog_io_q_clear_eventlog("", &q_u, data, 0))) {
00162 DEBUG(0, ("eventlog_io_q_clear_eventlog: unable to unmarshall EVENTLOG_Q_CLEAR_EVENTLOG.\n"));
00163 return False;
00164 }
00165
00166 r_u.status = _eventlog_clear_eventlog(p, &q_u, &r_u);
00167
00168 if (!(eventlog_io_r_clear_eventlog("", &r_u, rdata, 0))) {
00169 DEBUG(0, ("eventlog_io_q_clear_eventlog: unable to marshall EVENTLOG_Q_CLEAR_EVENTLOG.\n"));
00170 return False;
00171 }
00172
00173 return True;
00174 }
00175
00176
00177
00178
00179 struct api_struct api_eventlog_cmds[] =
00180 {
00181 {"EVENTLOG_OPENEVENTLOG", EVENTLOG_OPENEVENTLOG, api_eventlog_open_eventlog },
00182 {"EVENTLOG_CLOSEEVENTLOG", EVENTLOG_CLOSEEVENTLOG, api_eventlog_close_eventlog },
00183 {"EVENTLOG_GETNUMRECORDS", EVENTLOG_GETNUMRECORDS, api_eventlog_get_num_records },
00184 {"EVENTLOG_GETOLDESTENTRY", EVENTLOG_GETOLDESTENTRY, api_eventlog_get_oldest_entry },
00185 {"EVENTLOG_READEVENTLOG", EVENTLOG_READEVENTLOG, api_eventlog_read_eventlog },
00186 {"EVENTLOG_CLEAREVENTLOG", EVENTLOG_CLEAREVENTLOG, api_eventlog_clear_eventlog }
00187 };
00188
00189 NTSTATUS rpc_eventlog_init(void)
00190 {
00191 return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION,
00192 "eventlog", "eventlog", api_eventlog_cmds,
00193 sizeof(api_eventlog_cmds)/sizeof(struct api_struct));
00194 }
00195
00196 void eventlog_get_pipe_fns(struct api_struct **fns, int *n_fns)
00197 {
00198 *fns = api_eventlog_cmds;
00199 *n_fns = sizeof(api_eventlog_cmds) / sizeof(struct api_struct);
00200 }