Changeset e1e8f7a in mainline for uspace/lib/pcap/src/pcapdump_client.c
- Timestamp:
- 2024-12-13T08:44:05Z (15 months ago)
- Children:
- e5b2777
- Parents:
- 467d2b9
- git-author:
- Nataliia Korop <n.corop08@…> (2024-11-16 11:14:06)
- git-committer:
- Nataliia Korop <n.corop08@…> (2024-12-13 08:44:05)
- File:
-
- 1 edited
-
uspace/lib/pcap/src/pcapdump_client.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/pcap/src/pcapdump_client.c
r467d2b9 re1e8f7a 41 41 #include <ctype.h> 42 42 #include "pcapdump_client.h" 43 #include "pcapdump_ srv.h"43 #include "pcapdump_ipc.h" 44 44 45 45 /** Finish an async exchange on the pcapctl session … … 100 100 } 101 101 if (*index + 1 > (int)count || *index < 0) { 102 return EINVAL; 103 } 104 return EOK; 105 } 106 107 108 errno_t pcapctl_is_valid_ops_number(int *index, pcapctl_sess_t* sess) 109 { 110 async_exch_t *exch = async_exchange_begin(sess->sess); 111 ipc_call_t answer; 112 aid_t req = async_send_0(exch, PCAP_CONTROL_GET_OPS_NUM, &answer); 113 114 async_exchange_end(exch); 115 116 errno_t retval; 117 async_wait_for(req, &retval); 118 119 if (retval != EOK) { 120 return retval; 121 } 122 123 int ops_count = (int)ipc_get_arg1(&answer); 124 if (*index + 1 > ops_count || *index < 0) 125 { 102 126 return EINVAL; 103 127 } … … 149 173 return ENOMEM; 150 174 151 printf("number: %d\n", *index);152 175 if (*index == -1) { 153 176 *index = 0; … … 190 213 * @return EOK on success or an error code 191 214 */ 192 errno_t pcapctl_dump_start(const char *name, pcapctl_sess_t *sess)215 errno_t pcapctl_dump_start(const char *name, int *ops_index, pcapctl_sess_t *sess) 193 216 { 194 217 errno_t rc; … … 196 219 197 220 size_t size = str_size(name); 198 aid_t req = async_send_ 0(exch, PCAP_CONTROL_SET_START, NULL);221 aid_t req = async_send_1(exch, PCAP_CONTROL_SET_START, *ops_index, NULL); 199 222 200 223 rc = async_data_write_start(exch, name, size); … … 227 250 } 228 251 229 errno_t pcapctl_dump_set_ops(const char *ops_name, pcapctl_sess_t *sess)230 {231 errno_t rc;232 async_exch_t *exch = async_exchange_begin(sess->sess);233 234 size_t size = str_size(ops_name);235 aid_t req = async_send_0(exch, PCAP_CONTROL_SET_OPS, NULL);236 237 rc = async_data_write_start(exch, ops_name, size);238 239 pcapctl_dump_exchange_end(exch);240 241 if (rc != EOK) {242 async_forget(req);243 return rc;244 }245 246 errno_t retval;247 async_wait_for(req, &retval);248 return retval;249 }250 252 251 253 /** @}
Note:
See TracChangeset
for help on using the changeset viewer.
