]> git.stg.codes - stg.git/blob - projects/stargazer/plugins/capture/cap_debug/misc.c
Fixed compilation issue.
[stg.git] / projects / stargazer / plugins / capture / cap_debug / misc.c
1 /* $Id: misc.c,v 1.1 2005/12/12 18:14:22 nobunaga Exp $ 
2
3 Copyright (C) 2002 Marc Kirchner <kirchner@stud.fh-heilbronn.de>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20 #include "libpal.h"
21
22 /*
23 <++doc++>
24 @name int pkt_add_systimestamp(struct packet *pkt)
25 @desc Adds a system timestamp (struct timeval) at the position where pkt-&gt;pkt_ptr points to.
26 @param pkt packet into which a timestamp with the current system time will be added. 
27 <--doc-->
28 */
29 int
30 pkt_add_systimestamp(struct packet *pkt)
31 {
32         if (!pkt)
33                 return EPKTINVALPTR;
34         if (pkt->pkt_size < (pkt->pkt_pos + sizeof(struct timeval)))
35                 return EPKTRANGE;
36         if (gettimeofday((struct timeval *)pkt->pkt_ptr, NULL) == 0)
37                 return 0;
38         else
39                 return EERRNO;
40 }
41