1/*-
2 * Copyright (c) 2004-2008 Apple Inc.
3 * Copyright (c) 2005 SPARTA, Inc.
4 * Copyright (c) 2006 Robert N. M. Watson
5 * Copyright (c) 2006 Martin Voros
6 * All rights reserved.
7 *
8 * This code was developed in part by Robert N. M. Watson, Senior Principal
--- 18 unchanged lines hidden (view full) ---
27 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
31 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
32 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGE.
34 *
35 * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_io.c#62 $
36 */
37
38#include <sys/types.h>
39
40#include <config/config.h>
41#if defined(HAVE_SYS_ENDIAN_H) && defined(HAVE_BE32ENC)
42#include <sys/endian.h>
43#else /* !HAVE_SYS_ENDIAN_H || !HAVE_BE32ENC */
--- 3127 unchanged lines hidden (view full) ---
3171 print_2_bytes(fp, ntohs(tok->tt.sockinet_ex32.port), "%u");
3172 print_delim(fp, del);
3173 print_ip_ex_address(fp, AU_IPv6, tok->tt.sockinet_ex32.addr);
3174 }
3175}
3176
3177/*
3178 * socket family 2 bytes
3179 * path 104 bytes
3180 */
3181static int
3182fetch_sock_unix_tok(tokenstr_t *tok, u_char *buf, int len)
3183{
3184 int err = 0;
3185
3186 READ_TOKEN_U_INT16(buf, len, tok->tt.sockunix.family, tok->len, err);
3187 if (err)
3188 return (-1);
3189
3190 READ_TOKEN_BYTES(buf, len, tok->tt.sockunix.path, 104, tok->len,
3191 err);
3192 if (err)
3193 return (-1);
3194
3195 return (0);
3196}
3197
3198static void
3199print_sock_unix_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
--- 1423 unchanged lines hidden ---
2 * Copyright (c) 2004-2008 Apple Inc.
3 * Copyright (c) 2005 SPARTA, Inc.
4 * Copyright (c) 2006 Robert N. M. Watson
5 * Copyright (c) 2006 Martin Voros
6 * All rights reserved.
7 *
8 * This code was developed in part by Robert N. M. Watson, Senior Principal
--- 18 unchanged lines hidden (view full) ---
27 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
31 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
32 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGE.
34 *
35 * $P4: //depot/projects/trustedbsd/openbsm/libbsm/bsm_io.c#62 $
36 */
37
38#include <sys/types.h>
39
40#include <config/config.h>
41#if defined(HAVE_SYS_ENDIAN_H) && defined(HAVE_BE32ENC)
42#include <sys/endian.h>
43#else /* !HAVE_SYS_ENDIAN_H || !HAVE_BE32ENC */
--- 3127 unchanged lines hidden (view full) ---
3171 print_2_bytes(fp, ntohs(tok->tt.sockinet_ex32.port), "%u");
3172 print_delim(fp, del);
3173 print_ip_ex_address(fp, AU_IPv6, tok->tt.sockinet_ex32.addr);
3174 }
3175}
3176
3177/*
3178 * socket family 2 bytes
3179 * path 104 bytes
3180 */
3181static int
3182fetch_sock_unix_tok(tokenstr_t *tok, u_char *buf, int len)
3183{
3184 int err = 0;
3185
3186 READ_TOKEN_U_INT16(buf, len, tok->tt.sockunix.family, tok->len, err);
3187 if (err)
3188 return (-1);
3189
3190 READ_TOKEN_BYTES(buf, len, tok->tt.sockunix.path, 104, tok->len,
3191 err);
3192 if (err)
3193 return (-1);
3194
3195 return (0);
3196}
3197
3198static void
3199print_sock_unix_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
--- 1423 unchanged lines hidden ---