dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / lib / libcommputil / common / commp_util.h
blobe968dc88cf626a5444f37f7bbefec8d3554cb750
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
23 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #ifndef _COMMP_UTIL_H
28 #define _COMMP_UTIL_H
30 #pragma ident "%Z%%M% %I% %E% SMI"
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
36 #include <sys/types.h>
38 #define COMMP_CRLF "\r\n"
39 #define COMMP_LF "\n"
40 #define COMMP_SKIP_CRLF(msg_ptr) ((msg_ptr) = (msg_ptr) + 2)
41 #define COMMP_SKIP_LF(msg_ptr) ((msg_ptr) = (msg_ptr) + 1)
43 #define COMMP_SECS_IN_DAY 86400
44 #define COMMP_SECS_IN_HOUR 3600
45 #define COMMP_SECS_IN_MIN 60
47 #define COMMP_SP ' '
48 #define COMMP_CR '\r'
49 #define COMMP_COLON ':'
50 #define COMMP_SLASH '/'
51 #define COMMP_EQUALS '='
52 #define COMMP_ADDRTYPE_IP4 "IP4"
53 #define COMMP_ADDRTYPE_IP6 "IP6"
55 #define COMMP_COPY_STR(dst, src, len) { \
56 (dst) = calloc(1, (len) + 1); \
57 if ((dst) != NULL) { \
58 (void) strncpy((dst), (src), (len)); \
59 } \
62 extern int commp_skip_white_space(const char **, const char *);
63 extern int commp_find_token(const char **, const char **, const char *,
64 char, boolean_t);
65 extern int commp_atoi(const char *, const char *, int *);
66 extern int commp_strtoull(const char *, const char *, uint64_t *);
67 extern int commp_strtoub(const char *, const char *, uint8_t *);
68 extern int commp_atoui(const char *, const char *, uint_t *);
69 extern int commp_time_to_secs(const char *, const char *, uint64_t *);
70 extern int commp_add_str(char **, const char *, int);
72 #ifdef __cplusplus
74 #endif
76 #endif /* _COMMP_UTIL_H */