N-sim
Emulation and simulation of
Wireless Sensor Networks



   Home


   Project Page


   Download


   CVS



   Installation


   Configuration


   Plug-ins




 Hosted by
SourceForge.net Logo

/home/brennan/n-sim/OrbisQuartus/server/protocols/mac_lib.h

Go to the documentation of this file.
00001 
00008 /*
00009  * $Revision: 1.11 $
00010  *
00011  * Original Author: Sean M. Brennan <brennan@lanl.gov>
00012  * $Author: sean_m_brennan $
00013  *
00014  * Created: February 8, 2006
00015  * $Date: 2007/10/11 17:13:31 $
00016  */
00017 
00018 /*
00019  * Copyright 2007. Los Alamos National Security, LLC. This material
00020  * was produced under U.S. Government contract DE-AC52-06NA25396 for
00021  * Los Alamos National Laboratory (LANL), which is operated by Los
00022  * Alamos National Security, LLC, for the Department of Energy. The
00023  * U.S. Government has rights to use, reproduce, and distribute this
00024  * software. NEITHER THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY,
00025  * LLC, MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL
00026  * LIABILITY FOR THE USE OF THIS SOFTWARE. If software is modified to
00027  * produce derivative works, such modified software should be clearly
00028  * marked, so as not to confuse it with the version available from LANL.
00029  *
00030  * Additionally, this program is free software; you can redistribute
00031  * it and/or modify it under the terms of the GNU General Public
00032  * License as published by the Free Software Foundation; version 2 of
00033  * the License. Accordingly, this program is distributed in the hope
00034  * it will be useful, but WITHOUT ANY WARRANTY; without even the
00035  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00036  * PURPOSE. See the GNU General Public License for more details.
00037  */
00038 
00039 
00040 #ifndef _MAC_LIB_H_
00041 #define _MAC_LIB_H_
00042 
00043 #ifdef __cplusplus
00044 extern "C" {
00045 #endif
00046 
00047 #include <dlfcn.h>
00048 #include <string.h>
00049 #include <limits.h>
00050 #include <oq.h>
00051 #include <sim_if.h>
00052 
00053 
00054 enum { 
00055         OQ_SKB_DROP     = 0, 
00056         OQ_SKB_PASS     = 1, 
00057         OQ_SKB_WAIT     = 2,
00058         OQ_SKB_INJECT   = 3,
00059         OQ_SKB_SEND     = 4, 
00060         OQ_SKB_RECV     = 5, 
00061         OQ_SKB_RELEASE  = 6, 
00062 };
00063 
00064 
00066 typedef int (*mac_filter_t) (struct oq_req_resp *);
00067 
00069 typedef long long (*mac_throughput_t) (void);
00070 
00071 
00072 /********************/
00073 
00074 long long null_throughput(void);
00075 int null_filter(struct oq_req_resp *);
00076 
00077 /********************/
00078 
00079 
00080 static const struct protocol_entry {
00081         char name[MAX_NAME];
00082         mac_filter_t mac_filter;          /* function achieves MAC protocol */
00083         mac_throughput_t mac_throughput;  /* xfer time per char, in nanosecs */
00084         struct protocol_entry *next;
00085 } protocol_table = 
00086 {
00087   "null", null_filter, null_throughput, NULL,
00088 };
00089 
00090 
00091 
00093 int protocol_filter(char *name, struct oq_req_resp *rr);
00094 
00096 long long protocol_throughput(char *name);
00097 
00098 
00103 void add_protocol(char *path, char *name, char *filter, char *through);
00104 
00106 void remove_protocol(char *name);
00107 
00108 
00110 
00111 #ifdef __cplusplus
00112 }
00113 #endif
00114 
00115 #endif                   /* _MAC_LIB_H_ */


© 2007, Los Alamos National Security, LLC.