diff options
author | Luke Leighton <lkcl@samba.org> | 1999-11-27 22:58:11 +0000 |
---|---|---|
committer | Luke Leighton <lkcl@samba.org> | 1999-11-27 22:58:11 +0000 |
commit | 0aaf0c9c80b4a506955065e822a356b1c43a5ac5 (patch) | |
tree | 2dda8339eb69734acc1f69ae0b4bee636dd0b5ec /source/rpc_client | |
parent | 601d217f44ea1ce3735b9267b6f829b472a982b4 (diff) | |
download | samba-0aaf0c9c80b4a506955065e822a356b1c43a5ac5.tar.gz samba-0aaf0c9c80b4a506955065e822a356b1c43a5ac5.tar.xz samba-0aaf0c9c80b4a506955065e822a356b1c43a5ac5.zip |
moved at command over to new abstract connection system. matthew, you
initialised dest_wks _after_ using it in at_soon() :-) so i fixed this :)
Diffstat (limited to 'source/rpc_client')
-rw-r--r-- | source/rpc_client/cli_atsvc.c | 64 |
1 files changed, 49 insertions, 15 deletions
diff --git a/source/rpc_client/cli_atsvc.c b/source/rpc_client/cli_atsvc.c index ba18a36313c..9ba87e6e4a2 100644 --- a/source/rpc_client/cli_atsvc.c +++ b/source/rpc_client/cli_atsvc.c @@ -28,8 +28,8 @@ extern int DEBUGLEVEL; /**************************************************************************** add a job to the scheduler ****************************************************************************/ -BOOL at_add_job(struct cli_state *cli, uint16 fnum, - char *server_name, AT_JOB_INFO *info, char *command, +BOOL at_add_job( + char *srv_name, AT_JOB_INFO *info, char *command, uint32 *jobid) { prs_struct rbuf; @@ -37,6 +37,13 @@ BOOL at_add_job(struct cli_state *cli, uint16 fnum, AT_Q_ADD_JOB q_a; BOOL p = False; + struct cli_connection *con = NULL; + + if (!cli_connection_init(srv_name, PIPE_ATSVC, &con)) + { + return False; + } + prs_init(&buf , 1024, 4, SAFETY_MARGIN, False); prs_init(&rbuf, 0 , 4, SAFETY_MARGIN, True ); @@ -45,13 +52,13 @@ BOOL at_add_job(struct cli_state *cli, uint16 fnum, DEBUG(4,("Scheduler Add Job\n")); /* store the parameters */ - make_at_q_add_job(&q_a, server_name, info, command); + make_at_q_add_job(&q_a, srv_name, info, command); /* turn parameters into data stream */ at_io_q_add_job("", &q_a, &buf, 0); /* send the data on \PIPE\ */ - if (rpc_api_pipe_req(cli, fnum, AT_ADD_JOB, &buf, &rbuf)) + if (rpc_con_pipe_req(con, AT_ADD_JOB, &buf, &rbuf)) { AT_R_ADD_JOB r_a; @@ -74,20 +81,28 @@ BOOL at_add_job(struct cli_state *cli, uint16 fnum, prs_mem_free(&rbuf); prs_mem_free(&buf ); + cli_connection_unlink(con); + return p; } /**************************************************************************** dequeue a job ****************************************************************************/ -BOOL at_del_job(struct cli_state *cli, uint16 fnum, - char *server_name, uint32 min_jobid, uint32 max_jobid) +BOOL at_del_job( char *srv_name, uint32 min_jobid, uint32 max_jobid) { prs_struct rbuf; prs_struct buf; AT_Q_DEL_JOB q_d; BOOL p = False; + struct cli_connection *con = NULL; + + if (!cli_connection_init(srv_name, PIPE_ATSVC, &con)) + { + return False; + } + prs_init(&buf , 1024, 4, SAFETY_MARGIN, False); prs_init(&rbuf, 0 , 4, SAFETY_MARGIN, True ); @@ -96,13 +111,13 @@ BOOL at_del_job(struct cli_state *cli, uint16 fnum, DEBUG(4,("Scheduler Delete Job\n")); /* store the parameters */ - make_at_q_del_job(&q_d, server_name, min_jobid, max_jobid); + make_at_q_del_job(&q_d, srv_name, min_jobid, max_jobid); /* turn parameters into data stream */ at_io_q_del_job("", &q_d, &buf, 0); /* send the data on \PIPE\ */ - if (rpc_api_pipe_req(cli, fnum, AT_DEL_JOB, &buf, &rbuf)) + if (rpc_con_pipe_req(con, AT_DEL_JOB, &buf, &rbuf)) { AT_R_DEL_JOB r_d; @@ -120,14 +135,15 @@ BOOL at_del_job(struct cli_state *cli, uint16 fnum, prs_mem_free(&rbuf); prs_mem_free(&buf ); + cli_connection_unlink(con); + return p; } /**************************************************************************** enumerate scheduled jobs ****************************************************************************/ -BOOL at_enum_jobs(struct cli_state *cli, uint16 fnum, - char *server_name, uint32 *num_jobs, +BOOL at_enum_jobs( char *srv_name, uint32 *num_jobs, AT_ENUM_INFO *jobs, char ***commands) { prs_struct rbuf; @@ -135,6 +151,13 @@ BOOL at_enum_jobs(struct cli_state *cli, uint16 fnum, AT_Q_ENUM_JOBS q_e; BOOL p = False; + struct cli_connection *con = NULL; + + if (!cli_connection_init(srv_name, PIPE_ATSVC, &con)) + { + return False; + } + prs_init(&buf , 1024, 4, SAFETY_MARGIN, False); prs_init(&rbuf, 0 , 4, SAFETY_MARGIN, True ); @@ -143,13 +166,13 @@ BOOL at_enum_jobs(struct cli_state *cli, uint16 fnum, DEBUG(4,("Scheduler Enumerate Jobs\n")); /* store the parameters */ - make_at_q_enum_jobs(&q_e, server_name); + make_at_q_enum_jobs(&q_e, srv_name); /* turn parameters into data stream */ at_io_q_enum_jobs("", &q_e, &buf, 0); /* send the data on \PIPE\ */ - if (rpc_api_pipe_req(cli, fnum, AT_ENUM_JOBS, &buf, &rbuf)) + if (rpc_con_pipe_req(con, AT_ENUM_JOBS, &buf, &rbuf)) { AT_R_ENUM_JOBS r_e; @@ -186,13 +209,15 @@ BOOL at_enum_jobs(struct cli_state *cli, uint16 fnum, prs_mem_free(&rbuf); prs_mem_free(&buf ); + cli_connection_unlink(con); + return p; } /**************************************************************************** query job information ****************************************************************************/ -BOOL at_query_job(struct cli_state *cli, uint16 fnum, char *server_name, +BOOL at_query_job(char *srv_name, uint32 jobid, AT_JOB_INFO *job, fstring command) { prs_struct rbuf; @@ -200,6 +225,13 @@ BOOL at_query_job(struct cli_state *cli, uint16 fnum, char *server_name, AT_Q_QUERY_JOB q_q; BOOL p = False; + struct cli_connection *con = NULL; + + if (!cli_connection_init(srv_name, PIPE_ATSVC, &con)) + { + return False; + } + prs_init(&buf , 1024, 4, SAFETY_MARGIN, False); prs_init(&rbuf, 0 , 4, SAFETY_MARGIN, True ); @@ -208,13 +240,13 @@ BOOL at_query_job(struct cli_state *cli, uint16 fnum, char *server_name, DEBUG(4,("Scheduler Query Job\n")); /* store the parameters */ - make_at_q_query_job(&q_q, server_name, jobid); + make_at_q_query_job(&q_q, srv_name, jobid); /* turn parameters into data stream */ at_io_q_query_job("", &q_q, &buf, 0); /* send the data on \PIPE\ */ - if (rpc_api_pipe_req(cli, fnum, AT_QUERY_JOB, &buf, &rbuf)) + if (rpc_con_pipe_req(con, AT_QUERY_JOB, &buf, &rbuf)) { AT_R_QUERY_JOB r_q; @@ -239,5 +271,7 @@ BOOL at_query_job(struct cli_state *cli, uint16 fnum, char *server_name, prs_mem_free(&rbuf); prs_mem_free(&buf ); + cli_connection_unlink(con); + return p; } |