Harald Welte | 51b00a6 | 2014-04-03 09:37:38 -0400 | [diff] [blame^] | 1 | /* Helper functions */ |
| 2 | |
| 3 | /* (C) 2014 by sysmocom - s.f.m.c. GmbH |
| 4 | * Author: Pablo Neira Ayuso <pablo@gnumonks.org> |
| 5 | * |
| 6 | * All Rights Reserved |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License as published by |
| 10 | * the Free Software Foundation; either version 2 of the License, or |
| 11 | * (at your option) any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU Affero General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License |
| 19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 20 | * |
| 21 | */ |
| 22 | |
Pablo Neira Ayuso | 1450666 | 2014-02-20 18:43:15 +0100 | [diff] [blame] | 23 | #include <stdint.h> |
| 24 | #include <libmnl/libmnl.h> |
| 25 | #include <linux/gtp_nl.h> |
| 26 | |
| 27 | void gtp_build_payload(struct nlmsghdr *nlh, uint64_t tid, uint32_t ifidx, |
| 28 | uint32_t sgsn_addr, uint32_t ms_addr, uint32_t version) |
| 29 | { |
| 30 | mnl_attr_put_u32(nlh, GTPA_VERSION, version); |
| 31 | mnl_attr_put_u32(nlh, GTPA_LINK, ifidx); |
| 32 | mnl_attr_put_u32(nlh, GTPA_SGSN_ADDRESS, sgsn_addr); |
| 33 | mnl_attr_put_u32(nlh, GTPA_MS_ADDRESS, ms_addr); |
| 34 | mnl_attr_put_u64(nlh, GTPA_TID, tid); |
| 35 | } |