Changeset 87b490e3 in mainline for uspace/app/pcapctl/main.c


Ignore:
Timestamp:
2024-12-13T08:44:05Z (10 months ago)
Author:
Nataliia Korop <n.corop08@…>
Children:
420b13d
Parents:
fb31682
git-author:
Nataliia Korop <n.corop08@…> (2024-11-30 19:08:32)
git-committer:
Nataliia Korop <n.corop08@…> (2024-12-13 08:44:05)
Message:

docs comments

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/pcapctl/main.c

    rfb31682 r87b490e3  
    3030 * @{
    3131 */
    32 /** @file pcapctl app
     32/** @file pcapctl command-line utility.
    3333 */
    3434
     
    4242#include "pcapdump_client.h"
    4343
    44 #define NAME "pcapctl"
    45 #define DEFAULT_DEV_NUM 0
    46 #define DECIMAL_SYSTEM 10
    47 
    48 #define DEFAULT_FILE_OPS 0
    49 #define SHORT_FILE_OPS 1
    50 #define APPEND_FILE_OPS 2
    51 #define USB_FILE_OPS 3
    52 
     44#define NAME                            "pcapctl"
     45#define DEFAULT_DEV_NUM         0
     46#define DECIMAL_SYSTEM          10
     47
     48/* Default writer operations for dumper, must be consistent with array defined in /uspace/lib/pcap/pcap_dumper.c */
     49#define DEFAULT_FILE_OPS        0
     50#define SHORT_FILE_OPS          1
     51#define APPEND_FILE_OPS         2
     52#define USB_FILE_OPS            3
     53
     54/** Create async session and send start request.
     55 *  @param dev_number index of the device that can dump packets.
     56 *  @param name of the output buffer.
     57 *  @param ops_index index of the writer operations for the dumper.
     58 *  @return EOK if all parameters are valid and start request was sent successfully, error code otherwise.
     59 */
    5360static errno_t start_dumping(int *dev_number, const char *name, int *ops_index)
    5461{
     
    7784}
    7885
     86/** Create async session and send stop dumping request.
     87 *  @param dev_numbe index of the device on which the dumping will be stopped.
     88 *  @return EOK if request was sent successfully, error code otherwise.
     89 */
    7990static errno_t stop_dumping(int *dev_number)
    8091{
     
    92103}
    93104
     105/** Print devices that can dump packets. */
    94106static void list_devs(void)
    95107{
     
    101113 */
    102114static const struct option opts[] = {
    103         { "append", required_argument, 0, 'A' }, // file as argument and ops 0 if not exist and 2 if exists
    104         { "new", required_argument, 0, 'N' }, // file name as argument
     115        { "append", required_argument, 0, 'A' }, /* file as argument and ops 0 if not exist and 2 if exists */
     116        { "new", required_argument, 0, 'N' }, /* file name as argument */
    105117        { "truncated", required_argument, 0, 'T' }, // truncated ops
    106118        { "usb", required_argument, 0, 'U' }, //??
     
    116128};
    117129
     130/** Check if the file exists.
     131 *  @param path of the file to check.
     132 *  @return true if exists, false otherwise.
     133 */
    118134static bool file_exists(const char *path)
    119135{
     
    128144static void usage(void)
    129145{
    130         printf("Usage:\n"
     146        printf("HelenOS Packet Dumping utility.\n"
     147            "Usage:\n"
    131148            NAME " --list | -l \n"
    132149            "\tList of devices\n"
     
    218235        }
    219236
    220         printf("%s: HelenOS Packet Dumping utility: device - %d, ops - %d.\n", NAME, dev_number, ops_number);
    221 
    222237        if (start) {
    223238
     
    227242                }
    228243
     244                printf("Sarting dumping on device - %d, ops - %d.\n", dev_number, ops_number);
     245
    229246                /* start with dev number and name */
    230247                start_dumping(&dev_number, output_file_name, &ops_number);
    231248        } else if (stop) {
    232249                /* stop with dev number */
     250                printf("Stopping dumping on device - %d, ops - %d.\n", dev_number, ops_number);
    233251                stop_dumping(&dev_number);
    234252        } else {
Note: See TracChangeset for help on using the changeset viewer.