Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/app/parse.h

    r3be62bc raadf01e  
    3838#define __NET_APP_PARSE__
    3939
    40 #include "../include/socket.h"
    41 
    42 /** Translates the character string to the address family number.
    43  *  @param[in] name The address family name.
    44  *  @returns The corresponding address family number.
    45  *  @returns EAFNOSUPPORTED if the address family is not supported.
     40/** Prints the parameter unrecognized message and the application help.
     41 *  @param[in] index The index of the parameter.
     42 *  @param[in] parameter The parameter name.
    4643 */
    47 int parse_address_family(const char * name);
     44void print_unrecognized(int index, const char * parameter);
    4845
    4946/** Parses the next parameter as an integral number.
     
    6158 */
    6259int parse_parameter_int(int argc, char ** argv, int * index, int * value, const char * name, int offset);
     60
     61/** Parses the next parameter as a character string.
     62 *  The actual parameter is pointed by the index.
     63 *  Uses the offseted actual parameter value if the offset is set or the next one if not.
     64 *  Increments the actual index by the number of processed parameters.
     65 *  @param[in] argc The total number of the parameters.
     66 *  @param[in] argv The parameters.
     67 *  @param[in,out] index The actual parameter index. The index is incremented by the number of processed parameters.
     68 *  @param[out] value The parsed parameter value.
     69 *  @param[in] name The parameter name to be printed on errors.
     70 *  @param[in] offset The value offset in the actual parameter. If not set, the next parameter is parsed instead.
     71 *  @returns EOK on success.
     72 *  @returns EINVAL if the parameter is missing.
     73 */
     74int parse_parameter_string(int argc, char ** argv, int * index, char ** value, const char * name, int offset);
    6375
    6476/** Parses the next named parameter as an integral number.
     
    8092int parse_parameter_name_int(int argc, char ** argv, int * index, int * value, const char * name, int offset, int (*parse_value)(const char * value));
    8193
    82 /** Parses the next parameter as a character string.
    83  *  The actual parameter is pointed by the index.
    84  *  Uses the offseted actual parameter value if the offset is set or the next one if not.
    85  *  Increments the actual index by the number of processed parameters.
    86  *  @param[in] argc The total number of the parameters.
    87  *  @param[in] argv The parameters.
    88  *  @param[in,out] index The actual parameter index. The index is incremented by the number of processed parameters.
    89  *  @param[out] value The parsed parameter value.
    90  *  @param[in] name The parameter name to be printed on errors.
    91  *  @param[in] offset The value offset in the actual parameter. If not set, the next parameter is parsed instead.
    92  *  @returns EOK on success.
    93  *  @returns EINVAL if the parameter is missing.
    94  */
    95 int parse_parameter_string(int argc, char ** argv, int * index, char ** value, const char * name, int offset);
    96 
    97 /** Translates the character string to the protocol family number.
    98  *  @param[in] name The protocol family name.
    99  *  @returns The corresponding protocol family number.
    100  *  @returns EPFNOSUPPORTED if the protocol family is not supported.
    101  */
    102 int parse_protocol_family(const char * name);
    103 
    104 /** Translates the character string to the socket type number.
    105  *  @param[in] name The socket type name.
    106  *  @returns The corresponding socket type number.
    107  *  @returns ESOCKNOSUPPORTED if the socket type is not supported.
    108  */
    109 int parse_socket_type(const char * name);
    110 
    111 /** Prints the parameter unrecognized message and the application help.
    112  *  @param[in] index The index of the parameter.
    113  *  @param[in] parameter The parameter name.
    114  */
    115 void print_unrecognized(int index, const char * parameter);
    116 
    11794#endif
    11895
Note: See TracChangeset for help on using the changeset viewer.