Compare commits

...

807 Commits

Author SHA1 Message Date
Sukchan Lee
5ee7cdd3f8 Release v0.3.9 2018-06-03 01:42:05 +00:00
Sukchan Lee
048eb3f2b2 Change default DISPLAY environment.
We set the DISPLAY=docker.for.mac.localhost:0
If you want to use wireshark in Linux, you need to set DISPLAY to :0.
2018-06-03 10:32:28 +09:00
Sukchan Lee
352b02fc3e Fix the Dockerfile error 2018-06-03 10:17:56 +09:00
Sukchan Lee
9d8695fa31 Update logging message 2018-05-31 09:40:34 +09:00
Sukchan Lee
9415f5215c Fix SCTP for Mac OS X 2018-05-30 22:17:46 +09:00
Sukchan Lee
8c674aa134 Update logging 2018-05-30 21:58:10 +09:00
Sukchan Lee
3b9b1108b1 Configure Outbound streams on SCTP_COMM_UP 2018-05-30 21:49:17 +09:00
Sukchan Lee
9aed43075c SCTP recv interface will be changed. (Progressing...) 2018-05-30 17:45:14 +09:00
Sukchan Lee
3d78f285be Install wireshark in docker 2018-05-30 15:05:47 +09:00
Sukchan Lee
749d632b86 Change the name of docker image 2018-05-29 17:41:11 +09:00
Sukchan Lee
37ecb9a63b Change debian package in docker 2018-05-29 16:03:29 +09:00
Sukchan Lee
0d3af830bb Unlink debian from ubuntu 2018-05-29 13:05:37 +09:00
Sukchan Lee
7c7cfd1cbf Support bionic in Docker 2018-05-29 11:20:48 +09:00
Sukchan Lee
4f1efbb521 Add wireshark in Docker 2018-05-29 11:15:18 +09:00
Sukchan Lee
2fb37ad797 Change the assert to warning
- When UEContextReleaseComplete is received,
    It could be unknown MME-UE-S1AP-ID.
- So, we change the log from assert to warning
2018-05-23 20:40:46 +09:00
Sukchan Lee
ffa6c2c15b Fix the bug of invalid TAU update result.
- MME should set TAU update result in TAU accept message. TAU udpate
result should be derived from TAU request message.
2018-05-22 19:21:34 +09:00
Sukchan Lee
c906b243a2 fix the encryption bug 2018-05-22 17:39:43 +09:00
Sukchan Lee
056fc43d34 Fix the bug for EIA2 (#64) 2018-05-22 11:31:09 +09:00
Sukchan Lee
76c84bdaa4 Fix the bug in building TAU accept message (#29)
- TAU accept should be integrity protected
2018-05-21 15:17:34 +09:00
Sukchan Lee
6ae20c9d1c refine code 2018-05-19 06:16:53 +09:00
Sukchan Lee
fe84604fa0 Oops! Change inbound_streams to outbound_streams (#63) 2018-05-19 06:06:02 +09:00
Sukchan Lee
85a2a64b65 Support Mac OS X for SCTP streams negotiations 2018-05-18 23:08:57 +09:00
Sukchan Lee
f5c203d3ac remove redundant code 2018-05-18 17:32:56 +09:00
Sukchan Lee
9a0afe035a Negociate SCTP stream ID with eNodeB (#63) 2018-05-18 17:14:29 +09:00
Sukchan Lee
76d8df3879 remove d_error 2018-05-18 15:52:47 +09:00
Sukchan Lee
550a606306 Update error message if SGW is not running (#59) 2018-05-14 21:46:19 +09:00
Sukchan Lee
1b21c21395 change warning to trace 2018-05-13 21:14:51 +09:00
Sukchan Lee
157dab73c7 fix the linux for SCTP streams 2018-05-13 18:31:01 +09:00
Sukchan Lee
7dba30b1e6 S1AP sends SCTP packet with stream id (#54) 2018-05-13 18:02:24 +09:00
Sukchan Lee
55fa0115e8 Merge branch 'master' into stream 2018-05-13 17:01:36 +09:00
Sukchan Lee
2142d406f0 fix the timezone for GTPv2 message 2018-05-13 17:00:57 +09:00
Sukchan Lee
9d84d4d43a Fix the timezone error 2018-05-13 16:45:49 +09:00
Sukchan Lee
57ef9697c3 Merge branch 'stream' of https://github.com/acetcom/nextepc into stream 2018-05-13 10:04:12 +09:00
Sukchan Lee
280aaf9fe1 Add SCTP output stream generator (#54) 2018-05-10 11:19:05 +09:00
Sukchan Lee
529b55c16b Introduce new configuration for SCTP streams (#54)
SCTP initmsg
 - Number of output streams : configured(default:30)
 - Maximum input streams : 65535
 - Maximum attempts : 4
 - Maximum initial timeout : 8 seconds
2018-05-10 10:35:15 +09:00
Sukchan Lee
10f59c850b Generate SCTP output stream identifier 2018-05-09 23:09:04 +09:00
Sukchan Lee
e18467889c Introduce new configuration for SCTP streams
SCTP initmsg
 - Number of output streams : configured(default:30)
 - Maximum input streams : 65535
 - Maximum attempts : 4
 - Maximum initial timeout : 8 seconds
2018-05-09 22:11:25 +09:00
Sukchan Lee
3148d4cd67 Support Ubuntu 18.04 LTS (bionic) 2018-05-05 22:52:03 +09:00
Sukchan Lee
de92fdd5c7 Update debian changelog for ubuntu 18.04(bionic)
We've release ubuntu 18.04 LTS(bionic)
2018-05-05 21:51:50 +09:00
Sukchan Lee
f3ddfaec44 Fix the docker development environment 2018-05-02 22:11:02 +09:00
Sukchan Lee
2d5f9d0d26 Release v0.3.8 2018-04-29 21:48:27 +09:00
Sukchan Lee
765eb2ada0 update it 2018-04-20 10:48:52 +02:00
Sukchan Lee
ee3c2d29bf Merge branch 'master' of https://github.com/acetcom/nextepc 2018-04-20 09:06:50 +02:00
Sukchan Lee
60aca81a1f fix the bug for handover command in case of no indirect tunnel 2018-04-20 09:06:17 +02:00
Sukchan Lee
e60a3d567d fix memory-leak when s1ap decode is failed 2018-04-18 22:21:58 +09:00
James Park
c968067829 -Initialize enb_ue_s1ap_id to invalid value
-Use mme_ue_s1apid if enb_ue_s1ap_id is not valid when encoding
ue_context_release_command
2018-04-17 14:35:15 -07:00
James Park
553804dd94 Fix bug: Paging message should be copied before sending 2018-04-17 11:46:20 -07:00
Sukchan Lee
38a252bbf0 Merge branch 'master' of https://github.com/acetcom/nextepc 2018-04-15 18:37:58 +09:00
Sukchan Lee
ae1660c436 add warning 2018-04-15 18:37:45 +09:00
Sukchan Lee
d2aed88ac6 Release 0.3.7 2018-04-14 15:04:04 +09:00
James Park
e5a0b1ff69 Reduce the number of buffered packets when UE is in idle.
FIXME: Need to be adjusted when the number of clbuf is increased.
2018-04-12 10:11:17 -07:00
Sukchan Lee
539d0c7bc5 fix the bug about wrong size value when calling core_calloc 2018-04-11 06:47:28 +09:00
James Park
a1e06c919f Fix bug : wrong size vlaue when calling core_calloc 2018-04-10 14:35:18 -07:00
Sukchan Lee
935e4b56ef Use common S1AP library for UERadioCapability
- Use S1AP_STORE/CLEAR macros for storing/retrieving UERadioCapability
- UERadioCapability will be stored in UECapabilityInfoIndication
- InitialContextSetupRequest use the stored UERadioCapability
2018-04-09 21:52:16 +09:00
Sukchan Lee
2a1feae83f add the log in initial_context_setup_request 2018-04-06 09:38:11 +09:00
Sukchan Lee
b1055f703a if Unknown GUTI in TAU request, MME sends TAU-reject (#42) 2018-03-27 09:42:23 +09:00
Sukchan Lee
dab5bae4ed add constraint for safety 2018-03-25 22:51:30 +09:00
Sukchan Lee
8ff9a7cf4c eNB/MME Configuration Transfer with new S1AP library 2018-03-24 10:08:55 +09:00
Sukchan Lee
82dee88309 change d_assert to d_error if target eNB is not found 2018-03-23 13:14:56 +09:00
Sukchan Lee
6ff80f4457 Apply velichkov's s1ap branch update 2018-03-22 15:55:52 +09:00
Sukchan Lee
62eed38e63 mistypo 2018-03-22 14:57:46 +09:00
Sukchan Lee
e66c8270d8 update readme 2018-03-22 14:55:03 +09:00
Sukchan Lee
ab6f48193b readme updated 2018-03-22 14:53:18 +09:00
Sukchan Lee
f3b4a9b70f Move new S1AP encoder/decoder 2018-03-22 14:12:03 +09:00
Sukchan Lee
80b14b85f0 Merge branch 's1ap' 2018-03-22 13:53:52 +09:00
Sukchan Lee
db1d139364 add debug message for s1ap(trace_level:25) 2018-03-21 21:15:01 +09:00
Sukchan Lee
03644bdb0c Release 0.3.6 2018-03-21 08:05:56 +00:00
Sukchan Lee
c944e87d5a Release 0.3.6 2018-03-21 16:49:39 +09:00
Sukchan Lee
778d23e717 Reset is done 2018-03-21 16:37:15 +09:00
Sukchan Lee
ef9d5948a8 s1 reset encoder/decoder is added 2018-03-21 16:10:20 +09:00
Sukchan Lee
13ece7f4d4 Merge branch 'master' into s1ap 2018-03-21 14:06:20 +09:00
Sukchan Lee
a9e5283db3 fix compile error trusty 32bit 2018-03-20 15:12:24 +09:00
Sukchan Lee
87b6896128 fix compile error 2018-03-18 18:50:36 +09:00
Sukchan Lee
6c692e05f5 Oops! 2018-03-16 13:29:36 +09:00
Sukchan Lee
bf6e3cdc8c change assert to warning 2018-03-16 13:13:56 +09:00
Sukchan Lee
8a2699b81f increase recv buffer size to 8192 (#35) 2018-03-15 21:54:50 +09:00
Sukchan Lee
d503fadd55 fix the testvolte 2018-03-15 17:39:41 +09:00
Sukchan Lee
463e40d41b test initial context setup failure and handover failure 2018-03-15 17:22:45 +09:00
Sukchan Lee
4b32d7f448 Merge branch 'master' into s1ap 2018-03-15 14:14:43 +09:00
Sukchan Lee
25c90c0e96 Increase SCTP recv buffer from 2048 to 4096 2018-03-15 10:50:32 +09:00
Sukchan Lee
1cd740704e update it 2018-03-14 18:12:07 +09:00
Sukchan Lee
9434c751cb merge master branch 2018-03-14 17:59:56 +09:00
Sukchan Lee
0414f19684 Merge branch 'master' into s1ap 2018-03-14 17:45:54 +09:00
Sukchan Lee
5d21ae4071 Sends ErrorIndication if S1 context has already been removed (#29) 2018-03-14 17:24:04 +09:00
Sukchan Lee
f89358dc03 add handover failure 2018-03-14 16:36:56 +09:00
Sukchan Lee
4c8123f771 ENB Status Transfer is added with s1ap_copy_ie() 2018-03-14 14:03:43 +09:00
Sukchan Lee
637d8613ba fix the 32bit S1AP problem 2018-03-14 13:40:45 +09:00
Sukchan Lee
d881f8c2ed handover test 2018-03-13 23:42:55 +09:00
Sukchan Lee
dbdd6bfdcf handover test 2018-03-13 23:16:01 +09:00
Sukchan Lee
99a8e06ccf Oops. rollback 2018-03-13 17:52:00 +09:00
Sukchan Lee
a11f6e431c S1AP handover is added. (Not tested) 2018-03-13 17:50:11 +09:00
Sukchan Lee
8e52447a53 ErrorIndication is added 2018-03-12 23:06:14 +09:00
Sukchan Lee
5172d2034a Path Switch Request is added 2018-03-12 22:47:10 +09:00
Sukchan Lee
49fba95ebb update README 2018-03-12 20:58:31 +09:00
Sukchan Lee
74834c0eb4 change s1ap asn1c to velichkov 2018-03-12 11:55:44 +00:00
Sukchan Lee
422d1c2f8f Merge branch 's1ap-brchiu' of https://github.com/acetcom/nextepc into s1ap-brchiu 2018-03-12 11:38:40 +00:00
Sukchan Lee
98a317b4b9 port linux 2018-03-12 11:38:21 +00:00
Sukchan Lee
ff3dc862b3 paging is tested 2018-03-11 21:24:26 +09:00
Sukchan Lee
9e55f1c78a Paging is added 2018-03-11 20:57:18 +09:00
Sukchan Lee
c7d24c804b E-RAB Setup/Release is added 2018-03-11 20:41:37 +09:00
Sukchan Lee
308c6f1e66 all attach test is successful 2018-03-11 16:36:51 +09:00
Sukchan Lee
6480689da4 ue context release is added 2018-03-11 14:38:35 +09:00
Sukchan Lee
2c1d70de3c new s1ap : attach done 2018-03-10 22:52:21 +09:00
Sukchan Lee
d40bf0463d continue to move new s1ap library 2018-03-10 12:21:02 +09:00
Sukchan Lee
e10d358a2b Merge branch 'master' into s1ap-brchiu 2018-03-09 21:02:17 +09:00
Sukchan Lee
bb844434f2 MME Configuration Transfer is added (#29) 2018-03-08 23:29:02 +09:00
Sukchan Lee
6c3390bf30 MME can support S1-handover without creating indirect tunnel 2018-03-07 22:32:31 +09:00
Sukchan Lee
c31dfb507d eNB Configuration Transfer is added (#29) 2018-03-07 21:53:53 +09:00
Sukchan Lee
5fad2f0e5c Release 0.3.5 2018-03-06 12:43:34 +00:00
James Park
e69cea9b5b Ignore UCS2 bit to encode UIA 2018-03-05 11:02:36 -08:00
Sukchan Lee
1c8d10a696 remove s1ap2 2018-03-05 23:33:29 +09:00
Sukchan Lee
0d073fbb73 s1setup encoder is implemented 2018-03-05 23:32:14 +09:00
Sukchan Lee
c5689b3f66 update it 2018-03-05 23:01:07 +09:00
Sukchan Lee
0c9b034f12 move s1ap3 to s1ap 2018-03-05 22:17:22 +09:00
Sukchan Lee
16b69865ac remove s1ap 2018-03-05 22:14:38 +09:00
Sukchan Lee
fa981b8028 update it 2018-03-04 23:34:40 +09:00
Sukchan Lee
0628b76296 update it 2018-03-04 23:23:35 +09:00
Sukchan Lee
0d8928ff05 re-add s1ap 2018-03-04 16:30:03 +09:00
Sukchan Lee
da04290a62 encoder/decoder sample code is added 2018-03-04 13:35:06 +09:00
Sukchan Lee
6f9e45a332 Modify the security capability length (#27)
If octet 5 is included, then also octet 6 shall be included and octet 7
may be included.
2018-03-03 14:18:33 +09:00
Sukchan Lee
9357381839 Fix the bug of secuirty capability in security command (#27) 2018-03-03 14:10:24 +09:00
Sukchan Lee
8ab602e6d2 update it 2018-02-27 18:35:57 +09:00
Sukchan Lee
84e7f50b3f update test code (#22) 2018-02-27 12:01:01 +09:00
Sukchan Lee
2bc92c5ac8 fix the indentation
* VIM
set sw=4
set ts=4
set expandtab

* Limited with 80 Column
2018-02-27 11:59:08 +09:00
Sukchan Lee
2429a4e363 fix the presentmask and change default configuration (#22) 2018-02-27 11:56:10 +09:00
Sukchan Lee
dab0f3ef3a Merge pull request #22 from medeiros405/master 2018-02-27 11:08:55 +09:00
medeiros405
144548f4c0 src/mme/emm_handler.c 2018-02-26 13:48:26 -03:00
medeiros405
1f44efbc3d src/mme/emm_handler.c 2018-02-26 13:46:28 -03:00
Sukchan Lee
6df88862f9 mistypo 2018-02-26 22:36:51 +09:00
Sukchan Lee
f49a66dfc5 script update 2018-02-26 14:59:51 +09:00
Sukchan Lee
7e8718e346 update it 2018-02-26 11:57:49 +09:00
medeiros405
02712a38e6 src/mme/emm_handler.c
src/mme/mme_context.c
src/mme/mme_context.h
support/config/mme.conf.in
2018-02-25 18:33:36 -03:00
Sukchan Lee
888cbfbdb8 S1-reset encoder/decoder is added 2018-02-22 22:52:59 +09:00
Sukchan Lee
cdf7fb94bf S1-Setup failure is added 2018-02-22 22:23:16 +09:00
Sukchan Lee
e4989c7aa3 fix the README.md 2018-02-22 11:27:38 +09:00
Sukchan Lee
5365893c34 Release 0.3.4 2018-02-22 02:17:11 +00:00
Sukchan Lee
3c65414135 Release 0.3.4 2018-02-22 02:14:31 +00:00
Sukchan Lee
80bcfcf646 Release 0.3.4 2018-02-22 02:10:52 +00:00
Sukchan Lee
7e460fbcb4 dput is added 2018-02-22 10:47:21 +09:00
Sukchan Lee
62fe796d41 fix check.sh 2018-02-22 09:51:38 +09:00
Sukchan Lee
0104543f7d add manpage for dev 2018-02-22 00:48:42 +09:00
Sukchan Lee
39c30cb908 fix it 2018-02-22 00:32:11 +09:00
Sukchan Lee
c09b272e53 fix the base image for docker-dev 2018-02-22 00:30:28 +09:00
Sukchan Lee
92d8bde84a change dependency docker-dev 2018-02-22 00:18:31 +09:00
Sukchan Lee
e2bb5706fa update Dockerfile 2018-02-21 23:55:44 +09:00
Sukchan Lee
d74afc5bc7 for old version gcc compiler, we fix the size of child_desc in TLV message library 2018-02-21 14:48:41 +00:00
Sukchan Lee
c8a65b6b18 add other OS for docker 2018-02-21 23:20:48 +09:00
Sukchan Lee
f5582c97b5 NULL-pointer sgw_ue context is accessed (#18) 2018-02-21 17:29:47 +09:00
Sukchan Lee
b8cc130bf5 update check.sh 2018-02-21 14:35:46 +09:00
Sukchan Lee
12d65e92d1 re-arrange package between base and dev 2018-02-21 14:11:41 +09:00
Sukchan Lee
2904284405 Dockerfile cache invalidating for nextepc build 2018-02-21 13:16:11 +09:00
Sukchan Lee
f1b0cd5748 Merge branch 'master' of https://github.com/acetcom/nextepc 2018-02-21 12:35:19 +09:00
Sukchan Lee
91c9586561 update docker configuration 2018-02-21 12:35:05 +09:00
Sukchan Lee
05cfcf4cc3 Override configuration if DB_URI environment variable is existed 2018-02-21 03:25:48 +00:00
Sukchan Lee
c827701824 update it 2018-02-20 23:57:06 +09:00
Sukchan Lee
5fcc7e2ee6 runtime is testedwq 2018-02-20 23:49:24 +09:00
Sukchan Lee
bd1dff2dc5 missing files 2018-02-20 22:47:56 +09:00
Sukchan Lee
f1ad0b11ae change network configuration for docker 2018-02-20 22:29:46 +09:00
Sukchan Lee
9a86d4cb7c Initial Proposal for Docker (#16) 2018-02-20 19:36:34 +09:00
Sukchan Lee
38cccb8a85 move new directory 2018-02-17 15:15:17 +09:00
Sukchan Lee
2d72eaa24d Docker for MongoDB and WebUI recommended by Issue (#16) 2018-02-17 14:47:06 +09:00
Sukchan Lee
f915820f3a network script update for linux 2018-02-15 16:59:27 +09:00
Sukchan Lee
1009ac5e47 add masquerading for Mac OS X 2018-02-14 20:09:04 +09:00
Sukchan Lee
536138457e fix the warning for Mac OS X 2018-02-14 10:22:36 +09:00
Sukchan Lee
730053cef4 update README.md 2018-02-14 10:07:20 +09:00
Sukchan Lee
4a01623d6e update README.md 2018-02-14 00:34:14 +09:00
Sukchan Lee
0cf0e73bf9 update README.md 2018-02-14 00:33:18 +09:00
Sukchan Lee
87e7992450 update docker README.md 2018-02-14 00:29:22 +09:00
Sukchan Lee
75aaf632b8 Dockerfile updated 2018-02-13 23:48:44 +09:00
Sukchan Lee
5c3c99acda update Dockerfile for including Web User Interface 2018-02-13 17:16:17 +09:00
Sukchan Lee
081170a86e add template Dockerfile for NextEPC 2018-02-13 16:15:11 +09:00
Sukchan Lee
c9b4a20223 Release v0.3.3 2018-02-13 04:50:34 +00:00
Sukchan Lee
926e73e87d We use deb-systemd-invoke instead of systemdctl (#16) 2018-02-13 03:38:33 +00:00
Sukchan Lee
61f796d341 update README.md 2018-02-12 22:11:27 +09:00
Sukchan Lee
03715c84be update README.md 2018-02-12 21:47:36 +09:00
Sukchan Lee
72d28286ea update README.md 2018-02-12 21:23:12 +09:00
Sukchan Lee
c2d68cf4b6 update it 2018-02-12 16:43:05 +09:00
Sukchan Lee
e99f6c7789 update README 2018-02-12 08:48:05 +09:00
Sukchan Lee
340b3cb69c Release v0.3.3 Update 2018-02-11 16:10:22 +00:00
Sukchan Lee
5d8231e6c2 Relase v0.3.3 2018-02-11 23:43:55 +09:00
Sukchan Lee
1e5313c230 fix the compile error in CentOS 2018-02-11 12:07:09 +00:00
Sukchan Lee
d488bc3ed7 fix the conflict between PDN disconnect and Detach Request 2018-02-10 23:59:03 +09:00
Sukchan Lee
0de9185545 change debug level 2018-02-10 17:08:51 +09:00
Sukchan Lee
9563e49f48 update nextepc-pgwd.service for systemd-networkd (#16) 2018-02-10 06:53:38 +00:00
Sukchan Lee
881196cde2 Debian package update for docker issue (#16)
* Previously, pgwtun is setup with ifupdown package.
* Now, we'll use the systemd-networkd.
2018-02-10 11:15:39 +09:00
Sukchan Lee
c096cce571 update print-out 2018-02-09 23:14:30 +09:00
Sukchan Lee
3c33206dee update comment 2018-02-09 16:43:28 +09:00
Sukchan Lee
382c52a481 clear sgw s1u path if delete session response is received 2018-02-09 16:26:55 +09:00
Sukchan Lee
f904b63053 Authentication failure should be handled based on EMM_CAUSE(#17)
* Synch failure(EMM_CAUSE:21)
  - Re-authorization. Send authentication request again.

* MAC failure(EMM_CAUSE:20)
  - Send Authentication Reject
  - Send UE Context Release Command

* Non-EPS authentication failure(EMM_CAUSE:26)
  - Send Authentication Reject
  - Send UE Context Release Command

* Others
  - Send Authentication Reject
  - Send UE Context Release Command
2018-02-07 14:12:40 +09:00
Sukchan Lee
7769ded65a remove installcheck 2018-02-06 03:45:08 +00:00
Sukchan Lee
0170166b6b update docker manual 2018-02-06 12:32:39 +09:00
Sukchan Lee
935e81f9c9 test directory re-factor 2018-02-06 12:18:11 +09:00
Sukchan Lee
9fbcb45171 testsuite is added. (refer to libosmocom) 2018-02-06 11:59:49 +09:00
Sukchan Lee
c9596d82f7 add cleanfiles 2018-02-05 14:29:13 +00:00
Sukchan Lee
598b711c01 make check is added. 2018-02-05 23:21:37 +09:00
Sukchan Lee
f9096d55f5 for make check, sample configuration is added 2018-02-05 22:45:14 +09:00
Sukchan Lee
0e87056e2e share common files for test programs 2018-02-05 20:57:06 +09:00
Sukchan Lee
ad10c84ffe volte test configuration is updated 2018-02-05 17:26:20 +09:00
Sukchan Lee
7b99cc7d7c Changes default IP configuration (#14)
* NextEPC will not use 127.0.0.1 address for Diameter and GTP-U

* MME
  S1AP: Auto-Detect
  GTP-C: Auto-Detect
  DIAMETER: 127.0.0.2

* SGW
  GTP-C: 127.0.0.2
  GTP-U: Auto-Detect

* PGW
  GTP-C: Both 127.0.0.3 and [::1]
  GTP-U: Both 127.0.0.3 and [::1]
  DIAMETER: 127.0.0.3

* HSS
  DIAMETER: 127.0.0.4

* PCRF
  DIAMETER: 127.0.0.5
2018-02-05 08:08:41 +00:00
Sukchan Lee
75cc9bbb47 update bearer context status in tracking area update 2018-02-04 23:48:49 +09:00
Sukchan Lee
3a57990cbc T3402 is redundant. Remove it in Attach/TAU Accept 2018-02-04 23:41:44 +09:00
Sukchan Lee
14ef938fb9 SGW sends End Marker if GTP Node changes. Previously, ULI's cell ID 2018-02-04 23:15:20 +09:00
Sukchan Lee
5c1a3d54e3 rename it 2018-02-04 17:05:30 +09:00
Sukchan Lee
2defa5c868 add simualtor for the active flag 2018-02-04 16:58:56 +09:00
Sukchan Lee
4371084af4 Tracking Area Update with considering Initial UE message and active flag 2018-02-04 16:01:09 +09:00
Sukchan Lee
c0d4f25717 tracking area update request's active flag 2018-02-04 13:12:26 +09:00
Sukchan Lee
aacaa83eea rollback paging check routine 2018-02-03 23:44:04 +09:00
Sukchan Lee
de04e1de45 introduce ECM_IDLE and ECM_CONNECTED 2018-02-03 23:23:50 +09:00
Sukchan Lee
95551de5f9 tracking area update is handling based on UE ECM status 2018-02-03 22:55:05 +09:00
Sukchan Lee
bb4339de2a rename it 2018-02-03 18:29:32 +09:00
Sukchan Lee
831b3e8985 Error Indication is added 2018-02-03 11:48:15 +09:00
Sukchan Lee
f37b3cbfd3 rollback it 2018-02-03 09:18:22 +09:00
Sukchan Lee
23998862f2 update it 2018-02-03 08:49:46 +09:00
Sukchan Lee
e72d79a328 rollback it 2018-02-03 04:18:31 +09:00
Sukchan Lee
66d16ae1bb update it 2018-02-03 03:44:14 +09:00
Sukchan Lee
00178ff65e fix the bug in X2 handover TAI/E_CGI 2018-02-03 02:08:43 +09:00
Sukchan Lee
582c771605 fix the bug : TAU after S1 Handover 2018-02-03 02:00:38 +09:00
Sukchan Lee
52a1e05f41 change warn to trace level 5 2018-02-02 23:36:03 +09:00
Sukchan Lee
c293bef05a add IP address log if No TEID 2018-02-02 21:29:02 +09:00
Sukchan Lee
ebddb2ad9f rename it 2018-02-02 21:09:37 +09:00
Sukchan Lee
7c2dd5e462 add simulator for S1 holding timer 2018-02-02 20:32:13 +09:00
Sukchan Lee
f61233e627 update it 2018-02-02 19:59:26 +09:00
Sukchan Lee
b97597ae7c change S1 release scheme with holding timer(30sec) 2018-02-02 19:37:36 +09:00
Sukchan Lee
57f3baa273 UE-initiated detach_request is handled in every EMM-state 2018-02-02 15:59:21 +09:00
Sukchan Lee
d944bca038 context(tai, e_cgi) transfer during S1-handover 2018-02-02 15:30:25 +09:00
Sukchan Lee
857a250e4f add to trace for testing tracking area update 2018-02-02 13:46:49 +09:00
Sukchan Lee
34986be707 rollback implicit S1 release 2018-02-02 04:26:01 +09:00
Sukchan Lee
cb7132a2fa fix the bug 2018-02-02 04:20:02 +09:00
Sukchan Lee
5397cfd2d8 Send UE Context Release Command instead of Implicit S1 release 2018-02-02 02:48:55 +09:00
Sukchan Lee
0cd0221b29 rollback conflict between service request and downlink notification 2018-02-01 23:21:20 +09:00
Sukchan Lee
8bd186adad tracking area update accept with ue context release command 2018-02-01 23:06:35 +09:00
Sukchan Lee
4e5d156a6a ECM-IDLE/CONNECTED state is added in MME Context Library 2018-02-01 22:48:59 +09:00
Sukchan Lee
c9e44579d8 refine code 2018-02-01 21:38:59 +09:00
Sukchan Lee
4648dc05d5 log update 2018-02-01 16:54:52 +09:00
Sukchan Lee
ca79c05fe6 Update TAU Accept & Initial Context Setup Failure 2018-02-01 16:39:42 +09:00
Sukchan Lee
b040214364 add U-plane TEID trace log 2018-02-01 14:07:01 +09:00
Sukchan Lee
c3afd65ff3 fix the bug for FSM library 2018-02-01 11:56:01 +09:00
Sukchan Lee
f4baa62209 explicit S1 release for initial contexgt setup failure 2018-01-31 06:24:23 +00:00
Sukchan Lee
03cf945f95 fix the memroy leak in SGW Downlink Notification Ack 2018-01-31 15:01:13 +09:00
Sukchan Lee
01d7f157ff modify release access bearer regardless ue context release request's cause 2018-01-31 12:54:59 +09:00
Sukchan Lee
e49e1d2331 Use explict S1 release for initial context setup failure 2018-01-30 22:14:12 +09:00
Sukchan Lee
67393d0160 Implicit S1 Release immediately if Older S1 context is found. 2018-01-30 22:10:28 +09:00
Sukchan Lee
7ca9ead4b9 refine code 2018-01-30 21:57:19 +09:00
Sukchan Lee
3f7c3d3041 Prevent GUTI re-allocation for every attach_request 2018-01-30 07:25:42 +09:00
Sukchan Lee
cf6df20ad7 refine code 2018-01-29 13:44:25 +00:00
Sukchan Lee
b77c9b8ff6 refine code 2018-01-29 22:38:53 +09:00
Sukchan Lee
795ecc8cf8 Implicit S1 Release 2018-01-29 19:10:54 +09:00
Sukchan Lee
b704e94efa fix the memory leak t3413 paging timer in MME_UE Context 2018-01-29 16:47:07 +09:00
Sukchan Lee
ae6e747e52 ECM_IDLE/CONNECTED is introduced 2018-01-29 14:48:51 +09:00
Sukchan Lee
60cfbed747 Update state machine 2018-01-28 22:08:53 +09:00
Sukchan Lee
597fcfbad9 rollback implict S1 release 2018-01-28 16:13:48 +09:00
Sukchan Lee
762431cb6f GUTI is suppressed in Attach accept if GUTI is not changed. 2018-01-28 15:32:45 +09:00
Sukchan Lee
21a130bc16 Implicitly S1 release without sending UE context release command 2018-01-28 15:08:52 +09:00
Sukchan Lee
5774aeb62d Change Cause value in UE Context Release Command 2018-01-28 14:11:17 +09:00
Sukchan Lee
7b2355a40f MME_UE Context is not deleted even thought Detach Request(switch-off case) 2018-01-28 13:50:21 +09:00
Sukchan Lee
28237ea6af clean security context if KSI is INVALID(7) 2018-01-26 09:08:50 +09:00
Sukchan Lee
09969e859d update log 2018-01-26 07:10:41 +09:00
Sukchan Lee
9451928786 remove INVALID ASSERT in SGW 2018-01-26 06:52:30 +09:00
Sukchan Lee
c6bfed6628 Debian Release 0.3.2 2018-01-24 08:12:43 +00:00
Sukchan Lee
20efdd5639 update the GTP TLV trace 2018-01-24 14:17:24 +09:00
Sukchan Lee
dfb9755295 update data plane trace 2018-01-24 02:59:23 +00:00
Sukchan Lee
6272d170e0 Merge branch 'master' of https://github.com/acetcom/nextepc 2018-01-24 02:55:14 +00:00
Sukchan Lee
e31976e505 fix the linux compile error 2018-01-24 02:54:56 +00:00
Sukchan Lee
4c98dae79e fix the bug indirect tunnel 2018-01-24 11:54:04 +09:00
Sukchan Lee
94145fec62 fix the bug for finding indirect tunnel 2018-01-24 11:32:46 +09:00
Sukchan Lee
bba98cf066 s1ap_encoder/s1ap_decoder module use d_trace() instead of printf() 2018-01-24 10:17:50 +09:00
Sukchan Lee
9503c8efdc chage debug buffer size to HUGE_STRING_LEN(8192) for avoiding buffer overflow 2018-01-24 10:08:59 +09:00
Sukchan Lee
f5f4e42be9 update ATTACH_ACCEPT message for solving the problem of EMM_STATUS 2018-01-24 00:03:44 +09:00
Sukchan Lee
afafce6760 update gitignore 2018-01-23 20:20:19 +09:00
Sukchan Lee
49cfb51a65 fix the open-ims test configuration 2018-01-23 17:54:25 +09:00
Sukchan Lee
02a11b6c50 Oops! check the trace level 2018-01-23 08:52:10 +00:00
Sukchan Lee
859322cb22 fix the freediameter logger from d_trace() to printf() 2018-01-23 08:49:33 +00:00
Sukchan Lee
b1c61cfcbf state name changes detached/attached -> de_registered/registered 2018-01-23 17:18:18 +09:00
Sukchan Lee
ed92c30b26 adjust trace_level 2018-01-23 17:11:21 +09:00
Sukchan Lee
610292fb5c dp log added 2018-01-23 16:48:40 +09:00
Sukchan Lee
66d71924ce update trace level 2018-01-23 16:10:46 +09:00
Sukchan Lee
b37a74416a trace name gtp -> gtpv2, others -> app 2018-01-23 16:02:35 +09:00
Sukchan Lee
35a95fd4ac update trace level 2018-01-23 15:38:07 +09:00
Sukchan Lee
d66e25dda3 refine tun error log 2018-01-23 14:36:52 +09:00
Sukchan Lee
6850e3b2a3 update log 2018-01-22 15:12:36 +00:00
Sukchan Lee
225e1ba07f refine GTP/Diameter Log 2018-01-23 00:00:57 +09:00
Sukchan Lee
67870af84f update trace log for S1AP/NAS 2018-01-22 23:14:20 +09:00
Sukchan Lee
17cbd61552 add emm_state_exception if identity response cannot find IMSI 2018-01-22 17:08:53 +09:00
Sukchan Lee
ebd8d2f571 update state machin 2018-01-22 16:53:47 +09:00
Sukchan Lee
7d43bd870e refine attached/detached state handler 2018-01-22 16:35:12 +09:00
Sukchan Lee
f94553bc8a update state machine 2018-01-22 12:24:18 +09:00
Sukchan Lee
6e6eb7a355 refine code 2018-01-22 11:40:26 +09:00
Sukchan Lee
b678d9e9a2 change the log level for conflict M-TMSI 2018-01-21 22:46:48 +09:00
Sukchan Lee
4c8e2add2f fix the bug M-TMSI generator 2018-01-21 22:36:49 +09:00
Sukchan Lee
8557d50341 rename hss_kdf -> hss_auc 2018-01-21 20:46:02 +09:00
Sukchan Lee
e785d4ca4e refine S1ap_Cause related source code 2018-01-21 20:31:28 +09:00
Sukchan Lee
32d62805df changes trace level 2018-01-21 17:40:06 +09:00
Sukchan Lee
4eb314d781 In emm_state_attached state, if NAS MAC is failed, service reject is sent out 2018-01-21 17:36:59 +09:00
Sukchan Lee
1d947c5698 M-TMSI is generated by Random Number for protecting security attach 2018-01-21 16:53:39 +09:00
Sukchan Lee
05f631f0ac change service_request test packet 2018-01-21 15:44:30 +09:00
Sukchan Lee
9b9bfdc0b0 add head logger for indicating configuration file path 2018-01-21 11:21:56 +09:00
Sukchan Lee
f93d367eee update EMM state machine 2018-01-20 15:09:30 +09:00
Sukchan Lee
6bcd72cf45 update state machine 2018-01-20 12:42:58 +09:00
Sukchan Lee
2a6102d207 fix the bug 2018-01-20 12:16:08 +09:00
Sukchan Lee
734ac953a7 Oops! remove comment out 2018-01-20 09:57:24 +09:00
Sukchan Lee
56dd6b6a28 fix the memory leak when SGW cannot find tunnel 2018-01-20 09:35:03 +09:00
Sukchan Lee
3be652701e update EMM state machine 2018-01-20 08:52:59 +09:00
Sukchan Lee
862571c8ed rollback state machine 2018-01-20 04:29:58 +09:00
Sukchan Lee
907c3f2f3c rollback previous commit 2018-01-20 04:07:20 +09:00
Sukchan Lee
baf273c06e add simulator for verifying NAS MAC 2018-01-20 03:11:20 +09:00
Sukchan Lee
cb50821aa8 if TAU_REQUEST is received, update keNB. 2018-01-19 22:21:06 +09:00
Sukchan Lee
1830b0bc75 add authentication failure exception 2018-01-19 17:43:46 +09:00
Sukchan Lee
d02763dde5 security mode reject is added 2018-01-19 17:30:18 +09:00
Sukchan Lee
ee0d7fe7d8 add error handling if ue context release request is radio network 2018-01-19 17:00:37 +09:00
Sukchan Lee
e4c189fec2 if TAU_REJECT or SERVICE_REJECT, MME UE Context is removed. 2018-01-19 16:29:21 +09:00
Sukchan Lee
2701add779 if EMM_STATUS is received, EMM state will be recovered to an initial state 2018-01-19 15:37:25 +09:00
Sukchan Lee
9b8eef2545 rollback previous commit 2018-01-19 14:03:27 +09:00
Sukchan Lee
52c6504c65 for test..disable NAS MAC check 2018-01-19 04:49:41 +09:00
Sukchan Lee
f35aa2178f fix the abort-cause value 2018-01-19 01:32:01 +09:00
Sukchan Lee
46f85d9fc8 Volte QoS is basically derived by IMS instead of EPC.
If the QoS informaton is provided from IMS, we'll use WEBUI QoS value
2018-01-19 01:23:13 +09:00
Sukchan Lee
131babeddc Turn off IPv6 in default setting. But UE network can support both IPv4 and IPv6 2018-01-18 10:21:13 +09:00
Sukchan Lee
6acdff21bb fix the bug for initial context setup failiure 2018-01-18 10:04:55 +09:00
Sukchan Lee
e0504dcf12 check enb_ue context before paging message is sent out 2018-01-18 08:36:56 +09:00
Sukchan Lee
95708a6ce4 fix the memory leak 2018-01-18 08:03:37 +09:00
Sukchan Lee
c9b4a1023b add missing files 2018-01-17 14:13:19 +00:00
Sukchan Lee
8025f10586 diameter log level is fixed 2018-01-17 23:08:20 +09:00
Sukchan Lee
e2f1872ea7 loglevel is adjusted 2018-01-17 22:55:52 +09:00
Sukchan Lee
8ae6f82aee fix linux compile error 2018-01-17 13:37:11 +00:00
Sukchan Lee
2620a4bd44 missing files 2018-01-17 22:35:35 +09:00
Sukchan Lee
3334afe891 refine it 2018-01-17 22:26:48 +09:00
Sukchan Lee
ab4c8f3e9e test code name changes from testrx to testvolte 2018-01-17 22:16:47 +09:00
Sukchan Lee
c56f75299c if WEBUI activates state dedicated bearer, modify bearer will be initiated 2018-01-17 21:47:59 +09:00
Sukchan Lee
8537aaee1b ASR/ASA is done 2018-01-17 21:22:30 +09:00
Sukchan Lee
d13b735d26 rx_sess_data is changed to list structure 2018-01-17 20:31:49 +09:00
Sukchan Lee
3662ad423e add simulation code for testing LTE disconnect during Voice Call 2018-01-17 17:17:22 +09:00
Sukchan Lee
d8f23bed1a mme_ue_remove() if detach request is switch-off 2018-01-17 16:53:49 +09:00
Sukchan Lee
131fb3ac79 modify dedicated bearer is done 2018-01-17 16:01:11 +09:00
Sukchan Lee
fffd654391 NAS modify bearer request/accept is done 2018-01-17 15:41:45 +09:00
Sukchan Lee
c12e76e32d Update Bearer Request is added in PGW 2018-01-17 13:49:08 +09:00
Sukchan Lee
f1e41050c3 re-factoring Gx/Rx diameter to apply modification 2018-01-17 12:41:57 +09:00
Sukchan Lee
4acc21093b add time information to the d_trace() 2018-01-17 10:09:06 +09:00
James Park
543753d0d1 Merge branch 'master' of https://github.com/acetcom/cellwire 2018-01-16 16:33:46 -08:00
James Park
2bb9446fa2 Fix bug: Wrong assignment of teid 2018-01-16 16:33:06 -08:00
Sukchan Lee
73a352657d print raw packet if S1AP decoder is failed 2018-01-17 08:52:58 +09:00
Sukchan Lee
47407e4855 deactivate dedicated bearer is done 2018-01-16 22:14:59 +09:00
Sukchan Lee
60b59babe0 deactivate bearer context request is added 2018-01-16 20:49:39 +09:00
Sukchan Lee
733f598f24 PCC Rule Remove is added in RAR/RAA 2018-01-16 16:11:30 +09:00
Sukchan Lee
521b18ea2a STR/STA is added 2018-01-15 17:25:14 +09:00
Sukchan Lee
5457e4042e suppport P-CSCF session state maintained mode 2018-01-15 14:57:39 +09:00
Sukchan Lee
4b0565c2e9 refine code 2018-01-15 12:52:05 +09:00
Sukchan Lee
d1303a60e4 refine code 2018-01-15 11:54:22 +09:00
Sukchan Lee
257d58d999 Add Detach Request Log 2018-01-14 23:02:16 +09:00
Sukchan Lee
059a71822c P-CSCF simulator is done(Only Call Initiating). Later we will implement 'Call Terminating' 2018-01-14 22:49:29 +09:00
Sukchan Lee
d77be669a9 update it 2018-01-14 22:02:37 +09:00
Sukchan Lee
c1848e03a1 update it 2018-01-14 21:31:16 +09:00
Sukchan Lee
ee770398c2 RAR/RAA is mostly done 2018-01-14 19:54:50 +09:00
Sukchan Lee
11b4463ce4 continue to implement RAR 2018-01-14 18:15:38 +09:00
Sukchan Lee
4b1c4b598b Gx/Rx interface is changed 2018-01-14 13:51:35 +09:00
Sukchan Lee
2884430c57 remove Specific-Action/Abort-Cause in Gx message 2018-01-14 13:00:41 +09:00
Sukchan Lee
853913b31d fix the bug for initial context setup failure 2018-01-13 23:06:21 +09:00
Sukchan Lee
8c3d4ca0de core_free -> CORE_FREE. We need to know which function raise this
exception
2018-01-13 22:03:30 +09:00
Sukchan Lee
63562dd63a add log message 2018-01-13 21:19:43 +09:00
Sukchan Lee
4417578210 RS/RA bug is fixed.
RA dst IP address is dervied from RA's src IP address
RA prefix address is used subnet address instead of UE IPv6 address
2018-01-13 14:15:00 +09:00
Sukchan Lee
694c39c69e fix the bug related UE context release request(transport error) 2018-01-12 08:54:58 +09:00
Sukchan Lee
9675c3bf8c initiate GTP delete session request if EPC received initial context setup failure 2018-01-12 08:32:33 +09:00
Sukchan Lee
8753879a93 Oops! remove unneeded code 2018-01-12 08:29:25 +09:00
Sukchan Lee
f41559c55f fix the bug releated the handler for UE context release request(transport:1) 2018-01-12 08:25:30 +09:00
Sukchan Lee
7e2488035e update .gitignore 2018-01-11 23:25:36 +09:00
Sukchan Lee
b424213768 add ErrorIndication(Proceduer ID : 15, initiating message) decoder 2018-01-11 22:33:36 +09:00
Sukchan Lee
3503fda431 clarify attach/tau/service reject interface 2018-01-11 22:25:35 +09:00
Sukchan Lee
47dc5eec38 change UE context release command/complete interface.
- Before : Based on EMM state, we decided call mme_ue_remove() or not
- After : Explictly, user should set about calling the mme_ue_remove().
2018-01-11 22:12:48 +09:00
Sukchan Lee
1498f6c015 GTP ECHO-REQ/RSP log level chaged to 5 2018-01-11 14:39:12 +09:00
Sukchan Lee
7a771173bc refine log 2018-01-11 14:06:02 +09:00
Sukchan Lee
9ec0867941 log refine for GTP 2018-01-11 13:42:33 +09:00
Sukchan Lee
f360d20f01 PCRF(RAR) message is done 2018-01-10 23:41:56 +09:00
Sukchan Lee
2059341d4f Diameter Gx Code Refine 2018-01-10 22:09:08 +09:00
Sukchan Lee
58f501d397 For IMS, WebUI behavior is changed.
If Flow is not added in PCC_Rule, this PCC_Rule will not be installed in PGW.
In this case, AF function will give the Flow Description.
If Rx(Media-Type) is set to "AUDIO" type, PCC_Rule(QCI=1) will be associated,
And then, the PCC_Rule will be installed in PGW
2018-01-10 21:44:23 +09:00
Sukchan Lee
95aaf2f8f1 AAR is done 2018-01-10 19:56:10 +09:00
Sukchan Lee
e24856eb0e GX RAR/RAA(PGW-PCRF) is added 2018-01-10 16:06:19 +09:00
Sukchan Lee
e7c14242c7 Merge branch 'master' of https://github.com/acetcom/nextepc 2018-01-10 14:15:17 +09:00
Sukchan Lee
0a490cf819 MME/HSS diameter code refine 2018-01-10 14:15:00 +09:00
Sukchan Lee
b25082cb06 PGW/PCRF diameter code refine 2018-01-10 12:45:58 +09:00
James Park
81a957172b Merge branch 'master' of https://github.com/acetcom/cellwire 2018-01-09 18:09:08 -08:00
James Park
a5057c1488 Change the number of cluster 2018-01-09 18:08:33 -08:00
Sukchan Lee
60b82c75e6 fix linux compile error 2018-01-09 14:11:21 +00:00
Sukchan Lee
1f0452d37d add RAR handler in PGW 2018-01-09 23:06:48 +09:00
Sukchan Lee
e9da026495 PCRF RX/GX session association 2018-01-09 22:53:09 +09:00
Sukchan Lee
b99c266533 P-CSCF simulator adds Frame-IP-Address and Frame-IPv6-Prefix.
This is used to test PCRF Rx/Gx dimaeter session assoication
2018-01-09 21:25:52 +09:00
Sukchan Lee
b80b295af4 if eNB initiated UE Context Release Request with Transport Error, MME sends NAS UE Context Release Command with NAS detach cause 2018-01-09 18:02:56 +09:00
Sukchan Lee
a15b60024b ignore delete session in UEContextReleaseComplete
if MME re-started, there is no MME_UE context. In this case, we ignore
delete sessoin process in UEContextReleaseComplete
2018-01-09 17:38:06 +09:00
Sukchan Lee
1a9ba2680b change assert to warning when PGW cannot find subnet 2018-01-09 17:04:10 +09:00
Sukchan Lee
06a4a09d08 gtp code refine 2018-01-09 16:37:05 +09:00
Sukchan Lee
20f45a455e name changes for gtp_connect_to_node to gtp_add_node_with_teid 2018-01-09 15:25:49 +09:00
James Park
2406bf8d19 Fix bug : wrong assigment of gtp length in header 2018-01-08 20:14:59 -08:00
Sukchan Lee
13a06479a9 add hash for associating Gx/Rx interface by
Framed-IP-Address/Framed-IPv6-Address
2018-01-08 22:42:44 +09:00
Sukchan Lee
38e245d467 PCRF session state is added 2018-01-08 21:20:19 +09:00
Sukchan Lee
e4397176cf support pcrf gx session maintained mode 2018-01-08 20:09:13 +09:00
Sukchan Lee
779d5e88d0 PCRF freeDiameter module disunite to Gx module and Rx module 2018-01-08 18:34:51 +09:00
Sukchan Lee
e95dcf192d refine pgw freeDiameter code 2018-01-08 09:54:19 +09:00
Sukchan Lee
69a880b5fe support session state maintained mode in PGW freeDiameter 2018-01-07 21:56:44 +09:00
Sukchan Lee
64268232b1 Session-Id diameter encoder is added 2018-01-07 21:29:53 +09:00
Sukchan Lee
5ca708deab fix the bug for diameter session memory management 2018-01-07 15:26:17 +09:00
Sukchan Lee
7e63ab488d fix the gcc 7.2.0 compile warning 2018-01-06 22:50:56 +09:00
Sukchan Lee
229a56f85d for debugging subnet assert, add packet log in this situation 2018-01-06 14:25:05 +09:00
Sukchan Lee
d2e54482c1 Update S1P ASN for GUMMEIType in InitialUEMessage 2018-01-06 12:36:47 +09:00
Sukchan Lee
5a96013bf8 Merge branch 'master' of https://github.com/acetcom/nextepc 2018-01-06 01:00:15 +00:00
Sukchan Lee
8e8d0c2978 add assert log 2018-01-06 00:59:42 +00:00
Jihoon Brandon Lee
a13f21b115 bugfix on length check of GTP echo 2018-01-05 12:44:43 -07:00
Sukchan Lee
09eceddd97 fix compile error in linux 2018-01-05 15:30:59 +00:00
Sukchan Lee
a630830f0c P-CSCF simualtor is mostly done 2018-01-06 00:23:26 +09:00
Sukchan Lee
cd45d6d2c5 remove AA-Request/Answer in PGW. All P-CSCF stuff is moving to testrx 2018-01-05 23:59:14 +09:00
Sukchan Lee
f717eeb3ae P-CSCF diameter module is added 2018-01-05 23:49:55 +09:00
Sukchan Lee
9e8ced5835 Apply new freeDiameter configuration to all other daemon(HSS, PGW, PCRF) 2018-01-05 23:31:30 +09:00
Sukchan Lee
f945b483e8 MME freeDiameter configuration is done 2018-01-05 23:03:41 +09:00
Sukchan Lee
b166adf3bd fix the memory leak in the fd_config 2018-01-05 22:46:02 +09:00
Sukchan Lee
9cca50b7c7 missing files 2018-01-05 17:01:28 +09:00
Sukchan Lee
add2145851 freeDiameter Config Re-factoring!
For P-CSCF simulation, it is not good if freeDiameter configuartion is
needed. As such, we merged this configuration is in the nextepc
configuration.
2018-01-05 16:25:02 +09:00
Sukchan Lee
65e1a8dbac fix the linux compile warning 2018-01-04 13:10:06 +00:00
Sukchan Lee
b0b7e9f167 add missing files 2018-01-04 22:08:32 +09:00
Sukchan Lee
9d14f5e89d fix the bug the unlimited loop.
if the system is not supported SCTP, mme daemon is to be unlimited loop.
2018-01-04 22:03:59 +09:00
Sukchan Lee
9675c47a10 improve testrx code 2018-01-04 21:22:21 +09:00
Sukchan Lee
627077247c Diameter Rx Test Simualtor is initially implemented. 2018-01-04 20:52:19 +09:00
Sukchan Lee
b8ef9e9e2a Header Refactoring 2018-01-04 20:38:22 +09:00
Sukchan Lee
fe1c368577 move 3gpp_test to core library 2018-01-04 18:02:56 +09:00
Sukchan Lee
1a3f5cf86e add AA Request/Answer Sample code 2018-01-04 12:57:00 +09:00
Sukchan Lee
560204ab46 Router Advertisement Destination IP address changes
from ff::1 to UE IP Address(e.g. cafe::2)
2018-01-04 08:51:07 +09:00
Sukchan Lee
e4bec187fd add Diameter Rx Interface (PCRF - P-CSCF) 2018-01-03 21:45:14 +09:00
Sukchan Lee
9544a79c2c P-CSCF IP address configuration is added in PGW 2018-01-03 15:29:48 +09:00
Sukchan Lee
81be4cca66 PGW dimaeter IP address is changed from 127.0.0.1 to 127.0.0.2
127.0.0.1:3868 could be used by other software. So, we will change the
IP address.
2018-01-03 09:28:23 +09:00
Sukchan Lee
4501a76d96 UE Time Zone is added in Create Session Request(GTP) and CCR(Gx)
I'm not sure where this value should be configured.
At this point, MME estimate UE Time Zone from MME's system.
From this, MME generates UE TIme Zone for Create Session Request.
PGW is just forward this value to the PCRF using CCR(Gx) Message.
2018-01-02 22:14:28 +09:00
Sukchan Lee
408ce293de if initial context setup failure is received, MME_UE context is deleted. 2018-01-02 18:30:17 +09:00
Sukchan Lee
18859c1203 if TAI list is not properly configured, MME sends Attach Reject or TAU
Rejct message.

Attach/TAU Reject contents
 - S1ap_CauseNas_unspecified
 - EMM_CAUSE_TRACKING_AREA_NOT_ALLOWED
 - ESM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED if session is created.
2018-01-02 18:18:45 +09:00
Sukchan Lee
f40159ea2a relase 0.3.1 2017-12-31 22:20:39 +00:00
Sukchan Lee
8081ea3044 fix the bug 2017-12-20 13:16:16 +09:00
Sukchan Lee
c81e2beee6 fix the error for SCTP Kernel Extension on Mac OS X 10.11(El Capital) 2017-12-19 20:19:50 +09:00
Sukchan Lee
a864b36f44 Default APN is added 2017-12-19 17:05:54 +09:00
Sukchan Lee
0557be8ffd Merge branch 'master' of https://github.com/acetcom/nextepc 2017-12-18 20:57:47 +09:00
Sukchan Lee
7d3ec80f5d YAML version check is set to 0.1.4 2017-12-18 11:54:57 +00:00
Sukchan Lee
7a293e8d3a update manual 2017-12-18 20:47:01 +09:00
Sukchan Lee
72c9ae5d56 Merge branch 'ipv6' 2017-12-18 11:16:27 +00:00
Sukchan Lee
f71b2502ad update changelog 2017-12-18 11:15:41 +00:00
Sukchan Lee
e7207e74d2 Merge branch 'ipv6' 2017-12-18 19:37:05 +09:00
Sukchan Lee
385d73e17a IND + 1 from Spec 33.102 C.3.4 2017-12-18 18:21:54 +09:00
Sukchan Lee
d85f546de2 use zero amf in re-synch 2017-12-18 17:28:22 +09:00
Sukchan Lee
fdebe90f7c test scenario is added for debug re-synch failure 2017-12-18 17:10:44 +09:00
Sukchan Lee
65088e690d fix the reboot bug in package scenario 2017-12-18 16:02:28 +09:00
Sukchan Lee
48c5574819 Merge branch 'ipv6' of https://github.com/acetcom/nextepc into ipv6 2017-12-18 05:55:53 +00:00
Sukchan Lee
b52d1faa64 remove testepc in package build 2017-12-18 05:55:43 +00:00
Sukchan Lee
92cebbce2d package manual update 2017-12-18 14:24:44 +09:00
Sukchan Lee
996a0df756 fix the configuration file 2017-12-18 14:01:16 +09:00
Sukchan Lee
a3fbbf70cb debian package is updated 2017-12-18 13:27:56 +09:00
Sukchan Lee
466b15f5ad Web UI version to v0.3.0 2017-12-18 13:23:20 +09:00
Sukchan Lee
a39764cf50 README update 2017-12-18 13:21:10 +09:00
Sukchan Lee
0fab5ee3da ubuntu network configuration for ipv6 is added 2017-12-18 13:17:35 +09:00
Sukchan Lee
573d509919 Change LICENSE to GNU AGPL v3.0 2017-12-18 10:35:54 +09:00
Sukchan Lee
03f681ca05 configuration comment is updated 2017-12-18 09:26:29 +09:00
Sukchan Lee
649fd75b14 Authentication failure(Resynch failure) is added 2017-12-18 00:01:07 +09:00
Sukchan Lee
8f1df48a95 refine error log 2017-12-17 20:29:07 +09:00
Sukchan Lee
de09353e5d Merge branch 'ipv6' of http://github.com/acetcom/nextepc into ipv6 2017-12-17 10:02:34 +00:00
Sukchan Lee
487a4eb155 remove lock in select_loop dispatcher 2017-12-17 10:02:08 +00:00
Sukchan Lee
1131166988 remove sctp warning 2017-12-17 09:40:29 +00:00
Sukchan Lee
88f34c42be configuration is updated 2017-12-17 17:04:44 +09:00
Sukchan Lee
cdaf1c0468 router advertisement use link-local-address in source ip 2017-12-17 07:25:36 +00:00
Sukchan Lee
a102864428 Oops! update it 2017-12-18 00:54:29 +09:00
Sukchan Lee
a5cc4f7a43 update it 2017-12-18 00:50:10 +09:00
Sukchan Lee
73fb7e1c30 Merge branch 'ipv6' of https://github.com/acetcom/nextepc into ipv6 2017-12-18 00:48:34 +09:00
Sukchan Lee
fa6bb86e3d Merge branch 'ipv6' of https://github.com/acetcom/nextepc into ipv6 2017-12-17 20:23:41 +09:00
Sukchan Lee
8d3330cb79 multiple device is added 2017-12-17 06:36:50 +00:00
Sukchan Lee
60804c79d6 subnet is tested 2017-12-17 05:50:24 +00:00
Sukchan Lee
0cf2319b9c pgw dev/subnet context is added 2017-12-17 04:33:12 +00:00
Sukchan Lee
f0f5a5ce31 refine code 2017-12-17 11:22:12 +09:00
Sukchan Lee
0c3054652d refine code 2017-12-17 02:07:04 +00:00
Sukchan Lee
7ea5f3d910 Merge branch 'ipv6' of https://github.com/acetcom/nextepc into ipv6 2017-12-16 23:22:56 +09:00
Sukchan Lee
16080d9aa7 fix the header 2017-12-16 18:19:31 +09:00
Sukchan Lee
d7696f4fa6 fix the header type 2017-12-16 09:15:28 +00:00
Sukchan Lee
f38587595f SLAAC is added 2017-12-16 09:06:34 +00:00
Sukchan Lee
9d4afbba97 update test code 2017-12-16 05:53:30 +00:00
Sukchan Lee
04d3753f1c fix the jumbo frame bug 2017-12-16 13:26:34 +09:00
Sukchan Lee
ba5687de1b fix the bug ipv6 header decoder 2017-12-16 13:25:09 +09:00
Sukchan Lee
52b2125538 IPv6 Header Length calculation 2017-12-16 12:44:19 +09:00
Sukchan Lee
70286b3fd0 parameter.multicast, parameter.no_slaac is added 2017-12-16 09:24:27 +09:00
Sukchan Lee
7de0753b2c webui update 2017-12-15 23:17:13 +09:00
Sukchan Lee
d5381019c9 add the radvd.conf example 2017-12-15 22:53:01 +09:00
Sukchan Lee
7898fb4ae3 IPv6 Multicast is added 2017-12-15 22:42:52 +09:00
Sukchan Lee
b63f92fc20 Fix the bug for TFT IPv6 2017-12-15 12:51:51 +00:00
Sukchan Lee
d0530877c2 TFT rule for IPv6 is added 2017-12-15 20:53:53 +09:00
Sukchan Lee
08b88eba73 IPv6 Classification is initially updated 2017-12-15 09:13:14 +00:00
Sukchan Lee
cc762f3c00 WebUI PGW IP setting is added 2017-12-15 13:47:57 +09:00
Sukchan Lee
634de8c788 IPv6 DNS is added 2017-12-15 10:46:58 +09:00
Sukchan Lee
94c2c6ca7d message format creation bug is fixed related prefixlen 2017-12-15 09:41:54 +09:00
Sukchan Lee
ae57423eab IPv6 Loopback TUN done 2017-12-14 13:47:13 +00:00
Sukchan Lee
46c699143a IPv6 Control Plane done 2017-12-14 21:42:19 +09:00
Sukchan Lee
a74c9be2e6 PGW IP Pool bug is fixed 2017-12-14 18:30:12 +09:00
Sukchan Lee
c4b4a6850d default APN profile is changed from IPv4 only to IPv4 and IPv6 2017-12-14 17:14:33 +09:00
Sukchan Lee
bd9f1a74a4 IPv6 loopback is tested 2017-12-14 06:23:23 +00:00
Sukchan Lee
c5abd526d6 remove icmpv6 data 2017-12-14 06:07:06 +00:00
Sukchan Lee
e4f100055c ICMPv6 send done 2017-12-14 05:31:00 +00:00
Sukchan Lee
1864509cbb ICMPv6 is implemented. But kernel didn't send ping6 reply. Sigh! 2017-12-14 04:01:56 +00:00
Sukchan Lee
05c95dbfef default address is changed.
o PGW
 - GTPC : 127.0.0.1, [::1]
 - GTPU : 127.0.0.1, [::1]

o SGW
 - GTPC : 127.0.0.2
 - GTPU : auto-configured

o MME
 - S1AP : auto-configured
 - GTPC : auto-configured
 - Diameter : 127.0.0.3

o HSS
 - Diameter : 127.0.0.4

o PCRF
 - Diameter : 127.0.0.5
2017-12-14 01:46:35 +00:00
Sukchan Lee
79ec7d8bc0 default configuration is changed for packaging.
Even though nextepc can support link-local address, User may not want to
setup link-local address automatically. So we remove link-link address
in default configuration
2017-12-14 10:33:03 +09:00
Sukchan Lee
7e84bd1aaf Merge branch 'ipv6' of https://github.com/acetcom/nextepc into ipv6 2017-12-14 08:58:04 +09:00
Sukchan Lee
cb59525ca4 FreeBSD IPv6 TUN is not working. IPv6 IP/Rount Setting is all rollbacked 2017-12-14 07:26:32 +09:00
Sukchan Lee
9f05e5e10f update ip setting 2017-12-13 22:42:33 +09:00
Sukchan Lee
fc9b182e55 delete reduant routing table 2017-12-13 21:43:13 +09:00
Sukchan Lee
bd94d695be IPv6 setting done.. but IPv6 routining table update is not working. 2017-12-13 20:22:52 +09:00
Sukchan Lee
b7fb6c6117 temporal update 2017-12-13 16:07:12 +09:00
Sukchan Lee
b7479df01b default configuration is added 2017-12-13 14:11:44 +09:00
Sukchan Lee
6cd9e965a1 Tun IPv4 is done 2017-12-13 12:20:02 +09:00
Sukchan Lee
3fc397c9f2 pool allocation is changed with new method 2017-12-13 12:02:51 +09:00
Sukchan Lee
2f407de0d4 new pool structure is implemented for supporting IPv6 and APN 2017-12-13 11:14:00 +09:00
Sukchan Lee
54636e1843 IPv4 Pool done 2017-12-12 23:50:38 +09:00
Sukchan Lee
989de209d0 configuration is updated 2017-12-12 17:00:32 +09:00
Sukchan Lee
85f6bd6826 fix the warning for freeDiameter 2017-12-11 21:44:27 +09:00
Sukchan Lee
0347f05f9b rollback 2017-12-11 21:30:32 +09:00
Sukchan Lee
8902169320 Merge branch 'ipv6' of https://github.com/acetcom/nextepc into ipv6 2017-12-11 21:01:55 +09:00
Sukchan Lee
31dd8b0f8c add -Wno-format-truncate CFLAGS in freeDiameter library 2017-12-11 21:01:01 +09:00
Sukchan Lee
4336e50d54 update it 2017-12-11 11:37:44 +00:00
Sukchan Lee
95b2f5a951 minor update 2017-12-11 09:00:44 +00:00
Sukchan Lee
cb4893c36b Multiple TAI List done 2017-12-11 16:55:11 +09:00
Sukchan Lee
5551ecf6cd TAI List encoding done in Attach Accept 2017-12-11 16:08:17 +09:00
Sukchan Lee
521d7877b4 Multiple TAI list
Configuration Parer, Message Build is added
2017-12-11 00:01:02 +09:00
Sukchan Lee
178678c216 tai update 2017-12-09 23:25:29 +09:00
Sukchan Lee
ce801ee218 dev is added in the configuration 2017-12-09 23:07:19 +09:00
Sukchan Lee
8e1506a454 remove reduant code 2017-12-09 09:51:42 +00:00
Sukchan Lee
b04c7393f2 fix the bug 2017-12-09 09:50:12 +00:00
Sukchan Lee
15c3827ca9 improve test code for no_ipv4 flags 2017-12-09 18:21:22 +09:00
Sukchan Lee
b04d930f77 fix the test program bug in no_ipv4: true 2017-12-09 04:42:42 +00:00
Sukchan Lee
fc4a89b678 fix the memory lean when auto-detect interface case 2017-12-09 04:02:00 +00:00
Sukchan Lee
587598c8a9 Merge branch 'ipv6' of http://github.com/acetcom/nextepc into ipv6 2017-12-09 12:31:12 +09:00
Sukchan Lee
d70701361f refine test program for testing dual ipv4/v6 stack 2017-12-09 12:30:46 +09:00
Sukchan Lee
1f71dd9e6e missing 2017-12-09 02:47:21 +00:00
Sukchan Lee
969dc789df fix the testcode bug 2017-12-09 01:02:34 +09:00
Sukchan Lee
7108d8cd7f eNB S1U IPv6 test done 2017-12-09 00:58:16 +09:00
Sukchan Lee
e8e6836ab8 add initial context setup response encoder for generating IPv6 packet 2017-12-08 23:58:50 +09:00
Sukchan Lee
9b5234bd5f change link local address 2017-12-08 20:25:34 +09:00
Sukchan Lee
23c5e1040a Merge branch 'ipv6' of http://github.com/acetcom/nextepc into ipv6 2017-12-08 07:17:08 +00:00
Sukchan Lee
26fc43f6cb add mutex 2017-12-08 07:16:43 +00:00
Sukchan Lee
f4c4dbe55d ignore unknown message 2017-12-08 15:48:25 +09:00
Sukchan Lee
f069f19185 rollback 2017-12-08 06:30:15 +00:00
Sukchan Lee
e424e554d7 ipv6 address is changed 2017-12-08 15:05:50 +09:00
Sukchan Lee
bd424f3a08 trace update 2017-12-08 14:48:48 +09:00
Sukchan Lee
681a488ade Merge branch 'ipv6-mac' into ipv6 2017-12-08 05:36:03 +00:00
Sukchan Lee
a0599f7c2d S1AP MAC is done 2017-12-08 14:29:35 +09:00
Sukchan Lee
793b06ce33 Mac OS X S1AP improved 2017-12-08 12:43:35 +09:00
Sukchan Lee
06f8870796 remove logo 2017-12-07 13:20:55 +00:00
Sukchan Lee
126c8b4e11 fix the bug 2017-12-07 11:45:54 +00:00
Sukchan Lee
e4fd5ad70f GTP-U is tested 2017-12-07 20:11:22 +09:00
Sukchan Lee
44fed77ac4 all address format is changed to support IPv4/IPv6 dual stack 2017-12-07 17:40:15 +09:00
Sukchan Lee
ceda682290 intermediate 2017-12-07 17:23:45 +09:00
Sukchan Lee
3e05717180 transport layer convertor is added 2017-12-07 16:51:21 +09:00
Sukchan Lee
590630b839 ip_t is introduced 2017-12-07 15:04:35 +09:00
Sukchan Lee
6d412139ef update gtp_f_teid_t 2017-12-07 14:48:25 +09:00
Sukchan Lee
48cdb1e390 merge 3gpp library to core library 2017-12-07 14:37:58 +09:00
Sukchan Lee
717439cafa remove old_addr 2017-12-07 13:47:07 +09:00
Sukchan Lee
03a6bb7902 SGW/PGW GTP-U is added 2017-12-07 13:27:17 +09:00
Sukchan Lee
f8f18eb6f5 change gtp_send to core_sendto for echo reponse 2017-12-06 23:48:54 +09:00
Sukchan Lee
d2dcf4a877 GTP-U reomte done 2017-12-06 23:42:37 +09:00
Sukchan Lee
397f37cbb7 refine it 2017-12-06 20:52:32 +09:00
Sukchan Lee
35f35458c7 refine it 2017-12-06 20:44:30 +09:00
Sukchan Lee
82b84d760c refine it 2017-12-06 17:58:38 +09:00
Sukchan Lee
10becbb998 remove reduant variable in the context 2017-12-06 12:28:24 +09:00
Sukchan Lee
1c587edff5 no_ipv4, no_ipv6, prefer_ipv4 is tested 2017-12-06 12:13:56 +09:00
Sukchan Lee
9d3049de00 remove POINTTOPOINT interface in probe ip address 2017-12-05 14:30:09 +00:00
Sukchan Lee
5ebc0c0b0d add script 2017-12-05 22:51:50 +09:00
Sukchan Lee
4591209759 PGW GTP-C server is added 2017-12-05 21:34:17 +09:00
Sukchan Lee
a747f91b39 SGW GTP-C server is added 2017-12-05 21:11:36 +09:00
Sukchan Lee
1ab90bcef4 name changes 2017-12-05 20:42:14 +09:00
Sukchan Lee
a7690e395b refine it 2017-12-05 20:39:15 +09:00
Sukchan Lee
1a592f4d51 PGW GTP client is added 2017-12-05 14:56:47 +09:00
Sukchan Lee
c4c03da77f refine 2017-12-05 14:27:24 +09:00
Sukchan Lee
5663cd87c1 SGW GTP-C Client is added 2017-12-05 13:28:34 +09:00
Sukchan Lee
fe921e0c2f refine ipv6 2017-12-05 10:50:31 +09:00
Sukchan Lee
63fb6625b3 multiple addresss is added 2017-12-05 00:16:34 +09:00
Sukchan Lee
410133bf68 core_copyaddrinfo is introduced 2017-12-04 19:45:02 +09:00
Sukchan Lee
609aa4558f name changes 2017-12-03 22:25:31 +09:00
Sukchan Lee
97c7ad63b6 fix the PGW peer configuration bug 2017-12-03 21:34:39 +09:00
Sukchan Lee
a6d23971cd All MME GTP configuration is done 2017-12-03 17:00:11 +09:00
Sukchan Lee
17b6a013b8 parameter.prefer_ipv4 is implemented 2017-12-03 16:31:53 +09:00
Sukchan Lee
f86839eb7b configuration is changed from the discussions 2017-12-03 12:02:56 +09:00
Sukchan Lee
2c00f28b50 MME GTP Client is done 2017-12-02 15:49:03 +09:00
Sukchan Lee
ce5b65b4df gtp node is added 2017-12-02 14:17:32 +09:00
Sukchan Lee
3ae058dc63 gtp_node_t memset is added 2017-12-02 12:01:43 +09:00
Sukchan Lee
4a2604b52c name changes 2017-12-02 10:50:24 +09:00
Sukchan Lee
8add407715 fix the bug 2017-12-02 00:49:58 +09:00
Sukchan Lee
c300d2b99a MME GTPC Server done 2017-12-02 00:44:07 +09:00
Sukchan Lee
8287db900c update it 2017-12-01 22:04:51 +09:00
Sukchan Lee
7e0ce073fb mme gtp config is added 2017-12-01 21:47:15 +09:00
Sukchan Lee
b6b39c9dad socknode_filter_family is added 2017-12-01 20:27:56 +09:00
Sukchan Lee
71b58e7724 tcp/udp interface is changed 2017-12-01 17:39:28 +09:00
Sukchan Lee
d874ec5b48 remove type 2017-12-01 16:30:14 +09:00
Sukchan Lee
5cebb48bc6 socknode_getifaddrs_to_list is added 2017-12-01 15:56:56 +09:00
Sukchan Lee
c6623a277a fix the bug 2017-12-01 20:59:57 +09:00
Sukchan Lee
fee05d3764 socknode is added 2017-12-01 11:34:34 +09:00
Sukchan Lee
5a818eb8cd gtp_node is added 2017-11-30 20:13:15 +09:00
Sukchan Lee
f25626ee84 add log 2017-11-30 10:00:47 +09:00
Sukchan Lee
4baf7ece46 core_getifaddrs is introduced.
IP address of all interfaces is automatically retrived.
But, some interface will be discarded.
 - unspcified IP address
 - loopback address
 - IPv6 multicast
 - IPv6 link-local
 - IPv6 site-local
2017-11-29 22:04:56 +09:00
Sukchan Lee
6a90caaf8f update configuration 2017-11-29 20:46:13 +09:00
Sukchan Lee
c58d3d64f3 remove old json configuration file 2017-11-29 20:40:02 +09:00
Sukchan Lee
bb343cb8e4 YAML is updated 2017-11-29 15:17:35 +09:00
Sukchan Lee
d07b8f1e01 fix compile error 2017-11-29 05:58:26 +00:00
Sukchan Lee
dd15dacb18 YAML project is done 2017-11-29 14:44:14 +09:00
Sukchan Lee
e7d3d2f4da pgw is done 2017-11-29 14:24:55 +09:00
Sukchan Lee
60ac1dbfe6 hss/pcrf/sgw yaml is done 2017-11-29 09:51:34 +09:00
Sukchan Lee
17b360bc18 mme yaml config is done 2017-11-29 09:41:29 +09:00
Sukchan Lee
f1ac8b853b continue to parsing YAML 2017-11-29 00:53:21 +09:00
Sukchan Lee
e1e907bad7 gummei is finished with YAML 2017-11-29 00:32:46 +09:00
Sukchan Lee
c4b86f5ee9 array is added 2017-11-28 13:44:44 +09:00
Sukchan Lee
1528568bb8 update it 2017-11-27 23:53:47 +09:00
Sukchan Lee
0b78387d7f sample code. 2017-11-27 20:23:16 +09:00
Sukchan Lee
aaa57d3008 name changes 2017-11-27 15:45:33 +09:00
Sukchan Lee
f9fe704ccb downgrade yaml library from 0.1.7 to 0.1.6 2017-11-27 06:21:28 +00:00
Sukchan Lee
8b5ae91547 context uses YAML config. 2017-11-27 14:58:53 +09:00
Sukchan Lee
8e40a0eb64 initial code for moving configuration file format to the YAML 2017-11-27 10:35:08 +09:00
Sukchan Lee
4f722f2807 update it 2017-11-26 08:54:47 +09:00
Sukchan Lee
73fd1a8d99 update it 2017-11-25 14:52:02 +00:00
Sukchan Lee
82112f5678 update it 2017-11-25 14:47:33 +00:00
Sukchan Lee
7eceefb0f2 update it 2017-11-25 14:46:31 +00:00
Sukchan Lee
40c99a8c13 name changes done 2017-11-25 23:41:00 +09:00
Sukchan Lee
1e68d47927 name changes 2017-11-25 23:30:47 +09:00
Sukchan Lee
92fc35861f name changes 2017-11-25 23:28:34 +09:00
Sukchan Lee
7d7e9f154b Mac OS X IPv6 bug is fixed 2017-11-25 09:58:04 +09:00
Sukchan Lee
b34d8b931e configuration is updated 2017-11-24 16:08:26 +00:00
Sukchan Lee
61432a3070 mme->s1ap_sock is removed 2017-11-25 00:52:07 +09:00
Sukchan Lee
23fa36bc23 name changes 2017-11-24 15:04:45 +00:00
Sukchan Lee
cb63c2b1ea remove mme->s1ap_addr and mme->s1ap_port 2017-11-24 13:02:40 +00:00
Sukchan Lee
b2620caf26 set the hostname is NULL 2017-11-24 11:48:24 +00:00
Sukchan Lee
5a8d169ba1 remove AI_PASSIVE if hostname is NULL 2017-11-24 20:45:51 +09:00
Sukchan Lee
d49404ad2d loopback address is changes from 127.76.0.1 to 127.0.0.1 2017-11-25 04:16:18 +09:00
Sukchan Lee
2dcb56a41d Merge branch 'ipv6-addr' of http://github.com/acetcom/nextepc into ipv6-addr 2017-11-24 10:03:57 +00:00
Sukchan Lee
7025491846 add sock type in enb context 2017-11-24 10:03:48 +00:00
Sukchan Lee
62afe724ed Oops! mistake 2017-11-24 19:02:19 +09:00
Sukchan Lee
8fb2e0ba3b change default IP : 127.76.0.x -> 127.0.0.x 2017-11-24 13:52:22 +09:00
Sukchan Lee
6412231f29 all remove core_net.h 2017-11-24 11:49:37 +09:00
Sukchan Lee
685272fce8 improve usrsctp 2017-11-23 23:01:49 +09:00
Sukchan Lee
859d6427fd enb->addr is changes to pointer 2017-11-23 21:05:55 +09:00
Sukchan Lee
65fb2d280f enodeb's s1ap_addr types changes from c_uint32_t to c_sockaddr_t 2017-11-23 19:44:49 +09:00
Sukchan Lee
5d0bc98f8d Oops! mistake 2017-11-23 14:19:38 +09:00
Sukchan Lee
227cae5762 S1AP changes from net_lib to new socket library 2017-11-23 02:53:33 +00:00
Sukchan Lee
65b7008378 fix the tun driver bugs 2017-11-23 00:42:28 +09:00
Sukchan Lee
2f49e6024d gtp's net_sock_t to sock_id. GTP-U is failed 2017-11-23 00:19:28 +09:00
Sukchan Lee
b1023fac1d port to linux 2017-11-22 14:11:47 +00:00
Sukchan Lee
cfc352ea0d remove c_sa_len 2017-11-22 22:55:28 +09:00
Sukchan Lee
a27f294f74 TUN driver is added 2017-11-22 22:32:57 +09:00
Sukchan Lee
e44e613ff2 s1ap structure changes from net_sock_t to sock_id 2017-11-22 21:50:08 +09:00
Sukchan Lee
38a5ad3c68 remove port from gtp_node_t 2017-11-22 20:35:45 +09:00
Sukchan Lee
ce827fe733 change address type from c_uint32_t to c_sockaddr_t 2017-11-22 19:51:06 +09:00
Sukchan Lee
1928da0557 c_sa_len, c_sa_family, c_sa_port is introduced 2017-11-22 06:21:26 +00:00
Sukchan Lee
9c593a2757 Oops! mistake.. Use sock library for connect/bind socket function 2017-11-22 15:09:21 +09:00
Sukchan Lee
0fb47c499f fix the freebsd segmenation fault error 2017-11-22 01:56:51 +09:00
Sukchan Lee
5bf84f3b62 local_addr/remote_addr is added 2017-11-21 15:28:23 +09:00
Sukchan Lee
7151a98f41 GTP Peer Node finding method is changed.
Before : received IP address from UDP socket
After : Based on TEID. Initially, finding from Sender F-TEID
2017-11-21 14:52:07 +09:00
Sukchan Lee
21d2ca34f6 mac porting for new socket library 2017-11-19 22:07:44 +09:00
Sukchan Lee
5778fb6cbc core_inet_pton is added 2017-11-19 12:56:48 +00:00
Sukchan Lee
1ad25fbc9c s1setup test is done 2017-11-19 10:41:50 +00:00
Sukchan Lee
8a6b602836 New SCTP library is initially applied in test program 2017-11-19 08:31:18 +00:00
Sukchan Lee
ef3bb2e368 sctp_connect is added 2017-11-19 07:21:29 +00:00
Sukchan Lee
376f7c1304 udp connect function is added for bind & connect behavior 2017-11-19 08:27:20 +09:00
Sukchan Lee
1238f31178 update getaddrinfo if hostname is NULL 2017-11-19 07:57:41 +09:00
Sukchan Lee
f186ec93dd previous archi is failed in FreeBSD OS
re-architecture socket library
2017-11-18 12:55:44 +00:00
Sukchan Lee
2ba078277f fix the link 2017-11-18 14:58:25 +09:00
Sukchan Lee
89439ce79e fix the link 2017-11-18 14:57:05 +09:00
Sukchan Lee
19e18b9efb README update 2017-11-18 14:44:51 +09:00
Sukchan Lee
113cbd0e9e minor fix 2017-11-16 13:45:49 +00:00
Sukchan Lee
6db21f54c1 c_sockaddr_t is created for supporting both IPv4 and IPv6 address. 2017-11-16 12:49:07 +00:00
Sukchan Lee
a4d1bae083 SCTP library is initially added 2017-11-16 10:46:25 +00:00
Sukchan Lee
7c505f917a minor update 2017-11-16 01:51:05 +00:00
Sukchan Lee
e521d75e7a tcp/udp bug is fixed 2017-11-15 15:17:55 +00:00
Sukchan Lee
221fd81bb2 fix the linux compile error 2017-11-15 14:38:51 +00:00
Sukchan Lee
068d049a9f IPv6 project is started.
1. Remove thread lock in select loop.
2. Nonblocking will be used in select loop for good performance.
3. Connection mode for UDP socket & SCTP(SEQPACKET)

More test is needed.
2017-11-15 22:59:30 +09:00
Sukchan Lee
90a50d999d sleep is needed in test code 2017-11-10 02:31:32 +00:00
Sukchan Lee
12ae140185 reduant code 2017-11-10 11:23:55 +09:00
Sukchan Lee
f839fd93b7 Control Plane and Data Plane Thread is merged to One thread in SGW/PGW
- for protecting context, SGW/PGW is implemented with only one thread.
- In PGW, processing control plane could be delayed +10ms when diameter
thread sends message queue to the PGW control plane.
- In other case, all performance may be same with previous architecture.
2017-11-10 00:38:05 +00:00
Sukchan Lee
cd59df5011 just minor update 2017-11-09 14:56:03 +09:00
Sukchan Lee
11df912058 remove jsmn library.
jsmn library is very simple, but it is difficult to handle configuration
josn.
I changed json to libbson library. I think it is more maintainable.
2017-11-09 00:05:18 +09:00
Sukchan Lee
4e0abf8775 remove static object in library 2017-11-08 00:00:57 +09:00
Sukchan Lee
a0e6cc3996 Oops! missing files 2017-11-07 14:28:46 +00:00
Sukchan Lee
5361934469 change the libbase to lib3gpp 2017-11-07 14:20:35 +00:00
Sukchan Lee
6e00fd349c seperate libbase to the libapp 2017-11-07 14:01:27 +00:00
Sukchan Lee
3778e47bdc add version-info in shared library
I'll just set all version to 1:0:0 at this point
2017-11-07 12:41:20 +00:00
Sukchan Lee
53a86f30cc remove base 2017-11-06 13:42:34 +00:00
Sukchan Lee
e63fa44fff all library is changed to shared library 2017-11-06 13:32:37 +00:00
Sukchan Lee
f4a47e30c7 support relative path of freeDiameter 2017-11-06 13:02:36 +00:00
Sukchan Lee
1941c8b729 freediameter extensions installation path is changed to
'${libdir}/nextepc/freeDiameter'
2017-11-06 11:36:07 +00:00
Sukchan Lee
8b916d15f4 move fd/extensions to freeDiameter-1.2.1/extensions 2017-11-06 10:14:14 +00:00
Sukchan Lee
4ef15728a0 merge libcore/libcoreunix to libcore
merge libfd/libfdx/libfds6a to libfd
2017-11-06 08:32:19 +00:00
Sukchan Lee
bfbb98fc1f fix the dependency error 2017-11-06 00:08:06 +09:00
Sukchan Lee
5cc56ab353 change shared library 2017-11-05 14:57:19 +00:00
Sukchan Lee
1b0536dca0 change all library from static to shared library 2017-11-05 17:13:50 +09:00
Sukchan Lee
0d13c26307 change the freeDiameter library from static to the shared library 2017-11-05 16:20:52 +09:00
Sukchan Lee
cd2df5d894 add dlopen library search 2017-11-04 11:03:18 +09:00
Sukchan Lee
d87383be69 Oops! remove dependpency lib 2017-11-04 10:34:02 +09:00
Sukchan Lee
d851d03925 Merge branch 'dep' of https://github.com/acetcom/nextepc into dep
fix the conflict
2017-11-04 10:24:24 +09:00
Sukchan Lee
d092c329da rollback..Mac OSX is not working if we link libfdore/proto to the shared
object.
2017-11-04 10:23:07 +09:00
Sukchan Lee
4345398ca2 fix the warning of dh_shdeplibs 2017-11-03 15:36:24 +00:00
Sukchan Lee
d2cf6821b8 fix the library dependency 2017-11-03 21:55:20 +09:00
Sukchan Lee
3db70a3ad0 update changelog for launchpad ppa package 2017-11-03 02:31:48 +00:00
Sukchan Lee
362db04ff6 Merge branch 'master' of https://github.com/acetcom/nextepc 2017-11-03 11:27:28 +09:00
Sukchan Lee
ea7cca3d40 postrm script improved 2017-11-03 02:27:05 +00:00
Sukchan Lee
f35eea1634 add favicon in Web User Interface 2017-11-03 10:48:38 +09:00
Sukchan Lee
2c5f9e6c0c Fix errata 2017-11-02 21:38:12 +09:00
Sukchan Lee
066339d8cb update README 2017-11-02 17:21:21 +09:00
Sukchan Lee
d9ab53bbf0 update changelog for launchpad ppa 2017-11-02 07:52:37 +00:00
Sukchan Lee
561c041010 remove README 2017-11-02 16:08:34 +09:00
Sukchan Lee
fbe3e3685f debug log change to trace 2017-11-02 16:07:40 +09:00
Sukchan Lee
2f43079fc6 update pgw.postinstall
introduce systemctl.sh
2017-11-01 01:11:55 +00:00
Sukchan Lee
0bdbee24cf fix the bug for pgw post install script 2017-10-31 14:42:02 +00:00
Sukchan Lee
081f8c8808 MongoDB re-connect using systemd 2017-10-31 12:29:39 +00:00
Sukchan Lee
a9dd6be8e8 Ubuntu artful update 2017-10-31 05:54:13 +00:00
Sukchan Lee
a25de7b287 fix the PGW installation 2017-10-31 04:44:11 +00:00
Sukchan Lee
46b403c43d all running error is fixed 2017-10-31 09:32:18 +09:00
James Park
b060ea1714 Add sleep so that server is ready to accept connection. 2017-10-30 15:26:30 -07:00
Sukchan Lee
f627565696 Upload Launchpad PPA for Ubuntu 17.10 i386 2017-10-30 13:34:17 +00:00
Sukchan Lee
badc1f2da3 fix compile error 2017-10-30 10:39:05 +00:00
Sukchan Lee
10cda2cfd7 exclude TCP test in testnetlib because sometimes this test is failed as
follows.

 OpenSUSE OBS
 - Ubuntu 17.04 i586 failed

[  542s] testnetlib          :  Line 262: expected <0>, but saw <-1>
[  542s] [10/30 07:48:38.730] ERRR: connect error(111:Connection refused)(proto:6 remote:127.0.0.1 dport:5121 lport:0) (net_lib.c:353)
[  542s] [10/30 07:48:38.730] ERRR: connect error(111:Connection refused)(proto:6 remote:127.0.0.1 dport:5121 lport:0) (net_lib.c:353)
[  542s] [10/30 07:48:38.730] ERRR: connect error(111:Connection refused)(proto:6 remote:127.0.0.1 dport:5121 lport:0) (net_lib.c:353)
[  542s] [10/30 07:48:38.730] ERRR: connect error(111:Connection refused)(proto:6 remote:127.0.0.1 dport:5121 lport:0) (net_lib.c:353)
[  542s] [10/30 07:48:38.730] ASSERT: !(net_sock && buffer). Invalid params
[  542s]  (net_lib.c:590)
[  542s] [10/30 07:48:38.730] ASSERT: !(net_sock). net_sock is NULL
[  542s]  (net_lib.c:408)
[  542s] [10/30 07:48:38.730] ASSERT: !(net_sock). net_sock is NULL
2017-10-30 10:37:33 +00:00
Sukchan Lee
abdcbe7b7a change names of ubuntu package version 2017-10-30 07:10:43 +00:00
Sukchan Lee
377f725f26 update debian changelog
add Ubuntu Zesty(Ubuntu 17.04-amd64, i586)
add Ubuntu Artful(Ubuntu 17.10-amd64)
2017-10-30 05:46:42 +00:00
Sukchan Lee
ff31858a81 update debian changelog 2017-10-30 04:50:11 +00:00
Sukchan Lee
9e27685cd0 disable test code. will be fixed later. 2017-10-30 02:14:33 +00:00
Sukchan Lee
c09483b540 at this point, I'm not sure how to handle this file.
I'll just rollback it.
2017-10-29 13:03:39 +00:00
Sukchan Lee
44f0155f5a add metapackage 2017-10-29 12:54:03 +00:00
Sukchan Lee
a0eb08a2fa PID command line option(-p) is added 2017-10-29 20:48:17 +09:00
Sukchan Lee
8c289c6d6e update logrotate and newsyslog following previous modification 2017-10-29 20:16:18 +09:00
Sukchan Lee
baf6af79d6 LOG configuration is changed.
We'll juse file log as a default log.
Older logger name is changed socket logger and default configuration is
disabled
2017-10-29 10:22:22 +00:00
Sukchan Lee
2d1983cfb0 /var/run bug is fixed
For systemd environment, we define runtime directory like the follwings
MME : /var/run/nextepc-mmed
SGW : /var/run/nextepc-sgwd
PGW : /var/run/nextepc-pgwd
HSS : /var/run/nextepc-hssd
PCRF : /var/run/nextepc-pcrfd

In each directory, PID File is created as follows.
MME : /var/run/nextepc-mmed/pid
SGW : /var/run/nextepc-sgwd/pid
PGW : /var/run/nextepc-pgwd/pid
HSS : /var/run/nextepc-hssd/pid
PCRF : /var/run/nextepc-pcrfd/pid
2017-10-29 10:57:15 +09:00
Sukchan Lee
5c4c4498d2 logging disunite to each individual 2017-10-29 00:44:09 +09:00
Sukchan Lee
f72aa7a468 systemd update 2017-10-28 19:50:50 +09:00
Sukchan Lee
c8ec3702d0 update debian rule for override_dh_auto_test
VM(like OBS) may not support SCTP
At this point, I disabled SCTP-needed test code.
2017-10-28 10:09:44 +00:00
Sukchan Lee
4e33365bf4 debian packaging is initially done.
network script is added
move testscript in debian/rules
2017-10-27 16:15:14 +00:00
Sukchan Lee
fdae399c74 debian packaging (stage 2)
make check re-enabled, but data plane is disabled at this point
user(nextepc/nextec) created
pgwtun interface is created when PGW-preinstall script
2017-10-27 06:01:59 +00:00
Sukchan Lee
e367b00d2c do debian packaging (stage-1) 2017-10-27 03:15:14 +00:00
Sukchan Lee
b08c91190a remove to install systemd, logrotate, newsyslog
I'm not sure where is good things for this system file.
We need to decide when these stuffs are installed in Debian package or `make install`

At this point, I'll remove to install them for other developer.
Later, I'll fix it!
2017-10-26 13:26:10 +09:00
Sukchan Lee
52080092b6 GTP-U is re-enabled in test program.
I'll use src : 45.45.0.2 dst ip : 45.45.0.1 for data plane loopback test
2017-10-25 19:49:28 +09:00
Sukchan Lee
88b5560a2a change test packet to loopback address 2017-10-25 19:33:18 +09:00
Sukchan Lee
6d99061b17 permit even though SGW fails to send gtp end marker 2017-10-25 19:04:35 +09:00
Sukchan Lee
f624adf540 change default configuration using loopback addresses
mme : 127.76.0.1
sgw : 127.76.0.2
pgw : 127.76.0.3
hss : 127.76.0.4
pcrf : 127.76.0.5

If you would like to connect internet, you need to change MME.S1AP_IPV4
and SGW.GTPU_IPV4 with external IP address
2017-10-25 16:30:19 +09:00
Sukchan Lee
67827d5ea4 change assert to d_error for log file permission problem 2017-10-25 14:43:54 +09:00
Sukchan Lee
20800c611b HSS update for supporting OPc 2017-10-25 14:37:12 +09:00
Sukchan Lee
6c8d4328fb fix the bug when profile is changes 2017-10-25 12:45:08 +09:00
Sukchan Lee
588a6ba012 add OPc field to Subscriber and Profile Document 2017-10-25 12:17:52 +09:00
Sukchan Lee
d4dd8bb72d missing files for newsyslog 2017-10-24 22:48:29 +09:00
Sukchan Lee
6d25211f3b add newsyslog for Mac OS X 2017-10-24 22:46:09 +09:00
Sukchan Lee
4ae9673935 Merge branch 'r0.2' of https://github.com/acetcom/nextepc into r0.2
Conflicts:
	test/checkepc.sh
2017-10-24 21:00:10 +09:00
Sukchan Lee
cd36e9a334 update .gitignore 2017-10-24 20:58:22 +09:00
Sukchan Lee
0897c36947 logrotate is now working. 2017-10-24 20:52:58 +09:00
Sukchan Lee
6989a8ae91 to permit 'make install' in user privilege for developer. 2017-10-24 19:40:47 +09:00
Sukchan Lee
df1f35e92b Logrotate is added. But more test is needed 2017-10-24 19:14:09 +09:00
Sukchan Lee
6f5ec19388 PID file is created for logrotate 2017-10-24 15:55:28 +09:00
Sukchan Lee
6eb05495aa change test configuration directory to /tmp 2017-10-24 11:00:58 +09:00
Sukchan Lee
81a8b00d78 Merge branch 'master' into r0.2 2017-10-24 09:54:47 +09:00
Sukchan Lee
382c909ffc Merge pull request #10 from laf0rge/laforge/pending
Allow loopback/link-local/site-local addresses
2017-10-24 09:53:59 +09:00
Sukchan Lee
92ba86f1fd update script for Non-GNU sed 2017-10-24 01:40:01 +09:00
Sukchan Lee
adcc473d6e 'make check` before 'make install'
checkepc.sh script is created.
this script generates necessary configuration file before `make
install`. And then, execute `./testepc -f ./etc/nextepc.conf`
2017-10-24 01:03:25 +09:00
Sukchan Lee
5314bcb687 change @localstatedir@/@sysconfdir@ to the LOCALESTATE_DIR and SYSCONF_DIR in nextepc.conf.in 2017-10-23 15:00:07 +09:00
Sukchan Lee
30e7beb84c Merge branch 'laforge/debian-packaging' of https://github.com/laf0rge/nextepc into debian-packaging 2017-10-23 14:22:07 +09:00
Harald Welte
e8071fa544 freeDiameter: Allow bind to loopback, link-local and site-lcoal addrs
Why would it be illegal to configure/operate freeDiameter to bind to
loopback, link-local or site-local addresses?  Loopback is used a lot
in testing.  link-local and site-local adresses can very well be used
in non-public applications/use cases that don't involve public IPv6
networks.
2017-10-22 18:42:20 +02:00
Sukchan Lee
32b7183483 thread delete location is changed.
See [the issue discussion](https://github.com/sctplab/usrsctp/issues/179)
2017-10-21 07:34:12 +09:00
Sukchan Lee
f6f1720fee update netconfig.sh 2017-10-20 23:51:54 +09:00
Sukchan Lee
6b8cdafbbd Now, we'll use loopback interface for internal socket 2017-10-20 19:15:58 +09:00
Sukchan Lee
074b7b41e8 fix the bug GTP-U testing code 2017-10-20 18:01:47 +09:00
Sukchan Lee
2223dfef0e remove hard-corded code 2017-10-20 17:19:27 +09:00
Sukchan Lee
7b046c75b2 add usrsctp_finish 2017-10-20 16:32:57 +09:00
Sukchan Lee
3bf6326763 create testsctp.c and testusrsctp.c 2017-10-20 16:15:32 +09:00
Sukchan Lee
c2d962d4d1 rollback privous commit 2017-10-20 15:52:30 +09:00
Sukchan Lee
34270825a7 fix the bug usrsctp_finish() 2017-10-20 15:46:06 +09:00
Sukchan Lee
d971a9c9ae testepc is passed in Userland SCTP 2017-10-20 15:14:14 +09:00
Sukchan Lee
d40ba2a67c Oops! re-add net_read() in testcode 2017-10-20 13:47:43 +09:00
Sukchan Lee
7b1949da6c Merge branch 'r0.2' of https://github.com/acetcom/nextepc into r0.2 2017-10-20 13:19:20 +09:00
Sukchan Lee
2a3fe018e8 S1Setup Test is passed in Userland SCTP 2017-10-20 13:18:58 +09:00
Sukchan Lee
36985520f9 send/recv function is tested for only 1 eNB. 2017-10-19 13:42:07 +09:00
Sukchan Lee
cca9f6d521 recv function is tested for Userland SCTP library 2017-10-19 12:50:39 +09:00
Sukchan Lee
da1a50e9d3 Merge branch 'master' into r0.2 2017-10-19 10:15:13 +09:00
Sukchan Lee
c460386d39 Merge pull request #6 from laf0rge/laforge/s1ap-ppid-fix
net_accept(): Inherit PPID from listening socket
2017-10-19 09:50:42 +09:00
Harald Welte
1c64000431 net_accept(): Inherit PPID from listening socket
When we call accept() on a listening socket, we need to inherit
the sctp PPID from the master socket to the new socket of the
just-accepted connection.  Otherwise any sent packets (such as S1AP)
will be sent to PPID=0 rather than the configured PPID (e.g. 18 for
S1AP).
2017-10-18 23:18:53 +02:00
Sukchan Lee
1df4fc9a41 continue to porting Userland SCTP
connection is done.
will implement send/recv function
2017-10-19 01:09:06 +09:00
Harald Welte
ae6f1001f8 Add systemd service files for nextepc daemons 2017-10-18 12:27:53 +02:00
Harald Welte
4bce6df238 Add 'debian' subdirectory for building dpkg packages
Adding this 'debian' subdirectory will allow users to build
binary packages using 'dpkg-buildpackage' and related tools.

Tested so far on Debian unstable and 9 as well as Ubuntu 17.04
and 17.10 on OpenSuSE Build Service.
2017-10-18 12:27:49 +02:00
Sukchan Lee
bb806e492e Finally, I've remove net_sock_t->app_index in core_net.h
Now, we are done to porting SCTP using Userland SCTP
2017-10-18 14:36:12 +09:00
Sukchan Lee
c3ffd52771 mme_enb_t context structure is changed using hash table.
I'll remove net_sock_t->app_index if poosible.
2017-10-18 14:05:22 +09:00
Harald Welte
ec91b9e8da Fix directory mix-up. @prefix@ vs. @sysconfdir@ vs @libdir@ vs @localstatedir@
Installing to @prefix@/etc is wrong, this will end up in /usr/etc
on most linux distributions, where /etc (@sysconfdir@) would be correct.

The same is true for /var (@localstatedir@), we don't want log files
suddenly to be in /usr/var/log rather than /var/log

However, this is further complicated by the fact that @libdir@ is not
recursively resolved but could expand to "${prefix}/lib" which
of course makes no sense inside a config file.  So instead, let's
introduce adl_RECURSIVE_EVAL and define @LIB_DIR@ and @SYSCONF_DIR@
with recursively-expanded versions of those variables.
2017-10-17 23:43:51 +02:00
Harald Welte
cd8f29aa59 Makefile.am: install_data_hook was missing $(DESTDIR)
When creating the /var/log directory, we must create it relative
to the $(DESTDIR) of the installation, and not at it's system-wide
default path without any DESTDIR.
2017-10-17 21:49:29 +02:00
Harald Welte
bb74b173ca Add 'nextepc-' prefix to executables
'mmed' and the like all are a bit of a generic name. Let's prefix the
project name to ensure there will be no clashes with other programs that
also implement a 'MME daemon' or the like.
2017-10-17 21:28:29 +02:00
Sukchan Lee
10b23bb64e fix compile error for usrsctp 2017-10-17 22:18:48 +09:00
Sukchan Lee
ea253016fc autoconf update for supporting Userland SCTP(libusrsctp) 2017-10-17 20:44:05 +09:00
Sukchan Lee
a020b587c1 Merge branch 'master' into r0.2 2017-10-17 16:19:20 +09:00
Sukchan Lee
0eb9ae4792 fix the compile error 2017-10-17 23:04:24 +09:00
Sukchan Lee
f275617225 Merge pull request #1 from laf0rge/master
Add .gitingore file to have clean 'git status' output
2017-10-17 16:16:14 +09:00
Harald Welte
92ecad5118 Add .gitingore file to have clean 'git status' output 2017-10-17 08:12:58 +02:00
Sukchan Lee
d486e84816 improve netconfig
modify GTP packet sending function interface
2017-10-17 13:53:55 +09:00
Sukchan Lee
b287a3b022 fix the bug multiple tun driver 2017-10-17 13:14:10 +09:00
Sukchan Lee
83a21c5840 configuration is changed 2017-10-17 13:04:45 +09:00
Sukchan Lee
b9f4dcf4ea MAC OSX is needed to enable IP fowwarding 2017-10-17 07:44:48 +09:00
Sukchan Lee
a20c96bc21 fix the Makefile errata 2017-10-17 01:25:28 +09:00
Sukchan Lee
291a5ce514 merge MacOSX and FreeBSD code related tun ip config 2017-10-17 01:03:34 +09:00
Sukchan Lee
cdbc8d1ab0 MAC OSX ping loopback test done 2017-10-17 00:56:00 +09:00
Sukchan Lee
689c3b95e7 routing table is automatically added in FreeBSD 2017-10-17 08:24:30 +09:00
Sukchan Lee
b8a37b0ea1 net_tun library is updated for supporting FreeBSD and MacOSX
In FreeBSD and MacOSX, tun driver is automatically configured.
2017-10-17 07:03:37 +09:00
Sukchan Lee
86908cdbe9 ping src:45.45.0.2 dst:45.45.0.1 is only enabled in Linux platform
Linux Kernel reply the icmp message.
FreeBSD/MacOSX is not working.
More study is needed about TUN
2017-10-15 20:43:05 +09:00
Sukchan Lee
0f08c2a624 Ping loopback is added in Linux platform 2017-10-15 20:33:51 +09:00
Sukchan Lee
47bad3794e PGW IP assign rule is updated 2017-10-15 20:33:20 +09:00
Sukchan Lee
fb566fd94c fix the compile error for high GCC version 2017-10-15 01:18:45 +09:00
Sukchan Lee
3bbbd1b5b1 fix the bug for One SGW IP assign 2017-10-15 01:07:27 +09:00
Sukchan Lee
172266b0c5 GTP Loopback Test Module is Added.
1. ping(src:45.45.0.1, dst:45.45.0.1)
2. MME emulates GTP-U instead of eNB, and send GTP-U to the SGW
3. SGW relay to PGW using GTP-U
4. PGW TUN reponse ping reply
5. PGW sends GTP-U to the SGW
6. SGW sends GTP-U to the MME
7. GTP-U decapsulates and sends ping packet to the kernel
2017-10-15 00:45:49 +09:00
Sukchan Lee
1f14b132c2 Merge branch 'r0.2' of https://github.com/acetcom/nextepc into r0.2 2017-10-13 21:51:50 +09:00
Sukchan Lee
3613b27ca7 MME/PGW Configuration is also changed to support One SGW IP assign
Control Plane Test Done.
Data Plan Test is Needed.
2017-10-13 21:31:49 +09:00
Sukchan Lee
4672ee559f One IP assign for SGW
Configuration is changed
Remove S11_XXXX, S1U_XXXX, S5C_XXXX, S5U_XXXX

Introduce GTPC_IPV4, GTPU_IPV4
2017-10-13 21:13:39 +09:00
Sukchan Lee
02773eff40 FreeBSD Porting done. 2017-10-13 18:12:15 +09:00
Sukchan Lee
5d6e63c20e Reduce SGW IP assign to One.
Initially, I've started to update Control Plane related to this issue.
Context Accessing is re-arraged based Thread for finding GTP Node Context.

[MME]
mme_sgw_t : SM thread(Control-Plane)

[SGW]
sgw_mme_t : Net thread(Data-Plane)
sgw_pgw_t : SM thread(Control-Plane)

[PGW]
pgw_sgw_t : Net thread(Data-Plane)
2017-10-13 14:41:55 +09:00
Sukchan Lee
ee4dd7732e Porting to FreeBSD (Stage-1)
I'd just fix the compile error at this point.
2017-10-12 23:01:51 +09:00
Sukchan Lee
8d343221d2 update VERSION to 0.2.0 2017-10-11 15:50:00 +09:00
Sukchan Lee
7c20ac5c64 update VERSION to 0.1.1 2017-10-11 15:46:45 +09:00
Sukchan Lee
dac66d0b80 BUILT_SOURCE is missing.
fdd.tab.h is a file generated from lex & yacc. If we do not tell it to
automake, the dependency issue occurs in `make -j 8`.
2017-10-11 06:25:21 +00:00
Sukchan Lee
4245502ae2 Fix the bug under mongo c driver v1.5
I misunderstand the interface when querying with projection
when the version of Mongo C Driver is lower than 1.5.

For reference, in case of Ubuntu 16.04, Mongo C Driver v1.3.1
will be installed, so when using 'Dedicated Bearer', v0.1.1
should be used because it does not work normally.
2017-10-11 06:08:19 +00:00
2263 changed files with 210051 additions and 182278 deletions

72
.gitignore vendored Normal file
View File

@@ -0,0 +1,72 @@
# compiler output
*.o
*.lo
*.a
*.la
*.conf
.deps
.dirstamp
.libs
# generated files
lib/freeDiameter-*/libfdcore/fdd.tab.[chy]
lib/freeDiameter-*/libfdcore/lex.fdd.[cl]
lib/freeDiameter-*/include/freeDiameter/version.h
lib/freeDiameter-*/include/freeDiameter/config.h.in
lib/freeDiameter-*/include/freeDiameter/freeDiameter-host.h
lib/core/include/core.h
support/systemd/nextepc-*.service
support/logrotate/nextepc
# autotools
stamp-h1
config.h
config.in
config.nice
config.log
configure
aclocal.m4
config.status
libtool
autom4te.cache
build-aux
Makefile
Makefile.in
m4
# autotest
test/package.m4
test/atconfig
test/testsuite
test/testsuite.dir/
test/testsuite.log
# executables
lib/core/test/testcore
test/testvolte
test/testepc
nextepc-mmed
nextepc-pcrfd
nextepc-pgwd
nextepc-sgwd
nextepc-epcd
nextepc-hssd
# debian
debian/*.debhelper.log
debian/*.debhelper
debian/*.substvars
debian/tmp
debian/files
debian/autoreconf.before
debian/autoreconf.after
debian/nextepc-core
debian/nextepc-mme
debian/nextepc-sgw
debian/nextepc-pgw
debian/nextepc-pcrf
debian/nextepc-hss
# webui
webui/.next/
webui/node_modules/

145
LICENSE
View File

@@ -1,5 +1,5 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
@@ -7,17 +7,15 @@
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
software for all its users.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
@@ -26,44 +24,34 @@ them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
The precise terms and conditions for copying, distribution and
modification follow.
@@ -72,7 +60,7 @@ modification follow.
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
@@ -549,35 +537,45 @@ to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
@@ -631,44 +629,33 @@ to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
{one line to give the program's name and a brief idea of what it does.}
Copyright (C) {year} {name of author}
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
GNU Affero General Public License for more details.
You should have received a copy of the GNU General Public License
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
{project} Copyright (C) {year} {fullname}
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
For more information on this, and how to apply and follow the GNU AGPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

View File

@@ -2,62 +2,43 @@
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = lib src test
SUBDIRS = lib src support test
bin_PROGRAMS = mmed hssd sgwd pgwd pcrfd epcd
bin_PROGRAMS = nextepc-mmed nextepc-hssd nextepc-sgwd nextepc-pgwd nextepc-pcrfd nextepc-epcd
dist_mmed_SOURCES = main.c
mmed_LDADD = $(top_srcdir)/src/libmme.la
mmed_LDFLAGS = -export-dynamic
dist_nextepc_mmed_SOURCES = main.c
nextepc_mmed_LDADD = $(top_srcdir)/src/libmme.la
dist_hssd_SOURCES = main.c
hssd_LDADD = $(top_srcdir)/src/libhss.la
hssd_LDFLAGS = -export-dynamic
dist_nextepc_hssd_SOURCES = main.c
nextepc_hssd_LDADD = $(top_srcdir)/src/libhss.la
dist_sgwd_SOURCES = main.c
sgwd_LDADD = $(top_srcdir)/src/libsgw.la
sgwd_LDFLAGS = -export-dynamic
dist_nextepc_sgwd_SOURCES = main.c
nextepc_sgwd_LDADD = $(top_srcdir)/src/libsgw.la
dist_pgwd_SOURCES = main.c
pgwd_LDADD = $(top_srcdir)/src/libpgw.la
pgwd_LDFLAGS = -export-dynamic
dist_nextepc_pgwd_SOURCES = main.c
nextepc_pgwd_LDADD = $(top_srcdir)/src/libpgw.la
dist_pcrfd_SOURCES = main.c
pcrfd_LDADD = $(top_srcdir)/src/libpcrf.la
pcrfd_LDFLAGS = -export-dynamic
dist_nextepc_pcrfd_SOURCES = main.c
nextepc_pcrfd_LDADD = $(top_srcdir)/src/libpcrf.la
dist_epcd_SOURCES = main.c
epcd_LDADD = $(top_srcdir)/src/libepc.la
epcd_LDFLAGS = -export-dynamic
dist_nextepc_epcd_SOURCES = main.c
nextepc_epcd_LDADD = $(top_srcdir)/src/libepc.la
AM_CPPFLAGS = \
-I$(top_srcdir)/lib/core/include \
-I$(top_srcdir)/src
sysconf_DATA = \
support/nextepc.conf
freeDiameterdir = ${prefix}/etc/freeDiameter
freeDiameter_DATA = \
support/freeDiameter/mme.conf \
support/freeDiameter/hss.conf \
support/freeDiameter/pgw.conf \
support/freeDiameter/pcrf.conf
dist_freeDiameter_DATA = \
support/freeDiameter/cacert.pem \
support/freeDiameter/mme.key.pem \
support/freeDiameter/mme.cert.pem \
support/freeDiameter/hss.key.pem \
support/freeDiameter/hss.cert.pem \
support/freeDiameter/pgw.key.pem \
support/freeDiameter/pgw.cert.pem \
support/freeDiameter/pcrf.key.pem \
support/freeDiameter/pcrf.cert.pem
-I$(top_srcdir)/src/app \
$(NULL)
install-data-hook:
$(MKDIR_P) $(prefix)/var/log
$(MKDIR_P) $(DESTDIR)/$(localstatedir)/log/nextepc
$(MKDIR_P) $(DESTDIR)/$(localstatedir)/run/nextepc-mmed
$(MKDIR_P) $(DESTDIR)/$(localstatedir)/run/nextepc-sgwd
$(MKDIR_P) $(DESTDIR)/$(localstatedir)/run/nextepc-pgwd
$(MKDIR_P) $(DESTDIR)/$(localstatedir)/run/nextepc-pcrfd
$(MKDIR_P) $(DESTDIR)/$(localstatedir)/run/nextepc-hssd
$(MKDIR_P) $(DESTDIR)/$(localstatedir)/run/nextepc-epcd
CLEANFILES = symtbl.c
CLEANFILES = -R data debian/test
DISTCLEANFILES = $(DIST_ARCHIVES)
MAINTAINERCLEANFILES = \
configure config.in \
@@ -66,6 +47,5 @@ MAINTAINERCLEANFILES = \
build-aux/ar-lib build-aux/config.guess build-aux/depcomp \
build-aux/ltmain.sh build-aux/test-driver build-aux/compile \
build-aux/config.sub build-aux/missing build-aux/install-sh \
.cscope.out .cscope.out.in .cscope.files .cscope.out.po \
Makefile.in
MOSTLYCLEANFILES = core *.stackdump

277
README.md
View File

@@ -1,267 +1,92 @@
Building NextEPC
What's NextEPC
================
This post will guide you on how to get installed with **NextEPC**. To date, **NextEPC** has been compiled and tested on GNU/Linux distributions(Debian, Ubuntu, Fedora, OpenSUSE) and FreeBSD.
NextEPC is a C-language Open Source implementation of the 3GPP Evolved Packet Core, i.e. the core network of an LTE network.
We will describe this guide using **Ubuntu 16.04 LTS (Xenial)**. You'll need to install **Ubuntu** if you don't have it installed already. To get the latest Ubuntu version, please visit the official Ubuntu website: [https://www.ubuntu.com/download/](https://www.ubuntu.com/download/).
NextEPC provides the MME (Mobility Management Engine), which terminates the S1 interfaces from the eNodeBs cells in the cellular network, and interfaces via S11 to the SGW as well as via S6a to the HSS.
## Install the dependencies for building the source
NextEPC provides the SGW (Serving Gateway) which is situated between the MME and PGW. It implements the S11 interface to the MME, and the S5 interface to the PGW.
The first step is to use **apt-get** to install all depedencies.
NextEPC provides the PGW or PDN-GW (Packet Data Network Gateway) element of the EPC, i.e. the gateway between the EPC and the external packet data network, such as the public Internet. It implements the S5 interface towards the S-GW, the SGi interface towards the Internet, and the S7 interface towards the PCRF.
NextEPC provides the HSS (Home Subscriber Server) element of the EPC, i.e. the central database of mobile network subscribers, with their IMSI, MSISDN, cryptographic key materials, service subscription information, etc. It implements the S6a interface towards the MME using the DIAMETER protocol.
NextEPC contains the PCRF (Policy and Charging Rules Function), which controls the service quality (QoS) of individual connections and how to account/charge related traffic. It implements the Gx interface towards the PGW using the DIAMETER protocol.
Installation
============
* ### MME, SGW, PGW, HSS, and PCRF
The NextEPC package is available on the recent versions of Ubuntu.
```bash
sudo apt-get -y install git gcc flex bison make autoconf libtool pkg-config libsctp-dev libssl-dev libgnutls-dev libgcrypt-dev libmongoc-dev libbson-dev mongodb
sudo add-apt-repository ppa:acetcom/nextepc
sudo apt-get update
sudo apt-get -y install nextepc
```
This will create a virtual network interface named as *pgwtun*. It is automatically removed by uninstalling NextEPC.
```markdown
ifconfig pgwtun
pgwtun Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:45.45.0.1 P-t-P:45.45.0.1 Mask:255.255.0.0
inet6 addr: fe80::50f6:182c:5aa3:16bb/64 Scope:Link
inet6 addr: cafe::1/64 Scope:Global
...
```
## Retrieve the latest version of the source package
The NextEPC service is registered in `systemd` environment, and is started automatically during the installation phase. The service names are *nextepc-mmed*, *nextepc-sgwd*, *nextepc-pgwd*, *nextepc-hssd*, and *nextepc-pcrfd*. You can use the `systemctl` command to control specific services.
```bash
git clone https://github.com/acetcom/nextepc
sudo systemctl status nextepc-mmed (Check the service status)
sudo systemctl stop nextepc-mmed (Stop the service)
sudo systemctl disable nextepc-mmed (Will not be started after rebooting)
sudo systemctl enable nextepc-mmed (Will be started after rebooting)
sudo systemctl start nextepc-mmed (Start the service)
sudo systemctl restart nextepc-mmed (Stop and start)
```
## Configure the build
```bash
cd nextepc
test -f configure || autoreconf -iv
CFLAGS='-O2' ./configure --prefix=`pwd`/install
```
## Compiling
Hopefully, once you have completed the autotools configuration, you only need to run:
```bash
make -j `nproc`
```
## Installing
Once the compilation is complete, you can install in the configured paths with:
```bash
make install
```
(this might require sudo depending on the configured target directories)
Web Setup
=========
NextEPC is configured with **Mongo DB**, which manages _Subscriber Information_ mainly, and **Configuration File** made in _JSON_ format.
The configuration file can be modified using a general editor such as vi or emacs, but _Subscriber Information_ can be managed properly using _Mongo DB Client_.
NextEPC provides **Web User Interface** solely designed to manage _Subscriber Information_ in an easy way without using _Mongo DB Client_. Let's how to install it from now on.
## Install Node.js and NPM
To get the latest **Node.js** and **NPM** version, you can visit the official **Node.js** website:
[https://nodesjs.org/en/download/](https://nodesjs.org/en/download/).
Or, you can install _Node.js_ and _NPM_ on **Ubuntu** as follows:
* ### Web User Interface
```bash
sudo apt-get -y install curl
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get -y install nodejs
curl -sL http://nextepc.org/static/webui/install | sudo -E bash -
```
## Install the dependencies for building the source
The first step is to use **npm** to install all depedencies.
The service name is *nextepc-webui*, and it will be running on _http://localhost:3000_.
```bash
cd nextepc/webui
npm install
sudo systemctl start nextepc-webui
```
## Build Web User Interface
```bash
npm run build
```
## Running Web Server
* ### Uninstall NextEPC
```bash
npm run start
curl -sL http://nextepc.org/static/webui/uninstall | sudo -E bash -
sudo apt-get purge nextepc*
```
## Login with default account
Use **Web Browser** to connect it. _http://localhost:3000_
* Username : admin
* Password : 1423
Then, you can change your password in _Account_ Menu.
Network Configuration
=====================
NextEPC consists of five nodes such as _MME, SGW, PGW, HSS and PCRF_. Basically, each node can be installed in a physically separate host or in the same host.
We will run these five nodes that make up NextEPC in a **Single Host**. The reason is why it is the easiest way to understand how to configure NextEPC network.
## IP Configuration
In order to run _MME, HSS, SGW, PGW, and PCRF_ on a **Single Host**, IP address is set by using **IP aliasing**.
You may need to remove manually /var/log/nextepc unless it is empty.
```bash
sudo ifconfig eth1:hss 10.1.35.214/24 up
sudo ifconfig eth1:mme 10.1.35.215/24 up
sudo ifconfig eth1:sgw_s5 10.1.35.216/24 up
sudo ifconfig eth1:sgw_s11 10.1.35.217/24 up
sudo ifconfig eth1:pcrf 10.1.35.218/24 up
sudo ifconfig eth1:pgw 10.1.35.219/24 up
sudo rm -Rf /var/log/nextepc
```
## Setup for Data Path
Use the **TUN Driver** to make _Data Path_ to be used by the **PGW**.
## Documentation
```bash
sudo ip tuntap add name pgwtun mode tun
sudo ifconfig pgwtun 45.45.0.1/16 up
```
If you don't understand something about NextEPC, the [http://nextepc.org](http://nextepc.org/) is a great place to look for answers.
## Check Configuration File
A configuration file is located `etc/nextepc.conf` from the installed paths. If you need to change the IP address for a particular problem, you should modify `XXXX_IPV4` field in the configuration file.
## Support
For example, if you want the IP aliasing address of *PGW* to be _10.1.35.254_, `PGW.NETWORK.S5C_IPV4` and `PGW_NETWORK.S5U_IPV4` field should be updated like the followings.
Problem with NextEPC can be filed as [issues](https://github.com/acetcom/nextepc/issues) in this repository. And also, we've created slack workspace named _nextepc.slack.com_. Use [this link](https://join.slack.com/t/nextepc/shared_invite/enQtMzMyMTIwMzY2MTAyLTJjYzQyYWFhYWZmNTBmNmFmY2EzMzJlY2VhYWMzYzY1NTE1YWYzZjFiMDM4ZDIxNDRhZTRmY2M2YmI4NzdmZjI) to get started.
<pre>
PGW :
{
FD_CONF_PATH : "/etc/freeDiameter
NETWORK :
{
S5C_IPV4: "10.1.35.254",
S5U_IPV4: "10.1.35.254"
}
## License
TUNNEL:
{
DEV_NAME: "pgwtun"
}
NextEPC source files are made available under the terms of the GNU Affero General Public License (GNU AGPLv3). See [this link](http://nextepc.org/docs/nextepc/4-license/) for details.
IP_POOL :
{
CIDR: 45.45.45.0/24
}
DNS :
{
PRIMARY_IPV4: "8.8.8.8",
SECONDARY_IPV4: "4.4.4.4"
}
}
</pre>
## Testing Network Configuration
Once you are done, run the testing script.
```bash
./test/testepc
```
You can see the simulated packet through **Wireshark**. _(FILTER : s1ap || gtpv2 || diameter)_
Running NextEPC
===============
## Update GUMMEI and TAI
The followings are the **GUMMEI** and **TAI** of the *MME* currently set to Default. Your *eNodeB* will also have a **PLMN ID** and **TAC** set. Refer to these parameters to change the setting of MME or eNodeB.
<pre>
GUMMEI:
{
PLMN_ID :
{
MCC : "001",
MNC : "01"
}
MME_GID : 2,
MME_CODE : 1
},
TAI:
{
PLMN_ID :
{
MCC: "001",
MNC: "01",
}
TAC: 12345
}
</pre>
For reference, MME can set several GUMMEI and TAI as **JSON array notation** as follows.
<pre>
GUMMEI:
[
{
PLMN_ID :
{
MCC : "001",
MNC : "01"
}
MME_GID : 2,
MME_CODE : 1
},
{
PLMN_ID :
{
MCC : "005",
MNC : "05"
}
MME_GID : 5,
MME_CODE : 6
},
]
TAI:
[
{
PLMN_ID :
{
MCC: "001",
MNC: "01",
}
TAC: 12345
},
{
PLMN_ID :
{
MCC: "005",
MNC: "05",
}
TAC: 6789
}
]
</pre>
## Register Subscriber Information
There is only one setting for this guide. The _Subscriber Information_ required for **HSS** should be registered in _Mongo DB_. Let's run the **Web User Interface** with `npm run start` as mentioned eariler.
Connect http://localhost:3000 using Web Browser.
* Go to Subscriber Menu
* Click + Button to add Subscriber Information
* Fill IMSI, Security(K, OP, AMF), APN in the Form
* Click the `SAVE` Button
## Running NextEPC
Generally, to use NextEPC in several hosts, you must use an independent daemon called _mmed, sgwd, pgwd, hssd, and pcrfd_.
However, we are preparing a more convenient daemon named **epcd**. It enables to service all five nodes of NextEPC.
```bash
./epcd
```
Turn on your **eNodeB** and **Mobile**. Check Wireshark!
Hopefully, you can see the real packet for TAU/Service Request, Dedicated Bearer, Multiple APN, and S1/X2-Handover.

View File

@@ -88,3 +88,21 @@ AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes],
[m4_default([$3], :)])
AS_VAR_POPDEF([CACHEVAR])dnl
])dnl AX_CHECK_COMPILE_FLAGS
# adl_RECURSIVE_EVAL(VALUE, RESULT)
# =================================
# Interpolate the VALUE in loop until it doesn't change,
# and set the result to $RESULT.
# WARNING: It's easy to get an infinite loop with some unsane input.
# For example ${datadir} becomes ${datarootdir}, and then ${prefix}/share, and
# finally ${prefix} is replaced by the prefix.
AC_DEFUN([adl_RECURSIVE_EVAL],
[_lcl_receval="$1"
$2=`(test "x$prefix" = xNONE && prefix="$ac_default_prefix"
test "x$exec_prefix" = xNONE && exec_prefix="${prefix}"
_lcl_receval_old=''
while test "[$]_lcl_receval_old" != "[$]_lcl_receval"; do
_lcl_receval_old="[$]_lcl_receval"
eval _lcl_receval="\"[$]_lcl_receval\""
done
echo "[$]_lcl_receval")`])

View File

@@ -8,31 +8,34 @@ dnl This program is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
dnl implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
AC_INIT([NEXTEPC], [0.1.0], [acetcom@gmail.com])
AC_INIT([NextEPC], [0.3.9], [acetcom@gmail.com])
AC_SUBST(LIBVERSION)
LIBVERSION=1:0:0
CORE_CONFIG_NICE(config.nice)
dnl Must come before AM_INIT_AUTOMAKE.
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([1.10 -Wall -Werror foreign])
# Minimum Autoconf version required.
AC_PREREQ(2.63)
AC_CONFIG_TESTDIR(test)
AM_INIT_AUTOMAKE([1.10 -Wall -Werror foreign subdir-objects])
# Where to generate output; srcdir location.
AC_CONFIG_HEADERS([config.h:config.in])dnl Keep filename to 8.3 for MS-DOS.
AC_CONFIG_SRCDIR([main.c])
AC_CANONICAL_HOST
LO_DEV="lo0"
case $host in
*linux*)
OSDIR="unix"
OSCPPFLAGS="-DLINUX=1"
IPFW_CPPFLAGS="-DNEED_SYSCTLBYNAME -DNEED_SIN_LEN"
LO_DEV="lo"
;;
*-apple-darwin*)
OSDIR="unix"
OSPPCFLAGS="-DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK"
OSCPPFLAGS="-DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK"
;;
*)
OSDIR="unix"
@@ -41,6 +44,7 @@ esac
AC_SUBST(OSCPPFLAGS)
AC_SUBST(OSDIR)
AC_SUBST(IPFW_CPPFLAGS)
AC_SUBST(LO_DEV)
AH_TOP([
#ifndef __NEXTEPC_CONFIG_H__
@@ -63,18 +67,23 @@ AH_VERBATIM([_REENTRANT],
#endif
])
dnl Checks CC and freinds
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_AWK
AC_PROG_SED
#AC_PROG_YACC
#AC_PROG_LEX
AM_PROG_AR
dnl kernel style compile messages
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
dnl libtool
LT_INIT
dnl Checks CC and freinds
AC_PROG_MAKE_SET
AC_PROG_MKDIR_P
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_INSTALL
AM_PROG_AR
LT_INIT([pic-only disable-static])
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
if test "x$PKG_CONFIG" = "xno"; then
AC_MSG_ERROR([You need to install pkg-config])
fi
PKG_PROG_PKG_CONFIG([0.20])
dnl Checks for compile flag
AX_CHECK_COMPILE_FLAG([-Wno-unused-result], [CFLAGS="$CFLAGS -Wno-unused-result"])
@@ -153,6 +162,32 @@ AC_SUBST(uint64_t_hex_fmt)
AC_SUBST(int64_literal)
AC_SUBST(uint64_literal)
AC_CHECK_SIZEOF(pid_t, 8)
if test "$ac_cv_sizeof_pid_t" = "$ac_cv_sizeof_short"; then
pid_t_fmt='#define C_PID_T_FMT "hd"'
elif test "$ac_cv_sizeof_pid_t" = "$ac_cv_sizeof_int"; then
pid_t_fmt='#define C_PID_T_FMT "d"'
elif test "$ac_cv_sizeof_pid_t" = "$ac_cv_sizeof_long"; then
pid_t_fmt='#define C_PID_T_FMT "ld"'
elif test "$ac_cv_sizeof_pid_t" = "$ac_cv_sizeof_long_long"; then
pid_t_fmt='#define C_PID_T_FMT APR_INT64_T_FMT'
else
pid_t_fmt='#error Can not determine the proper size for pid_t'
fi
case $host in
*-solaris*)
if test "$ac_cv_sizeof_long" = "8"; then
pid_t_fmt='#define C_PID_T_FMT "d"'
else
pid_t_fmt='#define C_PID_T_FMT "ld"'
fi
;;
esac
AC_SUBST(pid_t_fmt)
AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
[`echo $PACKAGE_VERSION | $SED 's/^\([[^\.]]\+\)\.\([[^\.]]\+\)\.\([[^\.]]\+\).*/\1/'`],
[Major version of this package])
@@ -163,6 +198,19 @@ AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL],
[`echo $PACKAGE_VERSION | $SED 's/^\([[^\.]]\+\)\.\([[^\.]]\+\)\.\([[^\.]]\+\).*/\3/'`],
[Patch version of this package])
##################################
#### Checks for Directories. #####
##################################
adl_RECURSIVE_EVAL(["${bindir}"], [BIN_DIR])
adl_RECURSIVE_EVAL(["${libdir}"], [LIB_DIR])
adl_RECURSIVE_EVAL(["${sysconfdir}"], [SYSCONF_DIR])
adl_RECURSIVE_EVAL(["${localstatedir}"], [LOCALSTATE_DIR])
AC_SUBST(BIN_DIR)
AC_SUBST(LIB_DIR)
AC_SUBST(SYSCONF_DIR)
AC_SUBST(LOCALSTATE_DIR)
##################################
#### Checks for header files. ####
##################################
@@ -192,10 +240,11 @@ AC_CHECK_HEADERS( \
net/if.h \
netinet/ether.h \
netinet/in.h \
netinet/ip.h \
netinet/in_systm.h \
netinet/udp.h \
netinet/tcp.h \
netinet/sctp.h \
usrsctp.h \
sys/ioctl.h \
sys/param.h \
sys/socket.h \
@@ -207,6 +256,29 @@ AC_CHECK_HEADERS( \
sys/uio.h \
)
AC_CHECK_HEADERS(netinet/ip.h netinet/ip6.h net/route.h,,,[[
#include <sys/types.h>
#if HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#include <netinet/in.h>
#if HAVE_NETINET_IN_SYSTM_H
#include <netinet/in_systm.h>
#endif
]])
AC_CHECK_HEADERS(netinet/ip_icmp.h netinet/icmp6.h,,,[[
#include <sys/types.h>
#if HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#include <netinet/in.h>
#if HAVE_NETINET_IN_SYSTM_H
#include <netinet/in_systm.h>
#endif
#include <netinet/ip.h>
]])
##########################################
#### Checks for typedefs, structures, ####
#### and compiler characteristics. ####
@@ -218,6 +290,41 @@ AC_CHECK_MEMBERS([struct tm.tm_gmtoff, struct tm.__tm_gmtoff],,,[
#include <sys/types.h>
#include <time.h>])
AC_CHECK_MEMBER(struct sockaddr.sa_len,
AC_DEFINE(HAVE_SA_LEN, 1, [Define this if your stack has sa_len in sockaddr struct.]),,
[#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include <sys/socket.h>])
AC_CHECK_MEMBER(struct sockaddr_in.sin_len,
AC_DEFINE(HAVE_SIN_LEN, 1, [Define this if your IPv4 has sin_len in sockaddr_in struct.]),,
[#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include <netinet/in.h>])
AC_CHECK_MEMBER(struct sockaddr_in6.sin6_len,
AC_DEFINE(HAVE_SIN6_LEN, 1, [Define this if your IPv6 has sin6_len in sockaddr_in6 struct.]),,
[#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include <netinet/in.h>])
AC_CHECK_MEMBER(struct sockaddr_conn.sconn_len,
AC_DEFINE(HAVE_SCONN_LEN, 1, [Define this if your userland stack has sconn_len in sockaddr_conn struct.]),,
[#include "usrsctplib/usrsctp.h"])
AC_MSG_CHECKING(for socklen_t)
AC_TRY_COMPILE([#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include <sys/socket.h>],
[socklen_t x; x = 1; return ((int)x);],
[AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(int)
AC_DEFINE(socklen_t, int, [Define a type for socklen_t.])])
AC_CHECK_FILE(/dev/random,
AC_DEFINE([HAVE_DEV_RANDOM], [1],
[Define to 1 if you have the /dev/random file.]))
@@ -272,39 +379,36 @@ AC_FUNC_VPRINTF
AC_CHECK_FUNCS(\
atexit \
gettimeofday \
inet_ntop \
inet_pton \
inet_aton \
memmove \
sigaction \
sigwait \
sigsuspend \
stpcpy \
strcasecmp \
strtoul \
stricmp \
strerror \
inet_ntop inet_pton inet_aton \
sigaction sigwait sigsuspend \
stpcpy strcasecmp strtoul stricmp \
writev \
utime \
utimes \
sem_timedwait \
pthread_yield \
sched_yield \
utime utimes sem_timedwait \
pthread_yield sched_yield \
getenv putenv setenv unsetenv \
)
AC_CHECK_LIB([pthread], [pthread_mutex_init], [LIBS="${LIBS} -lpthread"])
AC_CHECK_LIB([dl], [dlopen], [LIBS="${LIBS} -ldl"])
AC_CHECK_LIB([sctp], [sctp_sendmsg], [LIBS="${LIBS} -lsctp"])
AC_CHECK_LIB([gnutls], [gnutls_global_init], [LIBS="${LIBS} -lgnutls"])
AC_CHECK_LIB([gcrypt], [gcry_control], [LIBS="${LIBS} -lgcrypt"])
AC_CHECK_LIB([idn], [idna_strerror], [LIBS="${LIBS} -lidn"])
#AC_CHECK_LIB([fdcore], [fd_core_initialize], [LIBS="${LIBS} -lfdcore"])
#AC_CHECK_LIB([fdproto], [fd_libproto_init], [LIBS="${LIBS} -lfdproto"])
AC_SEARCH_LIBS(gethostbyname, nsl)
AC_SEARCH_LIBS(gethostname, nsl)
AC_SEARCH_LIBS(socket, socket)
AC_SEARCH_LIBS(pthread_barrier_wait, pthread)
AC_SEARCH_LIBS(gnutls_global_set_log_level, gnutls)
AC_SEARCH_LIBS([sctp_sendmsg], [sctp], [have_sctp_lib=yes], [have_sctp_lib=no])
if test x$have_sctp_lib == xno; then
AC_SEARCH_LIBS([usrsctp_init], [usrsctp], [have_usrsctp_lib=yes], [have_usrsctp_lib=no])
if test x$have_usrsctp_lib == xno; then
AC_MSG_ERROR([You must install the SCTP libraries and development headers to enable SCTP support.])
else
AC_DEFINE([USE_USRSCTP], [1], [Define to 1 if you have the usrsctp library.])
fi
fi
AM_CONDITIONAL([USRSCTP], [test x$have_usrsctp_lib = xyes])
PKG_CHECK_MODULES([YAML], yaml-0.1 >= 0.1.4)
PKG_CHECK_MODULES([MONGOC], libmongoc-1.0 >= 1.3.1)
LIBS="$LIBS $MONGOC_LIBS"
#PKG_CHECK_MODULES([LIBXML2], libxml-2.0 >= 2.9.1)
#LIBS="$LIBS $LIBXML2_LIBS"
FREEDIAMETER_DIR=freeDiameter-1.2.1
AC_SUBST(FREEDIAMETER_DIR)
@@ -316,47 +420,48 @@ AC_CONFIG_SUBDIRS([lib/freeDiameter-1.2.1])
AC_CONFIG_FILES([lib/core/include/core.h])
AC_CONFIG_FILES([lib/core/src/Makefile])
case $host in
*)
AC_CONFIG_FILES([lib/core/src/unix/Makefile])
;;
esac
AC_CONFIG_FILES([lib/core/test/Makefile])
AC_CONFIG_FILES([lib/core/Makefile])
AC_CONFIG_FILES([lib/logger/Makefile])
AC_CONFIG_FILES([lib/base/Makefile])
AC_CONFIG_FILES([lib/s1ap/asn1c/Makefile])
AC_CONFIG_FILES([lib/s1ap/Makefile])
AC_CONFIG_FILES([lib/nas/Makefile])
AC_CONFIG_FILES([lib/fd/extensions/dbg_msg_dumps/Makefile])
#AC_CONFIG_FILES([lib/fd/extensions/dict_legacy_xml/Makefile])
AC_CONFIG_FILES([lib/fd/extensions/dict_rfc5777/Makefile])
AC_CONFIG_FILES([lib/fd/extensions/dict_mip6i/Makefile])
AC_CONFIG_FILES([lib/fd/extensions/dict_nasreq/Makefile])
AC_CONFIG_FILES([lib/fd/extensions/dict_nas_mipv6/Makefile])
AC_CONFIG_FILES([lib/fd/extensions/dict_dcca/Makefile])
AC_CONFIG_FILES([lib/fd/extensions/dict_dcca_3gpp/Makefile])
AC_CONFIG_FILES([lib/fd/extensions/dict_s6a/Makefile])
AC_CONFIG_FILES([lib/fd/extensions/Makefile])
AC_CONFIG_FILES([lib/fd/gx/Makefile])
AC_CONFIG_FILES([lib/fd/s6a/Makefile])
AC_CONFIG_FILES([lib/fd/Makefile])
AC_CONFIG_FILES([lib/gtp/Makefile])
AC_CONFIG_FILES([lib/ipfw/Makefile])
AC_CONFIG_FILES([lib/Makefile])
AC_CONFIG_FILES([src/app/Makefile])
AC_CONFIG_FILES([src/mme/Makefile])
AC_CONFIG_FILES([src/hss/Makefile])
AC_CONFIG_FILES([src/sgw/Makefile])
AC_CONFIG_FILES([src/pgw/Makefile])
AC_CONFIG_FILES([src/pcrf/Makefile])
AC_CONFIG_FILES([src/Makefile])
AC_CONFIG_FILES([test/Makefile])
AC_CONFIG_FILES([support/nextepc.conf])
AC_CONFIG_FILES([support/config/nextepc.conf])
AC_CONFIG_FILES([support/config/mme.conf])
AC_CONFIG_FILES([support/config/sgw.conf])
AC_CONFIG_FILES([support/config/pgw.conf])
AC_CONFIG_FILES([support/config/hss.conf])
AC_CONFIG_FILES([support/config/pcrf.conf])
AC_CONFIG_FILES([support/config/Makefile])
AC_CONFIG_FILES([support/freeDiameter/mme.conf])
AC_CONFIG_FILES([support/freeDiameter/hss.conf])
AC_CONFIG_FILES([support/freeDiameter/pgw.conf])
AC_CONFIG_FILES([support/freeDiameter/hss.conf])
AC_CONFIG_FILES([support/freeDiameter/pcrf.conf])
#AC_CONFIG_FILES([support/freeDiameter/dict_legacy_xml.conf])
AC_CONFIG_FILES([support/freeDiameter/Makefile])
AC_CONFIG_FILES([support/systemd/nextepc-mmed.service])
AC_CONFIG_FILES([support/systemd/nextepc-sgwd.service])
AC_CONFIG_FILES([support/systemd/nextepc-pgwd.service])
AC_CONFIG_FILES([support/systemd/nextepc-hssd.service])
AC_CONFIG_FILES([support/systemd/nextepc-pcrfd.service])
AC_CONFIG_FILES([support/systemd/Makefile])
AC_CONFIG_FILES([support/logrotate/nextepc])
AC_CONFIG_FILES([support/logrotate/Makefile])
AC_CONFIG_FILES([support/newsyslog/nextepc.conf])
AC_CONFIG_FILES([support/newsyslog/Makefile])
AC_CONFIG_FILES([support/Makefile])
AC_CONFIG_FILES([test/sample.conf])
AC_CONFIG_FILES([test/sample-volte.conf])
AC_CONFIG_FILES([test/Makefile])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
@@ -367,8 +472,10 @@ version : ${PACKAGE_VERSION}
host : ${host}
source code location : ${srcdir}
compiler : ${CC}
compiler flags : ${CFLAGS}
linker flags : ${LDFLAGS} ${LIBS}
config file directory : `eval echo \`echo ${sysconfdir}\``
log file directory : `eval echo \`echo ${prefix}/var/log\``
compiler flags : ${CFLAGS} ${YAML_CFLAGS} ${MONGOC_CFLAGS}
linker flags : ${LDFLAGS} ${LIBS} ${YAML_LIBS} ${MONGOC_LIBS}
bin directory : ${BIN_DIR}
lib directory : ${LIB_DIR}/nextepc
config directory : ${SYSCONF_DIR}/nextepc
log directory : ${LOCALSTATE_DIR}/log/nextepc
"

368
debian/changelog vendored Normal file
View File

@@ -0,0 +1,368 @@
nextepc (0.3.9~artful) artful; urgency=medium
* Bug Fixed
-- Sukchan Lee <acetcom@gmail.com> Sun, 03 Jun 2018 01:40:44 +0000
nextepc (0.3.9~xenial) xenial; urgency=medium
* Bug Fixed
-- Sukchan Lee <acetcom@gmail.com> Sun, 03 Jun 2018 01:39:33 +0000
nextepc (0.3.9~bionic) bionic; urgency=medium
* Bug Fixed
-- Sukchan Lee <acetcom@gmail.com> Sun, 03 Jun 2018 01:38:15 +0000
nextepc (0.3.8-1~bionic) bionic; urgency=medium
* Bug Fixed
-- Sukchan Lee <acetcom@gmail.com> Sat, 05 May 2018 22:37:45 +0900
nextepc (0.3.8~bionic) bionic; urgency=medium
* Bug Fixed
-- Sukchan Lee <acetcom@gmail.com> Sat, 05 May 2018 21:48:55 +0900
nextepc (0.3.8~xenial) xenial; urgency=medium
* Bug Fixed
-- Sukchan Lee <acetcom@gmail.com> Sun, 29 Apr 2018 21:47:25 +0900
nextepc (0.3.8~artful) artful; urgency=medium
* Bug Fixed
-- Sukchan Lee <acetcom@gmail.com> Sun, 29 Apr 2018 21:45:36 +0900
nextepc (0.3.7~artful) artful; urgency=medium
* Buf Fixed
-- Sukchan Lee <acetcom@gmail.com> Sat, 14 Apr 2018 15:02:05 +0900
nextepc (0.3.7~xenial) xenial; urgency=medium
* Bug Fixed
-- Sukchan Lee <acetcom@gmail.com> Sat, 14 Apr 2018 14:59:37 +0900
nextepc (0.3.6~xenial) xenial; urgency=medium
* Bug Fixed
-- Sukchan Lee <acetcom@gmail.com> Wed, 21 Mar 2018 08:02:52 +0000
nextepc (0.3.6~artful) artful; urgency=medium
* Bug Fixed
-- Sukchan Lee <acetcom@gmail.com> Wed, 21 Mar 2018 08:00:12 +0000
nextepc (0.3.5~xenial) xenial; urgency=medium
* Bug Fixed
-- Sukchan Lee <acetcom@gmail.com> Tue, 06 Mar 2018 12:41:53 +0000
nextepc (0.3.5~artful) artful; urgency=medium
* Bug Fixed
-- Sukchan Lee <acetcom@gmail.com> Tue, 06 Mar 2018 12:40:07 +0000
nextepc (0.3.4-1~xenial) xenial; urgency=medium
* Bug Fixed
-- Sukchan Lee <acetcom@gmail.com> Thu, 22 Feb 2018 02:16:08 +0000
nextepc (0.3.4-1~artful) artful; urgency=medium
* Bug Fixed
-- Sukchan Lee <acetcom@gmail.com> Thu, 22 Feb 2018 02:14:43 +0000
nextepc (0.3.4~xenial) xenial; urgency=medium
* Bug Fixed
-- Sukchan Lee <acetcom@gmail.com> Thu, 22 Feb 2018 02:09:23 +0000
nextepc (0.3.4~artful) artful; urgency=medium
* Bug Fixed
-- Sukchan Lee <acetcom@gmail.com> Thu, 22 Feb 2018 01:33:04 +0000
nextepc (0.3.3-3~artful) artful; urgency=medium
* Support Docker
-- Sukchan Lee <acetcom@gmail.com> Tue, 13 Feb 2018 04:47:43 +0000
nextepc (0.3.3-3~xenial) xenial; urgency=medium
* Support Docker
-- Sukchan Lee <acetcom@gmail.com> Tue, 13 Feb 2018 04:44:47 +0000
nextepc (0.3.3-2~xenial) xenial; urgency=medium
* Minor bug fixes
-- Sukchan Lee <acetcom@gmail.com> Sun, 11 Feb 2018 16:08:14 +0000
nextepc (0.3.3-2~artful) artful; urgency=medium
* Minor bug fixes
-- Sukchan Lee <acetcom@gmail.com> Sun, 11 Feb 2018 16:05:44 +0000
nextepc (0.3.3-1~xenial) xenial; urgency=medium
* Minor bug fixes
-- Sukchan Lee <acetcom@gmail.com> Sun, 11 Feb 2018 15:39:37 +0000
nextepc (0.3.3-1~artful) artful; urgency=medium
* Minor bug fixes
-- Sukchan Lee <acetcom@gmail.com> Sun, 11 Feb 2018 15:33:57 +0000
nextepc (0.3.3~artful) artful; urgency=medium
* Minor bug fixes
-- Sukchan Lee <acetcom@gmail.com> Sun, 11 Feb 2018 15:05:08 +0000
nextepc (0.3.3~xenial) xenial; urgency=medium
* Minor bug fixes
-- Sukchan Lee <acetcom@gmail.com> Sun, 11 Feb 2018 15:00:24 +0000
nextepc (0.3.2~zesty) zesty; urgency=medium
* VoLTE Support
-- Sukchan Lee <acetcom@gmail.com> Wed, 24 Jan 2018 08:06:32 +0000
nextepc (0.3.2~xenial) xenial; urgency=medium
* VoLTE Support
-- Sukchan Lee <acetcom@gmail.com> Wed, 24 Jan 2018 08:03:41 +0000
nextepc (0.3.2~artful) artful; urgency=medium
* VoLTE Support
-- Sukchan Lee <acetcom@gmail.com> Wed, 24 Jan 2018 08:00:24 +0000
nextepc (0.3.1-1~zesty) zesty; urgency=medium
* IPv6 Support (Linux Only)
* Change Configuration File (JSON -> YAML)
-- Sukchan Lee <acetcom@gmail.com> Sun, 31 Dec 2017 22:10:52 +0000
nextepc (0.3.1-1~xenial) xenial; urgency=medium
* IPv6 Support (Linux Only)
* Change Configuration File (JSON -> YAML)
-- Sukchan Lee <acetcom@gmail.com> Sun, 31 Dec 2017 22:09:26 +0000
nextepc (0.3.1-1~artful) artful; urgency=medium
* IPv6 Support (Linux Only)
* Change Configuration File (JSON -> YAML)
-- Sukchan Lee <acetcom@gmail.com> Sun, 31 Dec 2017 22:04:50 +0000
nextepc (0.3-3~zesty) zesty; urgency=medium
* IPv6 Support (Linux Only)
* Change Configuration File (JSON -> YAML)
-- Sukchan Lee <acetcom@gmail.com> Mon, 18 Dec 2017 10:18:26 +0000
nextepc (0.3-3~xenial) xenial; urgency=medium
* IPv6 Support (Linux Only)
* Change Configuration File (JSON -> YAML)
-- Sukchan Lee <acetcom@gmail.com> Mon, 18 Dec 2017 10:16:51 +0000
nextepc (0.3-3~artful) artful; urgency=medium
* IPv6 Support (Linux Only)
* Change Configuration File (JSON -> YAML)
-- Sukchan Lee <acetcom@gmail.com> Mon, 18 Dec 2017 10:15:18 +0000
nextepc (0.3-2~artful) artful; urgency=medium
* Fix the bug reboot scenario
-- Sukchan Lee <acetcom@gmail.com> Mon, 18 Dec 2017 07:06:52 +0000
nextepc (0.3-1~artful) artful; urgency=medium
* IPv6 Support (Linux Only)
* Change Configuration File (JSON -> YAML)
-- Sukchan Lee <acetcom@gmail.com> Mon, 18 Dec 2017 05:07:31 +0000
nextepc (0.2-6~artful2) artful; urgency=medium
* postrm script is improved to purge package completely.
-- Sukchan Lee <acetcom@gmail.com> Fri, 03 Nov 2017 02:30:53 +0000
nextepc (0.2-6~zesty2) zesty; urgency=medium
* postrm script is improved to purge package completely.
-- Sukchan Lee <acetcom@gmail.com> Fri, 03 Nov 2017 02:30:08 +0000
nextepc (0.2-6~xenial2) xenial; urgency=medium
* postrm script is improved to purge package completely.
-- Sukchan Lee <acetcom@gmail.com> Fri, 03 Nov 2017 02:28:41 +0000
nextepc (0.2-6~zesty) zesty; urgency=medium
* postrm script is improved to purge package completely.
-- Sukchan Lee <acetcom@gmail.com> Fri, 03 Nov 2017 02:25:37 +0000
nextepc (0.2-6~xenial) xenial; urgency=medium
* postrm script is improved to purge package completely.
-- Sukchan Lee <acetcom@gmail.com> Fri, 03 Nov 2017 02:23:54 +0000
nextepc (0.2-6~artful) artful; urgency=medium
* postrm script is improved to purge package completely.
-- Sukchan Lee <acetcom@gmail.com> Fri, 03 Nov 2017 02:00:14 +0000
nextepc (0.2-5~artful) artful; urgency=medium
* Relase 0.2
-- Sukchan Lee <acetcom@gmail.com> Thu, 02 Nov 2017 07:13:23 +0000
nextepc (0.2-5~zesty) zesty; urgency=medium
* Relase 0.2
-- Sukchan Lee <acetcom@gmail.com> Thu, 02 Nov 2017 07:12:17 +0000
nextepc (0.2-5~xenial) xenial; urgency=medium
* Release 0.2
-- Sukchan Lee <acetcom@gmail.com> Thu, 02 Nov 2017 07:11:16 +0000
nextepc (0.2-4~xenial2) xenial; urgency=medium
* Fix the bug nextepc-pgwd post install script
-- Sukchan Lee <acetcom@gmail.com> Tue, 31 Oct 2017 14:07:54 +0000
nextepc (0.2-4~artful) artful; urgency=medium
* Fix the bug nextepc-pgwd post install script
-- Sukchan Lee <acetcom@gmail.com> Tue, 31 Oct 2017 14:06:31 +0000
nextepc (0.2-4~zesty) zesty; urgency=medium
* Fix the bug nextepc-pgwd post install script
-- Sukchan Lee <acetcom@gmail.com> Tue, 31 Oct 2017 14:04:23 +0000
nextepc (0.2-4~xenial) xenial; urgency=medium
* Fix the bug nextepc-pgwd post install script
-- Sukchan Lee <acetcom@gmail.com> Tue, 31 Oct 2017 14:01:58 +0000
nextepc (0.2-3~artful) artful; urgency=medium
* MongoDB re-connect using systemd
-- Sukchan Lee <acetcom@gmail.com> Tue, 31 Oct 2017 12:10:18 +0000
nextepc (0.2-3~zesty) zesty; urgency=medium
* MongoDB re-connect using systemd
-- Sukchan Lee <acetcom@gmail.com> Tue, 31 Oct 2017 12:07:36 +0000
nextepc (0.2-3~xenial) xenial; urgency=medium
* MongoDB re-connect using systemd
-- Sukchan Lee <acetcom@gmail.com> Tue, 31 Oct 2017 12:00:16 +0000
nextepc (0.2-2~artful) artful; urgency=medium
* Fix PGW installation
-- Sukchan Lee <acetcom@gmail.com> Tue, 31 Oct 2017 05:02:03 +0000
nextepc (0.2-2~xenial) xenial; urgency=medium
* Fix PGW installation
-- Sukchan Lee <acetcom@gmail.com> Tue, 31 Oct 2017 03:16:02 +0000
nextepc (0.2-1~artful2) artful; urgency=medium
* Fix the compile error [-Werror=pointer]
-- Sukchan Lee <acetcom@gmail.com> Mon, 30 Oct 2017 13:14:42 +0000
nextepc (0.2-1~artful1) artful; urgency=medium
* Remove mongodb build-dependancy for Ubuntu 17.10(i386)
-- Sukchan Lee <acetcom@gmail.com> Mon, 30 Oct 2017 12:46:58 +0000
nextepc (0.2-1~artful) artful; urgency=medium
* Ubuntu 17.10(amd64)
* Currently, `mongodb` is not available in Ubuntu 17.10(i386)
-- Sukchan Lee <acetcom@gmail.com> Mon, 30 Oct 2017 06:50:47 +0000
nextepc (0.2-1~zesty) zesty; urgency=medium
* Ubuntu 17.04
-- Sukchan Lee <acetcom@gmail.com> Mon, 30 Oct 2017 06:47:55 +0000
nextepc (0.2-1~xenial) xenial; urgency=medium
* Add matapackage
* dh_overide_auto_test is re-enabled
-- Sukchan Lee <acetcom@gmail.com> Mon, 30 Oct 2017 03:48:39 +0000
nextepc (0.1.1) UNRELEASED; urgency=medium
* Initial release.
-- Harald Welte <laforge@gnumonks.org> Tue, 17 Oct 2017 08:19:54 +0200

1
debian/compat vendored Normal file
View File

@@ -0,0 +1 @@
9

134
debian/control vendored Normal file
View File

@@ -0,0 +1,134 @@
Source: nextepc
Maintainer: Harald Welte <laforge@gnumonks.org>
Section: net
Priority: optional
Build-Depends: debhelper (>= 9),
autotools-dev,
pkg-config,
git,
dh-autoreconf,
dh-systemd,
flex,
bison,
libsctp-dev,
libgnutls28-dev,
libgcrypt-dev,
libssl-dev,
libidn11-dev,
libmongoc-dev,
libbson-dev,
libyaml-dev
Standards-Version: 3.9.6
Vcs-Browser: https://github.com/acetcom/nextepc
Vcs-Git: git://github.com/acetcom/nextepc
Homepage: http://nextepc.org/
Package: nextepc-core
Architecture: any
Multi-Arch: same
Depends: ${shlibs:Depends},
${misc:Depends}
Description: Open Source based 3GPP EPC (Shared Files)
NextEPC is a C-language Open Source implementation of the 3GPP Evolved
Packet Core, i.e. the core network of an LTE network.
.
This package contains some core libraries/plugins required by the other
binary packages such as nextepc-{mme,sgw,pgw,pcrf,hss}.
Package: nextepc-mme
Architecture: any
Multi-Arch: same
Depends: ${shlibs:Depends},
${misc:Depends},
nextepc-core (= ${binary:Version})
Description: Open Source based 3GPP EPC MME (Mobility Management Entity)
NextEPC is a C-language Open Source implementation of the 3GPP Evolved
Packet Core, i.e. the core network of an LTE network.
.
This package provides the MME (Mobility Management Engine), which
terminates the S1 interfaces from the eNodeBs cells in the cellular
network, and interfaces via S11 to the SGW as well as via S6a to the
HSS.
Package: nextepc-sgw
Architecture: any
Multi-Arch: same
Depends: ${shlibs:Depends},
${misc:Depends},
nextepc-core (= ${binary:Version})
Description: Open Source based 3GPP EPC SGW (Serving Gateway)
NextEPC is a C-language Open Source implementation of the 3GPP Evolved
Packet Core, i.e. the core network of an LTE network.
.
This package provides the SGW (Serving Gateway) which is situated
between the MME and PGW. It implements the S11 interface to the MME,
and the S5 interface to the PGW.
Package: nextepc-pgw
Architecture: any
Multi-Arch: same
Depends: ${shlibs:Depends},
${misc:Depends},
udev,
nextepc-core (= ${binary:Version})
Description: Open Source based 3GPP EPC PGW (Packet Data Network Gateway)
NextEPC is a C-language Open Source implementation of the 3GPP Evolved
Packet Core, i.e. the core network of an LTE network.
.
This package provides the PGW or PDN-GW (Packet Data Network Gateway)
element of the EPC, i.e. the gateway between the EPC and the external
packet data network, such as the public Internet. It implements the S5
interface towards the S-GW, the SGi interface towards the Internet,
and the S7 interface towards the PCRF.
Package: nextepc-pcrf
Architecture: any
Multi-Arch: same
Depends: ${shlibs:Depends},
${misc:Depends},
mongodb,
nextepc-core (= ${binary:Version})
Description: Open Source based 3GPP EPC PCRF (Policy and Charging Rules Function)
NextEPC is a C-language Open Source implementation of the 3GPP Evolved
Packet Core, i.e. the core network of an LTE network.
.
This package contains the PCRF (Policy and Charging Rules Function),
which controls the service quality (QoS) of individual connections and
how to account/charge related traffic. It implements the Gx interface
towards the PGW using the DIAMETER protocol.
Package: nextepc-hss
Architecture: any
Multi-Arch: same
Depends: ${shlibs:Depends},
${misc:Depends},
mongodb,
nextepc-core (= ${binary:Version})
Description: Open Source based 3GPP EPC HSS (Home Subscriber Server)
NextEPC is a C-language Open Source implementation of the 3GPP Evolved
Packet Core, i.e. the core network of an LTE network.
.
This package provides the HSS (Home Subscriber Server) element of the
EPC, i.e. the central database of mobile network subscribers, with
their IMSI, MSISDN, cryptographic key materials, service subscription
information, etc. It implements the S6a interface towards the MME
using the DIAMETER protocol.
Package: nextepc
Architecture: any
Multi-Arch: same
Depends: ${shlibs:Depends},
${misc:Depends},
mongodb,
nextepc-core (= ${binary:Version}),
nextepc-mme (= ${binary:Version}),
nextepc-sgw (= ${binary:Version}),
nextepc-pgw (= ${binary:Version}),
nextepc-hss (= ${binary:Version}),
nextepc-pcrf (= ${binary:Version})
Description: Open Source based 3GPP EPC (metapackage)
NextEPC is a C-language Open Source implementation of the 3GPP Evolved
Packet Core, i.e. the core network of an LTE network.
.
This is a metapackage that depends on all the nextepc parts.
(MME, SGW, PGW, HSS, PCRF)

55
debian/copyright vendored Normal file
View File

@@ -0,0 +1,55 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: nextepc
Source: https://github.com/acetcom/nextepc
Files: *
Copyright: 2017 NextEPC Group
License: AGPL-3
Files: lib/freeDiameter-1.2.1/*
Copyright: 2008-2011, WIDE Project and NICT
License: BSD-3-clause
Files: debian/*
Copyright: 2017 Harald Welte <laforge@gnumonks.org>
License: GPL-3
License: GPL-3
This package is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; version 3 of the License
.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
.
On Debian systems, the complete text of the GNU General Public
License version 3 can be found in "/usr/share/common-licenses/GPL-3".
License: BSD-3-clause
Software License Agreement (BSD License)
.
Copyright (c) 2008-2011, WIDE Project and NICT
All rights reserved.
.
Redistribution and use of this software in source and binary forms, with or without modification, are·
permitted provided that the following conditions are met:
.
* Redistributions of source code must retain the above·
copyright notice, this list of conditions and the·
following disclaimer.
···
* Redistributions in binary form must reproduce the above·
copyright notice, this list of conditions and the·
following disclaimer in the documentation and/or other
materials provided with the distribution.
.
* Neither the name of the WIDE Project or NICT nor the·
names of its contributors may be used to endorse or·
promote products derived from this software without·
specific prior written permission of WIDE Project and·
NICT.

5
debian/nextepc-core.install vendored Normal file
View File

@@ -0,0 +1,5 @@
usr/lib/*/nextepc/*
var/log/nextepc
etc/nextepc/nextepc.conf
etc/nextepc/freeDiameter/cacert.pem
support/logrotate/nextepc /etc/logrotate.d

52
debian/nextepc-core.postinst vendored Normal file
View File

@@ -0,0 +1,52 @@
#!/bin/sh
# postinst script for nextepc
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <postinst> `abort-remove'
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
configure)
# create a nextepc group and user
if ! getent passwd nextepc >/dev/null; then
adduser --system --disabled-password --disabled-login \
--home /var/run/nextepc --no-create-home \
--quiet --group nextepc
fi
for dir in /var/log/nextepc; do
if ! dpkg-statoverride --list "$dir" >/dev/null 2>&1; then
dpkg-statoverride --update --add nextepc nextepc 0755 "$dir"
fi
done
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

44
debian/nextepc-core.postrm vendored Normal file
View File

@@ -0,0 +1,44 @@
#!/bin/sh
# postrm script for nextepc-core
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <postrm> `remove'
# * <postrm> `purge'
# * <old-postrm> `upgrade' <new-version>
# * <new-postrm> `failed-upgrade' <old-version>
# * <new-postrm> `abort-install'
# * <new-postrm> `abort-install' <old-version>
# * <new-postrm> `abort-upgrade' <old-version>
# * <disappearer's-postrm> `disappear' <overwriter>
# <overwriter-version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
purge)
rm -f /var/log/nextepc/*.log || true
rmdir /var/log/nextepc || true
;;
remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
;;
*)
echo "postrm called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

6
debian/nextepc-hss.install vendored Normal file
View File

@@ -0,0 +1,6 @@
usr/bin/nextepc-hssd
etc/nextepc/freeDiameter/hss.conf
etc/nextepc/freeDiameter/hss.cert.pem
etc/nextepc/freeDiameter/hss.key.pem
etc/nextepc/hss.conf
support/systemd/nextepc-hssd.service lib/systemd/system

6
debian/nextepc-mme.install vendored Normal file
View File

@@ -0,0 +1,6 @@
usr/bin/nextepc-mmed
etc/nextepc/freeDiameter/mme.conf
etc/nextepc/freeDiameter/mme.cert.pem
etc/nextepc/freeDiameter/mme.key.pem
etc/nextepc/mme.conf
support/systemd/nextepc-mmed.service lib/systemd/system

6
debian/nextepc-pcrf.install vendored Normal file
View File

@@ -0,0 +1,6 @@
usr/bin/nextepc-pcrfd
etc/nextepc/freeDiameter/pcrf.conf
etc/nextepc/freeDiameter/pcrf.cert.pem
etc/nextepc/freeDiameter/pcrf.key.pem
etc/nextepc/pcrf.conf
support/systemd/nextepc-pcrfd.service lib/systemd/system

7
debian/nextepc-pgw.install vendored Normal file
View File

@@ -0,0 +1,7 @@
usr/bin/nextepc-pgwd
etc/nextepc/freeDiameter/pgw.conf
etc/nextepc/freeDiameter/pgw.cert.pem
etc/nextepc/freeDiameter/pgw.key.pem
etc/nextepc/pgw.conf
support/network/99-nextepc.* etc/systemd/network
support/systemd/nextepc-pgwd.service lib/systemd/system

53
debian/nextepc-pgw.postinst vendored Normal file
View File

@@ -0,0 +1,53 @@
#!/bin/sh
# postinst script for nextepc
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <postinst> `abort-remove'
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
configure)
if test "x`sysctl -n net.ipv6.conf.all.disable_ipv6`" = x1; then
echo "net.ipv6.conf.all.disable_ipv6=0" > /etc/sysctl.d/30-nextepc.conf
sysctl -p /etc/sysctl.d/30-nextepc.conf
fi
if test "x`systemctl is-enabled systemd-networkd`" = xdisabled; then
systemctl enable systemd-networkd
fi
deb-systemd-invoke restart systemd-networkd
if test -f /etc/sysctl.d/30-nextepc.conf && grep "pgwtun" /proc/net/dev > /dev/null; then
echo "net.ipv6.conf.pgwtun.disable_ipv6=0" > /etc/sysctl.d/30-nextepc.conf
sysctl -p /etc/sysctl.d/30-nextepc.conf
fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

46
debian/nextepc-pgw.postrm vendored Normal file
View File

@@ -0,0 +1,46 @@
#!/bin/sh
# postrm script for nextepc-core
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <postrm> `remove'
# * <postrm> `purge'
# * <old-postrm> `upgrade' <new-version>
# * <new-postrm> `failed-upgrade' <old-version>
# * <new-postrm> `abort-install'
# * <new-postrm> `abort-install' <old-version>
# * <new-postrm> `abort-upgrade' <old-version>
# * <disappearer's-postrm> `disappear' <overwriter>
# <overwriter-version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
purge)
if grep "pgwtun" /proc/net/dev > /dev/null; then
ip tuntap del name pgwtun mode tun
fi
rm -f /etc/sysctl.d/30-nextepc.conf
;;
remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
;;
*)
echo "postrm called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

3
debian/nextepc-sgw.install vendored Normal file
View File

@@ -0,0 +1,3 @@
usr/bin/nextepc-sgwd
etc/nextepc/sgw.conf
support/systemd/nextepc-sgwd.service lib/systemd/system

22
debian/rules vendored Executable file
View File

@@ -0,0 +1,22 @@
#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1
DEBIAN := $(shell dpkg-parsechangelog | grep ^Version: | cut -d' ' -f2)
DEBVERS := $(shell echo '$(DEBIAN)' | cut -d- -f1)
VERSION := $(shell echo '$(DEBVERS)' | sed -e 's/[+-].*//' -e 's/~//g')
# This has to be exported to make some magic below work.
#export DH_OPTIONS
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
%:
dh $@ --with autoreconf --with systemd
override_dh_auto_test:
sctp_exclude_list=; \
if ! cat /proc/net/protocols | grep SCTP > /dev/null; then \
sctp_exclude_list="-x testsctp"; \
fi; \
lib/core/test/testcore $$sctp_exclude_list || exit; \

1
debian/source/format vendored Normal file
View File

@@ -0,0 +1 @@
3.0 (native)

View File

@@ -1,6 +1,6 @@
## Process this file with automake to produce Makefile.in
SUBDIRS = @FREEDIAMETER_DIR@ core logger base s1ap nas fd gtp ipfw
SUBDIRS = @FREEDIAMETER_DIR@ ipfw core s1ap nas fd gtp
MAINTAINERCLEANFILES = Makefile.in
MOSTLYCLEANFILES = *.stackdump

View File

@@ -1,19 +0,0 @@
## Process this file with automake to produce Makefile.in
noinst_LTLIBRARIES = libbase.la
libbase_la_SOURCES = \
types.h context.h \
types.c context.c
AM_CPPFLAGS = \
-I$(top_srcdir)/lib/core/include \
@MONGOC_CFLAGS@
AM_CFLAGS = \
-Wall -Werror
DEFS = @DEFS@ -DSYSCONFDIR=\"$(sysconfdir)/\"
MAINTAINERCLEANFILES = Makefile.in
MOSTLYCLEANFILES = *.stackdump

View File

@@ -1,287 +0,0 @@
#define TRACE_MODULE _context
#include "core_file.h"
#include "core_debug.h"
#include <mongoc.h>
#include "context.h"
#define DEFAULT_CONFIG_FILE_PATH SYSCONFDIR PACKAGE ".conf"
static context_t self;
static int context_initialized = 0;
status_t context_init()
{
d_assert(context_initialized == 0, return CORE_ERROR,
"Context already has been context_initialized");
memset(&self, 0, sizeof(context_t));
context_initialized = 1;
return CORE_OK;
}
status_t context_final()
{
d_assert(context_initialized == 1, return CORE_ERROR,
"Context already has been finalized");
context_initialized = 0;
return CORE_OK;
}
context_t* context_self()
{
return &self;
}
status_t context_read_file(char *file_path)
{
char buf[MAX_ERROR_STRING_LEN];
config_t *config = &self.config;
status_t rv;
file_t *file;
jsmn_parser parser;
size_t json_len;
int result;
config->path = file_path;
if (config->path == NULL) config->path = DEFAULT_CONFIG_FILE_PATH;
rv = file_open(&file, config->path, FILE_READ, FILE_OS_DEFAULT);
if (rv != CORE_OK)
{
d_fatal("Can't open configuration file '%s' (errno = %d, %s)",
config->path, rv, core_strerror(rv, buf, MAX_ERROR_STRING_LEN));
return rv;
}
json_len = MAX_CONFIG_FILE_SIZE;
rv = file_read(file, config->json, &json_len);
if (rv != CORE_OK)
{
d_fatal("Can't read configuration file '%s' (errno = %d, %s)",
config->path, rv, core_strerror(rv, buf, MAX_ERROR_STRING_LEN));
return rv;
}
file_close(file);
jsmn_init(&parser);
result = jsmn_parse(&parser, config->json, strlen(config->json),
config->token, sizeof(config->token)/sizeof(config->token[0]));
if (result < 0)
{
d_fatal("Failed to parse configuration file '%s' (jsmnerr = %d)",
config->path, result);
return CORE_ERROR;
}
if (result < 1 || config->token[0].type != JSMN_OBJECT)
{
d_fatal("Failed to parse configuration file '%s' (OBJECT expected)",
config->path);
return CORE_ERROR;
}
d_print(" Config '%s'\n", config->path);
return CORE_OK;
}
status_t context_parse_config()
{
config_t *config = &self.config;
char *json = config->json;
jsmntok_t *token = config->token;
typedef enum { START, ROOT, SKIP, STOP } parse_state;
parse_state state = START;
size_t root_tokens = 0;
size_t skip_tokens = 0;
size_t i, j, m, n;
for (i = 0, j = 1; j > 0; i++, j--)
{
jsmntok_t *t = &token[i];
j += t->size;
switch (state)
{
case START:
{
state = ROOT;
root_tokens = t->size;
break;
}
case ROOT:
{
if (jsmntok_equal(json, t, "DB_URI") == 0)
{
self.db_uri = jsmntok_to_string(json, t+1);
}
else if (jsmntok_equal(json, t, "LOG_PATH") == 0)
{
self.log_path = jsmntok_to_string(json, t+1);
}
else if (jsmntok_equal(json, t, "TRACE") == 0)
{
for (m = 1, n = 1; n > 0; m++, n--)
{
n += (t+m)->size;
char *v = jsmntok_to_string(json, t+m+1);
if (jsmntok_equal(json, t+m, "S1AP") == 0)
{
if (v) self.trace_level.s1ap = atoi(v);
}
else if (jsmntok_equal(json, t+m, "NAS") == 0)
{
if (v) self.trace_level.nas = atoi(v);
}
else if (jsmntok_equal(json, t+m, "FD") == 0)
{
if (v) self.trace_level.fd = atoi(v);
}
else if (jsmntok_equal(json, t+m, "GTP") == 0)
{
if (v) self.trace_level.gtp = atoi(v);
}
else if (jsmntok_equal(json, t+m, "OTHERS") == 0)
{
if (v) self.trace_level.others = atoi(v);
}
}
}
else if (jsmntok_equal(json, t, "HIDDEN") == 0)
{
for (m = 1, n = 1; n > 0; m++, n--)
{
n += (t+m)->size;
char *v = jsmntok_to_string(json, t+m+1);
if (jsmntok_equal(json, t+m, "DISABLE_HSS") == 0)
{
if (v) self.hidden.disable_hss = atoi(v);
}
else if (jsmntok_equal(json, t+m, "DISABLE_SGW") == 0)
{
if (v) self.hidden.disable_sgw = atoi(v);
}
else if (jsmntok_equal(json, t+m, "DISABLE_PGW") == 0)
{
if (v) self.hidden.disable_pgw = atoi(v);
}
else if (jsmntok_equal(json, t+m, "DISABLE_PCRF") == 0)
{
if (v) self.hidden.disable_pcrf = atoi(v);
}
}
}
state = SKIP;
skip_tokens = t->size;
root_tokens--;
if (root_tokens == 0) state = STOP;
break;
}
case SKIP:
{
skip_tokens += t->size;
skip_tokens--;
if (skip_tokens == 0) state = ROOT;
break;
}
case STOP:
{
break;
}
default:
{
d_error("Failed to parse configuration in the state(%u)",
state);
break;
}
}
}
return CORE_OK;
}
status_t context_db_init(char *db_uri)
{
bson_t reply;
bson_error_t error;
bson_iter_t iter;
const mongoc_uri_t *uri;
mongoc_init();
self.db_client = mongoc_client_new(db_uri);
if (!self.db_client)
{
d_error("Failed to parse DB URI [%s]", db_uri);
return CORE_ERROR;
}
#if MONGOC_MAJOR_VERSION >= 1 && MONGOC_MINOR_VERSION >= 4
mongoc_client_set_error_api(self.db_client, 2);
#endif
uri = mongoc_client_get_uri(self.db_client);
d_assert(uri, context_db_final(); return CORE_ERROR,
"Database is not defined in DB_URI [%s]", db_uri);
self.db_name = (char *)mongoc_uri_get_database(uri);
d_assert(self.db_name, context_db_final(); return CORE_ERROR,
"Database is not defined in DB_URI [%s]", db_uri);
self.database = mongoc_client_get_database(self.db_client, self.db_name);
d_assert(self.database, context_db_final(); return CORE_ERROR,
"Database is not defined in DB_URI [%s]", db_uri);
if (!mongoc_client_get_server_status(self.db_client, NULL, &reply, &error))
{
d_error("Failed to conect to server [%s]", db_uri);
return CORE_ERROR;
}
d_assert(bson_iter_init_find(&iter, &reply, "ok"),
bson_destroy(&reply); context_db_final(); return CORE_ERROR,
"Invalid reply for server status [%s]", db_uri);
bson_destroy(&reply);
return CORE_OK;
}
status_t context_db_final()
{
if (self.database)
{
mongoc_database_destroy(self.database);
self.database = NULL;
}
if (self.db_client)
{
mongoc_client_destroy(self.db_client);
self.db_client = NULL;
}
mongoc_cleanup();
return CORE_OK;
}

View File

@@ -1,65 +0,0 @@
#ifndef __CONTEXT_H__
#define __CONTEXT_H__
#include "core_debug.h"
#include "core_param.h"
#include "core_jsmn.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#define MAX_CONFIG_FILE_SIZE 2048
#define MAX_NUM_OF_CONFIG_TOKEN 256
typedef struct _config_t {
char *path;
char json[MAX_CONFIG_FILE_SIZE+1];
jsmntok_t token[MAX_NUM_OF_CONFIG_TOKEN];
} config_t;
#define MAX_DB_URI_LEN 256
typedef struct _context_t {
config_t config;
char *log_path;
char *db_uri;
void *db_client;
char *db_name;
void *database;
struct {
int s1ap;
int nas;
int gtp;
int fd;
int others;
} trace_level;
struct {
int disable_hss;
int disable_sgw;
int disable_pgw;
int disable_pcrf;
} hidden;
} context_t;
CORE_DECLARE(status_t) context_init(void);
CORE_DECLARE(status_t) context_final(void);
CORE_DECLARE(context_t*) context_self(void);
CORE_DECLARE(status_t) context_read_file(char *file_path);
CORE_DECLARE(status_t) context_parse_config(void);
CORE_DECLARE(status_t) context_setup_trace_module(void);
CORE_DECLARE(status_t) context_db_init(char *db_uri);
CORE_DECLARE(status_t) context_db_final(void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __CONTEXT_H__ */

View File

@@ -7,26 +7,33 @@
extern "C" {
#endif /* __cplusplus */
#define S1AP_SCTP_PORT 36412
#define GTPV2_C_UDP_PORT 2123
#define GTPV1_U_UDP_PORT 2152
#define SCTP_S1AP_PPID 18
#define SCTP_X2AP_PPID 27
#define MAX_NUM_OF_ENB 128
#define MAX_NUM_OF_UE 128
#define MAX_NUM_OF_SESS 4
#define MAX_NUM_OF_BEARER 4
#define MAX_NUM_OF_TUNNEL 3 /* Num of Tunnel per Bearer */
#define MAX_NUM_OF_PF 16 /* Num of Packet Filter per Bearer */
#define MAX_NUM_OF_GTP_NODE 8
#define MAX_POOL_OF_UE (MAX_NUM_OF_ENB * MAX_NUM_OF_UE)
#define MAX_POOL_OF_SESS (MAX_POOL_OF_UE * MAX_NUM_OF_SESS)
#define MAX_POOL_OF_BEARER (MAX_POOL_OF_SESS * MAX_NUM_OF_BEARER)
#define MAX_POOL_OF_TUNNEL (MAX_POOL_OF_BEARER * MAX_NUM_OF_TUNNEL)
#define MAX_POOL_OF_PF (MAX_POOL_OF_BEARER * MAX_NUM_OF_PF)
#define MAX_POOL_OF_DIAMETER_SESS (MAX_POOL_OF_UE * MAX_NUM_OF_SESS)
#define MAX_NUM_OF_HOSTNAME 16
#define MAX_NUM_OF_PCC_RULE 8
#define MAX_NUM_OF_FLOW 8 /* Num of Flow per PCC Rule */
#define MAX_NUM_OF_PACKET_FILTER 16 /* Num of Packet Filter per Bearer */
#define MAX_SDU_LEN 2048
#define IPV6_LEN 16
#define MAX_SDU_LEN 8192
#define PLMN_ID_LEN 3
#define BCD_TO_BUFFER_LEN(x) (((x)+1)/2)
@@ -35,11 +42,11 @@ extern "C" {
#define RAND_LEN 16
#define AUTN_LEN 16
#define AUTS_LEN 14
#define MAX_RES_LEN 16
#define MAX_APN_LEN 100
#define MAX_PCO_LEN 251
#define MAX_PCC_RULE_NAME_LEN 128
#define NEXT_ID(__id, __min, __max) \
((__id) = ((__id) == (__max) ? (__min) : ((__id) + 1)))
@@ -47,6 +54,9 @@ extern "C" {
((__id2) > (__id1) ? ((__id2) - (__id1) < ((__max)-1) ? -1 : 1) : \
(__id1) > (__id2) ? ((__id1) - (__id2) < ((__max)-1) ? 1 : -1) : 0)
#define TIME_TO_BCD(x) \
(((((x) % 10) << 4) & 0xf0) | (((x) / 10) & 0x0f))
/**********************************
* PLMN_ID Structure */
typedef struct _plmn_id_t {
@@ -65,6 +75,8 @@ CORE_DECLARE(c_uint16_t) plmn_id_mnc_len(plmn_id_t *plmn_id);
CORE_DECLARE(void *) plmn_id_build(plmn_id_t *plmn_id,
c_uint16_t mcc, c_uint16_t mnc, c_uint16_t mnc_len);
#define MAX_NUM_OF_TAI 16
typedef struct _tai_t {
plmn_id_t plmn_id;
c_uint16_t tac;
@@ -82,6 +94,28 @@ typedef struct _guti_t {
c_uint32_t m_tmsi;
} __attribute__ ((packed)) guti_t;
/**************************************************
* Common Structure
* S1AP : 9.2.2.1 Transport Layer Address, See 36.414
* GTP : 8.22 Fully Qualified TEID (F-TEID) */
#define IPV4_LEN 4
#define IPV6_LEN 16
#define IPV4V6_LEN 20
typedef struct _ip_t {
union {
c_uint32_t addr;
c_uint8_t addr6[IPV6_LEN];
struct {
c_uint32_t addr;
c_uint8_t addr6[IPV6_LEN];
} both;
};
c_uint32_t len;
ED3(c_uint8_t ipv4:1;,
c_uint8_t ipv6:1;,
c_uint8_t reserved:6;)
} ip_t;
/**************************************************
* 8.14 PDN Address Allocation (PAA) */
#define PAA_IPV4_LEN 5
@@ -91,19 +125,33 @@ typedef struct _paa_t {
/* 8.34 PDN Type */
#define GTP_PDN_TYPE_IPV4 1
#define GTP_PDN_TYPE_IPV6 2
#define GTP_PDN_TYPE_BOTH 3
#define GTP_PDN_TYPE_IPV4V6 3
#define GTP_PDN_TYPE_NON_IP 4
ED2(c_uint8_t spare:5;,
c_uint8_t pdn_type:3;)
union {
c_uint32_t ipv4_addr;;
/* GTP_PDN_TYPE_IPV4 */
c_uint32_t addr;
/* GTP_PDN_TYPE_IPV6 */
struct {
c_uint8_t ipv6_len;
c_uint8_t ipv6_addr[IPV6_LEN];
/* the IPv6 Prefix Length */
c_uint8_t len;
/* IPv6 Prefix and Interface Identifier */
c_uint8_t addr6[IPV6_LEN];
};
c_uint8_t ipv6_addr2[IPV6_LEN];
/* GTP_PDN_TYPE_BOTH */
struct {
struct {
/* the IPv6 Prefix Length */
c_uint8_t len;
/* IPv6 Prefix and Interface Identifier */
c_uint8_t addr6[IPV6_LEN];
};
c_uint32_t addr;
} __attribute__ ((packed)) both;
};
c_uint32_t ipv4_addr2;
} __attribute__ ((packed)) paa_t;
#define MAX_BIT_RATE C_UINT64_C(10000000000)
@@ -159,37 +207,74 @@ typedef struct _flow_t {
c_int8_t *description;
} flow_t;
#define FLOW_FREE(__fLOW) \
do { \
if ((__fLOW)->description) \
{ \
CORE_FREE((__fLOW)->description); \
} \
else \
d_assert(0,, "Null param"); \
} while(0)
/**********************************
* PCC Rule Structure */
typedef struct _pcc_rule_t {
c_int8_t name[MAX_PCC_RULE_NAME_LEN+1];
#define PCC_RULE_TYPE_INSTALL 1
#define PCC_RULE_TYPE_REMOVE 2
c_uint8_t type;
#define MAX_PCC_RULE_NAME_LEN 256
c_int8_t *name;
flow_t flow[MAX_NUM_OF_FLOW];
int num_of_flow;
#define FLOW_STATUS_ENABLED_UPLINK 0
#define FLOW_STATUS_ENABLED_DOWNLINK 1
#define FLOW_STATUS_ENABLED 2
#define FLOW_STATUS_DISABLED 3
#define FLOW_STATUS_REMOVE 4
c_int8_t flow_status;
c_uint32_t precedence;
qos_t qos;
} pcc_rule_t;
#define PCC_RULE_FREE(__pCCrULE) \
do { \
int __pCCrULE_iNDEX; \
d_assert((__pCCrULE), break,); \
if ((__pCCrULE)->name) \
{ \
CORE_FREE((__pCCrULE)->name); \
} \
else \
d_assert(0,, "Null param"); \
for (__pCCrULE_iNDEX = 0; \
__pCCrULE_iNDEX < (__pCCrULE)->num_of_flow; __pCCrULE_iNDEX++) \
{ \
FLOW_FREE(&((__pCCrULE)->flow[__pCCrULE_iNDEX])); \
} \
(__pCCrULE)->num_of_flow = 0; \
} while(0)
/**********************************
* PDN Structure */
typedef struct _pdn_t {
c_uint32_t context_identifier;
c_int8_t apn[MAX_APN_LEN+1];
#define S6A_PDN_TYPE_IPV4 0
#define S6A_PDN_TYPE_IPV6 1
#define S6A_PDN_TYPE_IPV4_AND_IPV6 2
#define S6A_PDN_TYPE_IPV4_OR_IPV6 3
#define HSS_PDN_TYPE_IPV4 0
#define HSS_PDN_TYPE_IPV6 1
#define HSS_PDN_TYPE_IPV4V6 2
#define HSS_PDN_TYPE_IPV4_OR_IPV6 3
c_int8_t pdn_type;
qos_t qos;
bitrate_t ambr; /* APN-AMBR */
paa_t paa;
struct {
c_uint32_t ipv4_addr;
c_uint8_t ipv6_addr[IPV6_LEN];
} pgw;
ip_t pgw_ip;
} pdn_t;
CORE_DECLARE(c_int16_t) apn_build(c_int8_t *dst, c_int8_t *src, c_int16_t len);
@@ -203,10 +288,14 @@ CORE_DECLARE(c_int16_t) apn_parse(c_int8_t *dst, c_int8_t *src, c_int16_t len);
* RFC 1661 [102] */
#define PCO_PPP_FOR_USE_WITH_IP_PDP_TYPE_OR_IP_PDN_TYPE 0
#define PCO_ID_INTERNET_PROTOCOL_CONTROL_PROTOCOL 0x8021
#define PCO_ID_CHALLENGE_HANDSHAKE_AUTHENTICATION_PROTOCOL 0xc223
#define PCO_ID_DNS_SERVER_IPV4_ADDRESS_REQUEST 0x000d
#define PCO_ID_IP_ADDRESS_ALLOCATION_VIA_NAS_SIGNALLING 0x000a
#define PCO_ID_INTERNET_PROTOCOL_CONTROL_PROTOCOL 0x8021
#define PCO_ID_CHALLENGE_HANDSHAKE_AUTHENTICATION_PROTOCOL 0xc223
#define PCO_ID_P_CSCF_IPV6_ADDRESS_REQUEST 0x0001
#define PCO_ID_DNS_SERVER_IPV6_ADDRESS_REQUEST 0x0003
#define PCO_ID_IP_ADDRESS_ALLOCATION_VIA_NAS_SIGNALLING 0x000a
#define PCO_ID_P_CSCF_IPV4_ADDRESS_REQUEST 0x000c
#define PCO_ID_DNS_SERVER_IPV4_ADDRESS_REQUEST 0x000d
#define PCO_ID_IPV4_LINK_MTU_REQUEST 0x0010
typedef struct _pco_ipcp_options_t {
c_uint8_t type;
c_uint8_t len;

View File

@@ -0,0 +1,55 @@
#ifndef __CORE_ARCH_NETWORK_H__
#define __CORE_ARCH_NETWORK_H__
#include "core_list.h"
#include "core_network.h"
#if HAVE_NETDB_H
#include <netdb.h>
#endif
#if HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#if HAVE_IFADDRS_H
#include <ifaddrs.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
typedef struct _sock_t {
lnode_t node;
int family;
int fd;
char ifname[IFNAMSIZ];
c_sockaddr_t local_addr;
c_sockaddr_t remote_addr;
sock_handler handler;
void *data;
c_int32_t options;
} sock_t;
#define sock_is_option_set(skt, option) \
(((skt)->options & (option)) == (option))
#define sock_set_option(skt, option, on) \
do { \
if (on) \
(skt)->options |= (option); \
else \
(skt)->options &= ~(option); \
} while (0)
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif

View File

@@ -136,6 +136,18 @@
#include <netinet/ip.h>
#endif
#if HAVE_NETINET_IP6_H
#include <netinet/ip6.h>
#endif
#if HAVE_NETINET_IP_ICMP_H
#include <netinet/ip_icmp.h>
#endif
#if HAVE_NETINET_ICMP6_H
#include <netinet/icmp6.h>
#endif
#if HAVE_NETINET_UDP_H
#include <netinet/udp.h>
#endif
@@ -144,10 +156,6 @@
#include <netinet/tcp.h>
#endif
#if HAVE_NETINET_SCTP_H
#include <netinet/sctp.h>
#endif
#if HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
#endif
@@ -215,6 +223,8 @@ typedef c_int32_t c_intptr_t;
@uint64_t_fmt@
@uint64_t_hex_fmt@
@pid_t_fmt@
#ifdef INT16_MIN
#define C_INT16_MIN INT16_MIN
#else

View File

@@ -25,9 +25,11 @@ extern int g_trace_mask;
#define D_MSG_TO_CONSOLE 0x00000001
#define D_MSG_TO_STDOUT 0x00000002
#define D_MSG_TO_SYSLOG 0x00000004
#define D_MSG_TO_LOGD 0x00000008
#define D_MSG_TO_NETWORK 0x00000008
#define D_MSG_TO_FILE 0x00000010
#define D_MSG_TO_ALL (D_MSG_TO_CONSOLE | D_MSG_TO_STDOUT | \
D_MSG_TO_SYSLOG | D_MSG_TO_LOGD)
D_MSG_TO_SYSLOG | D_MSG_TO_NETWORK | \
D_MSG_TO_FILE )
#define D_LOG_LEVEL_NONE 0
#define D_LOG_LEVEL_FATAL 1
@@ -81,6 +83,10 @@ CORE_DECLARE(int) d_msg(int tp, int lv, c_time_t t, char *fn, int ln,
(!g_trace_mask || TRACE_MODULE < __level ? 0 : \
d_msg(D_MSG_TYPE_TRACE, 0, time_now(), NULL, 0, fmt, ## __VA_ARGS__))
#define d_trace2(__level, fmt, ...) \
(!g_trace_mask || TRACE_MODULE < __level ? 0 : \
d_msg(D_MSG_TYPE_RAW, 0, 0, NULL, 0, fmt, ## __VA_ARGS__))
/**
* Use for trace binary buffer as printable hex string .
* Trace message shall be shown only if trace level is set equal or higher
@@ -138,13 +144,17 @@ CORE_DECLARE(int) d_msg(int tp, int lv, c_time_t t, char *fn, int ln,
expr; \
}
void d_msg_init();
void d_msg_final();
void d_msg_register_console(int console_fd);
void d_msg_deregister_console();
status_t d_msg_console_init(int console_fd);
void d_msg_console_final();
void d_msg_syslog_init(const char *name);
void d_msg_syslog_final();
status_t d_msg_network_init(const char *name);
void d_msg_network_final();
status_t d_msg_network_start(const char *file);
void d_msg_network_stop();
void d_msg_network_final();
status_t d_msg_file_init(const char *file);
void d_msg_file_final();
void d_msg_to(int to, int on_off);
@@ -198,8 +208,6 @@ void d_trace_level(int *mod_name, int level);
*/
void d_trace_off(int *mod_name);
#define D_LOGD_IPC_PATH "/tmp/dlogmesg"
#ifdef __cplusplus
}
#endif /* __cplusplus */

View File

@@ -10,7 +10,6 @@ extern "C" {
#endif /* __cplusplus */
#define EVENT_SIZE sizeof(event_t)
#define EVENT_WAIT_TIMEOUT 10000 /* 10 msec */
#define event_set(__ptr_e, __evnt) ((__ptr_e)->event = (__evnt))
#define event_get(__ptr_e) ((__ptr_e)->event)
@@ -73,7 +72,7 @@ extern char *EVT_NAME_UNKNOWN;
*
* @return event queue or 0
*/
CORE_DECLARE(msgq_id) event_create(void);
CORE_DECLARE(msgq_id) event_create(int opt);
/**
* Delete event message queue
@@ -92,6 +91,15 @@ CORE_DECLARE(status_t) event_delete(msgq_id queue_id);
*/
CORE_DECLARE(status_t) event_send(msgq_id queue_id, event_t *e);
/**
* Receive a event from event queue
*
* @return If success, return CORE_OK
* If queue is empty, return CORE_EAGAIN
* If else, return CORE_ERROR.
*/
CORE_DECLARE(status_t) event_recv(msgq_id queue_id, event_t *e);
/**
* Receive a event from event queue with timeout
*

View File

@@ -581,6 +581,7 @@ CORE_DECLARE(status_t) dir_make(const char *path, file_perms_t perm);
* @param path the path for the directory to be created. (use / on all systems)
* @param perm Permissions for the new direcoty.
*/
CORE_DECLARE(void) path_remove_last_component(char *dir, const char *path);
CORE_DECLARE(status_t) dir_make_recursive(const char *path, file_perms_t perm);
/**

View File

@@ -1,79 +0,0 @@
#ifndef __CORE_JSMN_H__
#define __CORE_JSMN_H__
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* JSON type identifier. Basic types are:
* o Object
* o Array
* o String
* o Other primitive: number, boolean (true/false) or null
*/
typedef enum {
JSMN_UNDEFINED = 0,
JSMN_OBJECT = 1,
JSMN_ARRAY = 2,
JSMN_STRING = 3,
JSMN_PRIMITIVE = 4
} jsmntype_t;
enum jsmnerr {
/* Not enough tokens were provided */
JSMN_ERROR_NOMEM = -1,
/* Invalid character inside JSON string */
JSMN_ERROR_INVAL = -2,
/* The string is not a full JSON packet, more bytes expected */
JSMN_ERROR_PART = -3
};
/**
* JSON token description.
* type type (object, array, string etc.)
* start start position in JSON data string
* end end position in JSON data string
*/
typedef struct {
jsmntype_t type;
int start;
int end;
int size;
#ifdef JSMN_PARENT_LINKS
int parent;
#endif
} jsmntok_t;
/**
* JSON parser. Contains an array of token blocks available. Also stores
* the string being parsed now and current position in that string
*/
typedef struct {
unsigned int pos; /* offset in the JSON string */
unsigned int toknext; /* next token to allocate */
int toksuper; /* superior token node, e.g parent object or array */
} jsmn_parser;
/**
* Create JSON parser over an array of tokens
*/
void jsmn_init(jsmn_parser *parser);
/**
* Run JSON parser. It parses a JSON data string into and array of tokens, each describing
* a single JSON object.
*/
int jsmn_parse(jsmn_parser *parser, const char *js, size_t len,
jsmntok_t *tokens, unsigned int num_tokens);
int jsmntok_equal(char *json, jsmntok_t *token, const char *s);
char *jsmntok_to_string(char *json, jsmntok_t *token);
#ifdef __cplusplus
}
#endif
#endif /* __JSMN_H_ */

View File

@@ -114,6 +114,26 @@ CORE_DECLARE(void *) core_buffer_to_bcd(c_uint8_t *in, int in_len, void *out);
*/
CORE_DECLARE(char *)core_cpystrn(char *dst, const char *src, size_t dst_size);
/**
* Get the value of an environment variable
* @param value the returned value, allocated from @a pool
* @param envvar the name of the environment variable
*/
CORE_DECLARE(char *) core_env_get(const char *envvar);
/**
* Set the value of an environment variable
* @param envvar the name of the environment variable
* @param value the value to set
*/
CORE_DECLARE(status_t) core_env_set(const char *envvar, const char *value);
/**
* Delete a variable from the environment
* @param envvar the name of the environment variable
*/
CORE_DECLARE(status_t) core_env_delete(const char *envvar);
/** @} */
#ifdef __cplusplus

View File

@@ -1,275 +0,0 @@
#ifndef __CORE_NET_H__
#define __CORE_NET_H__
#include "core.h"
#include "core_errno.h"
#include "core_index.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#if HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
#if HAVE_NETDB_H
#include <netdb.h>
#endif
#if HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#define MAX_NET_POOL_SIZE 512
/* Max length of interface name, ex: eth0, ath0 .. */
#define MAX_IFNAME_LEN 16
#define INET_NTOP(src, dst) inet_ntop(AF_INET,(void *)(c_uintptr_t)(src),(dst),INET_ADDRSTRLEN)
#define INET6_NTOP(src, dst) inet_ntop(AF_INET6,(void *)(src),(dst),INET6_ADDRSTRLEN)
/** Network handler */
typedef int (*net_handler)(void *net_sl, void *data);
/** Network socket descriptor */
typedef struct {
int type;
int proto;
#define SCTP_S1AP_PPID 18
#define SCTP_X2AP_PPID 27
c_uint32_t ppid;
int sock_id;
#if 0 /* deprecated */
struct sockaddr_in local;
#endif
struct sockaddr_in remote;
int opt;
index_t app_index;
int sndrcv_errno;
} net_sock_t;
/** Network socket handler */
typedef int (*net_sock_handler)(net_sock_t *net_sock, void *data);
/** Basic socket library */
/** Initialize network library */
CORE_DECLARE(status_t) net_init(void);
/** Finalize network library */
CORE_DECLARE(status_t) net_final(void);
/**
* Create network session.
* @param net_sock Connected network session.
* @param host Host IP address to be connected.
* @param lport Local Port number(only for UDP)
* @param rport Remote Port number
* @param proto Protocol proto
* @param type Protocol type
* @param flag Option flags to be set for this connection
*/
CORE_DECLARE(int) net_open(net_sock_t **net_sock,const char *host,
const int lport,
const int rport,
int type, int proto);
/**
* Create network session.
* @param net_sock Connected network session.
* @param local_addr Local Host IP address to bind(Network order)
* @param remote_host Remote Host IP address to be connected.
* @param lport Local Port number(only for UDP)
* @param rport Remote Port number
* @param proto Protocol proto
* @param type Protocol type
* @param flag Option flags to be set for this connection
*/
CORE_DECLARE(int) net_open_ext(net_sock_t **net_sock,
const c_uint32_t local_addr,
const char *remote_host,
const int lport,
const int rport,
int type, int proto, c_uint32_t ppid, const int flag);
/**
* Read the data from the socket
* @param net_sock Socket which created before
* @param buffer Buffer which data be saved
* @param size Total length of buffer
* @param timeout Wait timeout. If 0 , it will block until data ready
*/
CORE_DECLARE(int) net_read(net_sock_t *net_sock, char *buffer, size_t size,int timeout);
/** Write the data into the socket
* @param net_sock Socket which created before
* @param buffer Buffer which data be saved
* @param size Total length of buffer
*/
CORE_DECLARE(int) net_write(net_sock_t *net_sock, char *buffer, size_t size,
struct sockaddr_in *dest_addr, int addrlen);
CORE_DECLARE(int) net_send(net_sock_t *net_sock, char *buffer, size_t size);
CORE_DECLARE(int) net_sendto(net_sock_t *net_sock, char *buffer, size_t size,
c_uint32_t ip_addr, c_uint16_t port);
/** Close the socket
* @param net_sock Socket to be closed
*/
CORE_DECLARE(int) net_close(net_sock_t *net_sock);
/** Wait the new socket session until given timeout
* @param new_accept_sock Newly created socket for new connection
* @param net_sock Listend socket before created
* @param timeout Wait timeout. If 0, it will be blocked until new connection
* received
*/
CORE_DECLARE(int) net_accept(net_sock_t **new_accept_sock,
net_sock_t *net_sock, int timeout);
/** Create socket and listen to the specified port
* @param net_sock Returned socket
* @param type Protocol type
* @param proto Protocol proto
* @param ppid SCTP PPID
* @param addr Specific address
* @param port Port number
*/
CORE_DECLARE(int) net_listen_ext(net_sock_t **net_sock,
const int type, const int proto, const c_uint32_t ppid,
const c_uint32_t addr, const int port);
/** Create socket and listen to the specified port
* @param net_sock Returned socket
* @param type Protocol type
* @param proto Protocol proto
* @param port Port number
*/
CORE_DECLARE(int) net_listen(
net_sock_t **net_sock, const int type, const int proto,
const int port);
/** Network application protocol */
#define MAX_FTP_SESSION_SIZE 10
typedef struct {
net_sock_t *ctrl_sock; /* Control channel */
net_sock_t *data_sock; /* Data channel */
int flag;
char cmd_buf[256];
char resp_buf[256];
} net_ftp_t;
/** Open ftp session.
* @param host host name or IP address to connect
* @param username User ID or NULL if username is anonymous
* @param passwd Password or NULL if no passwd
* @param flag Option flags
* @param ftp_session Ftp session structure. If connection failed , it will be NULL
*/
CORE_DECLARE(int) net_ftp_open(const char *host,
const char *username,
const char *passwd,
int flag,
net_ftp_t **ftp_session);
/** Retrieve file using FTP
* @param ftp_session Ftp session which created from net_ftp_open
* @param remote_filename Remote filename to retrieve
* @param local_filename Local filename. If null, the same name as remote will
* be used.
*/
CORE_DECLARE(int) net_ftp_get(net_ftp_t *ftp_session,
const char *remote_filename,
const char *local_filename);
/** Upload file using FTP
* @param ftp_session Ftp session which created from net_ftp_open
* @param local_filename Local filename to upload.
* @param remote_filename Remote filename.If null, the same name as local will
* be used.
*/
CORE_DECLARE(int) net_ftp_put(net_ftp_t *ftp_session,
const char *local_filename,
const char *remote_filename);
/** Quit from ftp
* @param ftp_session Ftp session which created from net_ftp_open
*/
CORE_DECLARE(int) net_ftp_quit(net_ftp_t *ftp_session);
/** Close ftp session
* @param ftp_session Ftp session which created from net_ftp_open
*/
CORE_DECLARE(int) net_ftp_close(net_ftp_t *ftp_session);
/** Network session pool */
CORE_DECLARE(int) net_pool_avail();
/** Network link interface */
typedef struct {
int fd;
int ioctl_sock;
char ifname[MAX_IFNAME_LEN];
struct sockaddr hwaddr;
} net_link_t;
/** Network link handler */
typedef int (*net_link_handler)(net_link_t *net_sock, void *data);
/** Open network interface */
CORE_DECLARE(int) net_link_open(net_link_t **net_link, char *device, int proto);
/** Close network interface */
CORE_DECLARE(int) net_link_close(net_link_t *net_link);
/** Enable or disable promisc mode of network interface */
CORE_DECLARE(int) net_link_promisc(net_link_t *net_link, int enable);
/** Write the data into the link */
CORE_DECLARE(int) net_link_write(net_link_t *net_link, char *buf, int len);
/** Reate the data from the link */
CORE_DECLARE(int) net_link_read(net_link_t *net_link, char *buffer, int size,
int timeout);
/** Open the specified protocol raw socket */
CORE_DECLARE(int) net_raw_open(net_link_t **net_link, int proto);
/** Clse the specified protocol raw socket */
CORE_DECLARE(int) net_raw_close(net_link_t *net_link);
CORE_DECLARE(int) net_link_sendto(net_link_t *net_link, char *buf, int len,
struct sockaddr *dest_addr, int addrlen);
/** Register net_sock */
CORE_DECLARE(int) net_register_sock(net_sock_t *net_sock,
net_sock_handler handler, void *data);
/** Register net_link */
CORE_DECLARE(int) net_register_link(net_link_t *net_link,
net_link_handler handler, void *data);
/** Unregister net_sock */
CORE_DECLARE(int) net_unregister_sock(net_sock_t *net_sock);
/** Unregister net_link */
CORE_DECLARE(int) net_unregister_link(net_link_t *net_link);
/** Read the multiple fds and run the registered handler
* @param timeout timeout(milliseconds)
*/
CORE_DECLARE(int) net_fds_read_run(long timeout);
/** TunTap interface */
CORE_DECLARE(int) net_tuntap_open(net_link_t **net_link, char *tuntap_dev_name,
int is_tap);
CORE_DECLARE(int) net_tuntap_close(net_link_t *net_link);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* ! __CORE_NET_H__ */

View File

@@ -0,0 +1,250 @@
#ifndef __CORE_NETWORK_H__
#define __CORE_NETWORK_H__
#include "core_errno.h"
#include "core_time.h"
#include "core_list.h"
#if HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/**
* @defgroup sock_option Socket option definitions
* @{
*/
#define SOCK_O_LINGER (1 << 0) /**< Linger */
#define SOCK_O_KEEPALIVE (1 << 1) /**< Keepalive */
#define SOCK_O_DEBUG (1 << 2) /**< Debug */
#define SOCK_O_NONBLOCK (1 << 3) /**< Non-blocking IO */
#define SOCK_O_REUSEADDR (1 << 4) /**< Reuse addresses */
#define SOCK_O_SNDBUF (1 << 5) /**< Send buffer */
#define SOCK_O_RCVBUF (1 << 6) /**< Receive buffer */
#define SOCK_O_DISCONNECTED (1 << 7) /**< Disconnected */
#define SOCK_O_TCP_NODELAY (1 << 8) /**< For SCTP sockets, this is mapped
* to STCP_NODELAY internally.
*/
#define SOCK_O_TCP_NOPUSH (1 << 9) /**< No push */
#define SOCK_O_RESET_NODELAY (1 << 10) /**< This flag is ONLY set internally
* when we set SOCK_O_TCP_NOPUSH with
* SOCK_O_TCP_NODELAY set to tell us that
* SOCK_O_TCP_NODELAY should be turned on
* again when NOPUSH is turned off
*/
#define SOCK_O_INCOMPLETE_READ (1 << 11) /**< Set on non-blocking sockets
* (timeout != 0) on which the
* previous read() did not fill a buffer
* completely. the next sock_read()
* will first call select()/poll() rather than
* going straight into read(). (Can also
* be set by an application to force a
* select()/poll() call before the next
* read, in cases where the app expects
* that an immediate read would fail.)
*/
#define SOCK_O_INCOMPLETE_WRITE (1 << 12) /**< like SOCK_O_INCOMPLETE_READ, but
* for write
* @see SOCK_O_INCOMPLETE_READ
*/
#define SOCK_O_IPV6_V6ONLY (1 << 13) /**< Don't accept IPv4 connections
* on a IPv6 listening socket.
*/
#define SOCK_O_TCP_DEFER_ACCEPT (1 << 14) /**< Delay accepting of new
* connections until data is available.
* @see apr_socket_accept_filter
*/
#define SOCK_O_BROADCAST (1 << 15) /**< Allow broadcast */
#define SOCK_O_FREEBIND (1 << 16) /**< Allow binding to addresses not
* owned by any interface
*/
typedef c_uintptr_t sock_id;
typedef int (*sock_handler)(sock_id sock, void *data);
typedef struct c_sockaddr_t c_sockaddr_t;
struct c_sockaddr_t {
/* Reserved Area
* - Should not add any atrribute in this area.
*
* e.g)
* struct sockaddr addr;
* ...
* sockaddr_len((c_sockaddr_t *)&addr);
*/
#define c_sa_family sa.sa_family
#define c_sa_port sin.sin_port
union {
struct sockaddr_storage ss;
struct sockaddr_in sin;
struct sockaddr_in6 sin6;
struct sockaddr sa;
};
/* User Area
* - Could add your attribute.
*/
c_sockaddr_t *next;
};
typedef struct _sock_node_t {
lnode_t node;
sock_id sock;
c_sockaddr_t *list;
} sock_node_t;
typedef struct ipsubnet_t {
int family;
c_uint32_t sub[4]; /* big enough for IPv4 and IPv6 addresses */
c_uint32_t mask[4];
} ipsubnet_t;
typedef struct _sctp_info_t {
c_uint32_t ppid;
c_uint16_t stream_no;
c_uint16_t inbound_streams;
c_uint16_t outbound_streams;
} sctp_info_t;
/*
* Init/Final
*/
CORE_DECLARE(status_t) network_init(void);
CORE_DECLARE(status_t) network_final(void);
/*
* Socket
*/
CORE_DECLARE(status_t) sock_create(sock_id *new);
CORE_DECLARE(status_t) sock_delete(sock_id id);
CORE_DECLARE(status_t) sock_delete_list(list_t *list);
CORE_DECLARE(status_t) sock_socket(
sock_id *id, int family, int type, int protocol);
CORE_DECLARE(status_t) sock_setsockopt(sock_id id, c_int32_t opt, c_int32_t on);
CORE_DECLARE(status_t) sock_bind(sock_id id, c_sockaddr_t *addr);
CORE_DECLARE(status_t) sock_connect(sock_id id, c_sockaddr_t *addr);
CORE_DECLARE(status_t) sock_listen(sock_id id);
CORE_DECLARE(status_t) sock_accept(sock_id *new, sock_id id);
CORE_DECLARE(int) sock_family(sock_id id);
CORE_DECLARE(c_sockaddr_t *) sock_local_addr(sock_id id);
CORE_DECLARE(c_sockaddr_t *) sock_remote_addr(sock_id id);
/*
* Socket Node
*/
CORE_DECLARE(status_t) sock_add_node(
list_t *list, sock_node_t **node, c_sockaddr_t *sa_list, int family);
CORE_DECLARE(status_t) sock_remove_node(list_t *list, sock_node_t *node);
CORE_DECLARE(status_t) sock_remove_all_nodes(list_t *list);
CORE_DECLARE(status_t) sock_probe_node(
list_t *list, list_t *list6, const char *dev, c_uint16_t port);
CORE_DECLARE(status_t) sock_fill_scope_id_in_local(c_sockaddr_t *sa_list);
/*
* Socket Address
*/
CORE_DECLARE(status_t) core_getaddrinfo(c_sockaddr_t **sa_list,
int family, const char *hostname, c_uint16_t port, int flags);
CORE_DECLARE(status_t) core_freeaddrinfo(c_sockaddr_t *sa_list);
CORE_DECLARE(status_t) core_addaddrinfo(c_sockaddr_t **sa_list,
int family, const char *hostname, c_uint16_t port, int flags);
CORE_DECLARE(status_t) core_copyaddrinfo(
c_sockaddr_t **dst, const c_sockaddr_t *src);
CORE_DECLARE(status_t) core_filteraddrinfo(c_sockaddr_t **sa_list, int family);
CORE_DECLARE(status_t) core_sortaddrinfo(c_sockaddr_t **sa_list, int family);
CORE_DECLARE(c_sockaddr_t *) core_link_local_addr_by_dev(const char *dev);
#define CORE_ADDRSTRLEN INET6_ADDRSTRLEN
#define CORE_ADDR(__aDDR, __bUF) \
core_inet_ntop(__aDDR, buf, CORE_ADDRSTRLEN)
#define CORE_PORT(__aDDR) \
ntohs((__aDDR)->c_sa_port)
#define INET_NTOP(src, dst) \
inet_ntop(AF_INET,(void *)(c_uintptr_t)(src),(dst),INET_ADDRSTRLEN)
#define INET6_NTOP(src, dst) \
inet_ntop(AF_INET6,(void *)(src),(dst),INET6_ADDRSTRLEN)
CORE_DECLARE(const char *)core_inet_ntop(void *addr, char *buf, int buflen);
CORE_DECLARE(status_t) core_inet_pton(int family, const char *src, void *addr);
CORE_DECLARE(socklen_t) sockaddr_len(const void *addr);
CORE_DECLARE(int) sockaddr_is_equal(void *p, void *q);
CORE_DECLARE(status_t) core_ipsubnet(
ipsubnet_t *ipsub, const char *ipstr, const char *mask_or_numbits);
/*
* UDP Socket
*/
CORE_DECLARE(status_t) udp_socket(sock_id *new, int family);
CORE_DECLARE(status_t) udp_server(sock_id *new, c_sockaddr_t *sa_list);
CORE_DECLARE(status_t) udp_client(sock_id *new, c_sockaddr_t *sa_list);
CORE_DECLARE(status_t) udp_connect(sock_id id, c_sockaddr_t *sa_list);
/*
* TCP Socket
*/
CORE_DECLARE(status_t) tcp_server(sock_id *new, c_sockaddr_t *sa_list);
CORE_DECLARE(status_t) tcp_client(sock_id *new, c_sockaddr_t *sa_list);
/*
* SCTP Socket
*/
CORE_DECLARE(void) sctp_set_num_ostreams(int sctp_streams);
CORE_DECLARE(status_t) sctp_socket(sock_id *new, int family, int type);
CORE_DECLARE(status_t) sctp_server(sock_id *new,
int type, c_sockaddr_t *sa_list);
CORE_DECLARE(status_t) sctp_client(sock_id *new,
int type, c_sockaddr_t *sa_list);
CORE_DECLARE(status_t) sctp_connect(sock_id id, c_sockaddr_t *sa_list);
CORE_DECLARE(int) core_sctp_sendmsg(sock_id id, const void *msg, size_t len,
c_sockaddr_t *to, c_uint32_t ppid, c_uint16_t stream_no);
CORE_DECLARE(int) core_sctp_recvmsg(sock_id id, void *msg, size_t len,
c_sockaddr_t *from, sctp_info_t *sinfo, int *msg_flags);
CORE_DECLARE(int) core_sctp_recvdata(sock_id id, void *msg, size_t len,
c_sockaddr_t *from, sctp_info_t *sinfo);
/*
* TUN Driver
*/
CORE_DECLARE(status_t) tun_open(sock_id *new,
char *ifname, int is_tap);
CORE_DECLARE(status_t) tun_set_ip(sock_id id, ipsubnet_t *gw, ipsubnet_t *sub);
/*
* Send/Recv
*/
CORE_DECLARE(ssize_t) sock_write(sock_id id, const void *buf, size_t len);
CORE_DECLARE(ssize_t) sock_read(sock_id id, void *buf, size_t len);
CORE_DECLARE(ssize_t) core_send(sock_id id,
const void *buf, size_t len, int flags);
CORE_DECLARE(ssize_t) core_sendto(sock_id id,
const void *buf, size_t len, int flags, const c_sockaddr_t *to);
CORE_DECLARE(ssize_t) core_recv(sock_id id, void *buf, size_t len, int flags);
CORE_DECLARE(ssize_t) core_recvfrom(sock_id id,
void *buf, size_t len, int flags, c_sockaddr_t *from);
/*
* Select Loop
*/
CORE_DECLARE(status_t) sock_register(sock_id id,
sock_handler handler, void *data);
CORE_DECLARE(status_t) sock_unregister(sock_id id);
CORE_DECLARE(int) sock_is_registered(sock_id id);
CORE_DECLARE(int) sock_select_loop(c_time_t timeout);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif

View File

@@ -7,7 +7,7 @@
*/
#include "core.h"
#include "core_errno.h"
#include "core_debug.h"
#ifdef __cplusplus
extern "C" {
@@ -187,10 +187,15 @@ CORE_DECLARE(status_t) pkbuf_tobuf_partial(pkbuf_t *pkbuf,
/* memory handling library like OS-function(malloc,free) */
CORE_DECLARE(void *) core_malloc(size_t size);
CORE_DECLARE(void) core_free(void *ptr);
#define CORE_FREE(__pTR) d_assert(core_free(__pTR) == CORE_OK,,);
CORE_DECLARE(status_t) core_free(void *ptr);
CORE_DECLARE(void *) core_calloc(size_t nmemb, size_t size);
CORE_DECLARE(void *) core_realloc(void *ptr, size_t size);
CORE_DECLARE(char *) core_strdup(const char *s);
CORE_DECLARE(char *) core_strndup(const char *s, size_t n);
CORE_DECLARE(void *) core_memdup(const void *m, size_t n);
#ifdef __cplusplus
}
#endif /* __cplusplus */

View File

@@ -22,6 +22,7 @@
#define __CORE_PORTABLE_H__
#include "core_thread.h"
#include "core_network.h"
#ifdef __cplusplus
extern "C" {
@@ -30,6 +31,7 @@ extern "C" {
typedef int os_file_t; /**< native file */
typedef pthread_t os_thread_t; /**< native thread */
typedef pid_t os_proc_t; /**< native pid */
typedef int os_sock_t; /**< native socket */
/**
* convert the thread to os specific type from core type.
@@ -43,6 +45,14 @@ CORE_DECLARE(status_t) os_thread_get(os_thread_t **thethd, thread_id id);
*/
CORE_DECLARE(os_thread_t) os_thread_current(void);
/**
* Convert the socket from an core type to an OS specific socket
* @param thesock The socket to convert.
* @param sock The os specific equivalent of the core socket..
*/
CORE_DECLARE(status_t) os_sock_get(os_sock_t *thesock, sock_id id);
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,20 @@
#ifndef __CORE_TCP_H__
#define __CORE_TCP_H__
#include "core_sock.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
CORE_DECLARE(status_t) tcp_open(sock_id *new,
int family,
const char *local_host, c_uint16_t local_port,
const char *remote_host, c_uint16_t remote_port,
int flags);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif

View File

@@ -13,6 +13,8 @@ extern "C" {
#define TLV_MAX_MORE 8
#define TLV_1_OR_MORE(__v) __v[TLV_MAX_MORE]
#define TLV_MAX_CHILD_DESC 128
typedef enum {
TLV_UINT8,
TLV_UINT16,
@@ -37,7 +39,7 @@ typedef struct _tlv_desc_t {
c_uint16_t length;
c_uint8_t instance;
c_uint16_t vsize;
void *child_descs[];
void *child_descs[TLV_MAX_CHILD_DESC];
} tlv_desc_t;
extern tlv_desc_t tlv_desc_more1;
@@ -105,7 +107,7 @@ typedef struct _tlv_int32_t {
d_assert((__dATA), , "Null param"); \
if ((__dATA)->data) \
{ \
core_free((__dATA)->data); \
CORE_FREE((__dATA)->data); \
(__dATA)->data = NULL; \
(__dATA)->len = 0; \
(__dATA)->presence = 0; \
@@ -119,7 +121,7 @@ typedef struct _tlv_int32_t {
TLV_CLEAR_DATA(__dST); \
(__dST)->presence = (__sRC)->presence; \
(__dST)->len = (__sRC)->len; \
(__dST)->data = core_calloc(1, sizeof((__dST)->len)); \
(__dST)->data = core_calloc((__dST)->len, sizeof(c_uint8_t)); \
memcpy((__dST)->data, (__sRC)->data, (__dST)->len); \
} while(0)
typedef struct _tlv_octet_t {

View File

@@ -0,0 +1,20 @@
#ifndef __CORE_UDP_H__
#define __CORE_UDP_H__
#include "core_sock.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
CORE_DECLARE(status_t) udp_open(sock_id *new,
int family,
const char *local_host, c_uint16_t local_port,
const char *remote_host, c_uint16_t remote_port,
int flags);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif

View File

@@ -2,8 +2,9 @@
#include "core_debug.h"
#include "core_lib.h"
#include "core_pkbuf.h"
#include "types.h"
#include "3gpp_types.h"
#define PLMN_ID_DIGIT1(x) (((x) / 100) % 10)
#define PLMN_ID_DIGIT2(x) (((x) / 10) % 10)

View File

@@ -1,8 +1,6 @@
## Process this file with automake to produce Makefile.in
SUBDIRS = @OSDIR@
noinst_LTLIBRARIES = libcore.la
pkglib_LTLIBRARIES = libcore.la
libcore_la_SOURCES = \
../include/core_aes_cmac.h ../include/core_aes.h ../include/core_cond.h \
@@ -10,7 +8,7 @@ libcore_la_SOURCES = \
../include/core_fsm.h ../include/core_general.h ../include/core.h \
../include/core.h.in ../include/core_index.h ../include/core_lib.h \
../include/core_list.h ../include/core_msgq.h ../include/core_mutex.h \
../include/core_net.h ../include/core_param.h ../include/core_pkbuf.h \
../include/core_network.h ../include/core_param.h ../include/core_pkbuf.h \
../include/core_pool.h ../include/core_queue.h ../include/core_ringbuf.h \
../include/core_rwlock.h ../include/core_semaphore.h ../include/core_sha1.h \
../include/core_sha1_hmac.h ../include/core_sha2.h ../include/core_sha2_hmac.h \
@@ -18,23 +16,41 @@ libcore_la_SOURCES = \
../include/core_timer.h ../include/core_tlv.h ../include/core_tlv_msg.h \
../include/core_atomic.h ../include/core_portable.h \
../include/core_version.h ../include/core_event.h ../include/core_hash.h \
../include/core_jsmn.h \
version.c debug.c fsm.c msgq.c ringbuf.c timer.c tlv.c tlv_msg.c \
../include/3gpp_types.h \
\
debug.c version.c fsm.c msgq.c ringbuf.c timer.c tlv.c tlv_msg.c hash.c \
aes.c aes_cmac.c sha1.c sha1_hmac.c sha2.c sha2_hmac.c misc.c event.c \
hash.c jsmn.c
3gpp_types.c \
\
../include/arch/core_private_common.h \
../include/arch/unix/core_arch_file.h \
../include/arch/unix/core_arch_mutex.h \
../include/arch/unix/core_arch_semaphore.h \
../include/arch/unix/core_arch_thread.h \
unix/start.c unix/errorcodes.c unix/pkbuf.c \
unix/rand.c unix/time.c unix/file.c \
unix/thread.c unix/signal.c \
unix/atomic.c unix/cond.c unix/mutex.c unix/rwlock.c unix/semaphore.c \
unix/socket.c unix/sockaddr.c unix/udp.c unix/tcp.c unix/tun.c \
$(NULL)
libcore_la_DEPENDENCIES = \
$(top_srcdir)/lib/core/src/@OSDIR@/libcore@OSDIR@.la
if !USRSCTP
libcore_la_SOURCES += unix/sctp.c
endif
libcore_la_LIBADD = \
$(top_srcdir)/lib/core/src/@OSDIR@/libcore@OSDIR@.la
AM_LDFLAGS = \
-version-info @LIBVERSION@ \
$(NULL)
AM_CPPFLAGS = \
-I$(top_srcdir)/lib/core/include/arch/@OSDIR@ \
-I$(top_srcdir)/lib/core/include
-I$(top_srcdir)/lib/core/include \
$(NULL)
AM_CFLAGS = \
-Wall -Werror
-Wall -Werror \
@OSCPPFLAGS@ \
$(NULL)
MAINTAINERCLEANFILES = Makefile.in
MOSTLYCLEANFILES = core *.stackdump

View File

@@ -1,6 +1,7 @@
#include "core_debug.h"
#include "core_param.h"
#include "core_file.h"
#include "core_thread.h"
#include <syslog.h>
#include <sys/socket.h>
@@ -9,61 +10,259 @@
int g_trace_mask = 1;
int g_msg_to = D_MSG_TO_LOGD | D_MSG_TO_STDOUT;
int g_msg_to = D_MSG_TO_STDOUT;
int g_console_connected = 0;
int g_syslog_connected = 0;
int g_logd_connected = 0;
int g_network_connected = 0;
int g_file_connected = 0;
int g_log_level_console = D_LOG_LEVEL_FULL;
int g_log_level_stdout = D_LOG_LEVEL_FULL;
int g_log_level_syslog = D_LOG_LEVEL_FULL;
int g_log_level_logd = D_LOG_LEVEL_FULL;
int g_log_level_network = D_LOG_LEVEL_FULL;
int g_log_level_file = D_LOG_LEVEL_FULL;
int g_console_fd = -1;
int g_logd_fd = -1;
struct sockaddr_un g_logd_addr;
static int g_console_fd = -1;
static int g_network_fd = -1;
static struct sockaddr_un g_network_addr;
void d_msg_init()
static thread_id network_thread = 0;
static void *THREAD_FUNC network_main(thread_id id, void *data);
static int network_handler(const char *path);
static file_t *g_file = NULL;
status_t d_msg_console_init(int console_fd)
{
openlog("libcore", 0, LOG_DAEMON);
g_syslog_connected = 1;
g_logd_fd = socket(AF_UNIX, SOCK_DGRAM, 0);
d_assert(g_logd_fd >= 0, return,
"socket() failed. (%d:%s)\n", errno, strerror(errno));
g_logd_addr.sun_family = AF_UNIX;
strcpy(g_logd_addr.sun_path, D_LOGD_IPC_PATH);
g_logd_connected = 1;
}
void d_msg_final()
{
g_syslog_connected = 0;
closelog();
g_logd_connected = 0;
close(g_logd_fd);
g_logd_fd = -1;
}
void d_msg_register_console(int console_fd)
{
d_assert(console_fd >= 0, return, "param 'console_fd' is invalid");
d_assert(console_fd >= 0, return CORE_ERROR,
"param 'console_fd' is invalid");
g_console_fd = console_fd;
g_console_connected = 1;
return CORE_OK;
}
void d_msg_deregister_console()
void d_msg_console_final()
{
g_console_connected = 0;
g_console_fd = -1;
}
void d_msg_syslog_init(const char *name)
{
d_assert(name, return, );
openlog(name, 0, LOG_DAEMON);
g_syslog_connected = 1;
}
void d_msg_syslog_final()
{
g_syslog_connected = 0;
closelog();
}
status_t d_msg_network_init(const char *name)
{
d_assert(name, return CORE_ERROR, );
g_network_fd = socket(AF_UNIX, SOCK_DGRAM, 0);
d_assert(g_network_fd >= 0, return CORE_ERROR,
"socket() failed. (%d:%s)\n", errno, strerror(errno));
g_network_addr.sun_family = AF_UNIX;
strcpy(g_network_addr.sun_path, name);
return CORE_OK;
}
status_t d_msg_network_start(const char *file)
{
status_t rv;
d_assert(file, return CORE_ERROR, );
rv = thread_create(&network_thread, NULL, network_main, (void*)file);
d_assert(rv == CORE_OK, return CORE_ERROR,
"network thread creation failed");
g_network_connected = 1;
d_msg_to(D_MSG_TO_NETWORK, 1);
return CORE_OK;
}
void d_msg_network_stop()
{
d_msg_to(D_MSG_TO_NETWORK, 0);
g_network_connected = 0;
if (network_thread)
thread_delete(network_thread);
}
void d_msg_network_final()
{
close(g_network_fd);
g_network_fd = -1;
}
static void *THREAD_FUNC network_main(thread_id id, void *data)
{
int ret;
char *path = data;
ret = network_handler(path);
if (ret != 0)
{
d_error("Failed to initialize logger.");
d_error("Check file permission for `%s`", path);
}
return NULL;
}
static int network_handler(const char *path)
{
status_t rv;
int ret;
size_t nbytes;
ssize_t r;
int us;
fd_set readfd;
struct timeval timer_val;
struct sockaddr_un svaddr;
file_t *file = NULL;
char g_buffer[HUGE_STRING_LEN];
us = socket(AF_UNIX, SOCK_DGRAM, 0);
if (us < 0)
{
d_error("socket() failed. (%d:%s)", errno, strerror(errno));
return -1;
}
memcpy(&svaddr, &g_network_addr, sizeof(struct sockaddr_un));
ret = bind(us, (struct sockaddr *)&svaddr, sizeof(svaddr));
if (ret != 0)
{
if (errno == EADDRINUSE)
{
ret = file_remove(svaddr.sun_path);
if (ret != 0)
{
d_error("unlink(`%s`) failed. (%d:%s)",
svaddr.sun_path, errno, strerror(errno));
return -1;
}
ret = bind(us, (struct sockaddr *)&svaddr, sizeof(svaddr));
if (ret != 0)
{
d_error("bind() failed 2. (%d:%s)", errno, strerror(errno));
return -1;
}
}
else
{
d_error("bind() failed. (%d:%s)", errno, strerror(errno));
return -1;
}
}
rv = file_open(&file, path,
FILE_CREATE | FILE_WRITE| FILE_APPEND,
FILE_UREAD | FILE_UWRITE | FILE_GREAD);
if (rv != CORE_OK)
{
d_error("Cannot open log file '%s'", path);
close(us);
return -1;
}
while (!thread_should_stop())
{
timer_val.tv_sec = 0;
timer_val.tv_usec = 50000;
FD_ZERO(&readfd);
FD_SET(us, &readfd);
r = select (us+1, &readfd, NULL, NULL, &timer_val);
if (r == -1)
{
if (errno == EINTR)
break;
d_error("select() error(%d: %s)", errno, strerror(errno));
}
if (r == 0)
continue;
if (FD_ISSET(us, &readfd))
{
r = read(us, g_buffer, sizeof(g_buffer));
if (r < 0)
{
if (errno == EINTR)
break;
d_error("read() failed. (%d:%s)", errno, strerror(errno));
continue;
}
if (r == 0)
continue;
nbytes = r;
rv = file_write(file, g_buffer, &nbytes);
if (rv != CORE_OK || r != nbytes)
{
d_error("Cannot write %ld bytes to log file (%ld written)",
(long)r, (long)nbytes);
}
}
}
file_close(file);
close(us);
file_remove(svaddr.sun_path);
return 0;
}
status_t d_msg_file_init(const char *file)
{
status_t rv;
d_assert(file, return CORE_ERROR, );
rv = file_open(&g_file, file,
FILE_CREATE | FILE_WRITE| FILE_APPEND,
FILE_UREAD | FILE_UWRITE | FILE_GREAD);
if (rv != CORE_OK)
{
d_error("CHECK PERMISSION of Installation Directory...");
d_error("Cannot create LOG file '%s'", file);
return CORE_ERROR;
}
g_file_connected = 1;
d_msg_to(D_MSG_TO_FILE, 1);
return CORE_OK;
}
void d_msg_file_final()
{
d_msg_to(D_MSG_TO_FILE, 0);
g_file_connected = 0;
file_close(g_file);
}
void d_msg_to(int to, int on_off)
{
switch (to)
@@ -83,10 +282,15 @@ void d_msg_to(int to, int on_off)
g_msg_to | D_MSG_TO_SYSLOG :
g_msg_to & ~D_MSG_TO_SYSLOG;
break;
case D_MSG_TO_LOGD:
case D_MSG_TO_NETWORK:
g_msg_to = on_off ?
g_msg_to | D_MSG_TO_LOGD :
g_msg_to & ~D_MSG_TO_LOGD;
g_msg_to | D_MSG_TO_NETWORK :
g_msg_to & ~D_MSG_TO_NETWORK;
break;
case D_MSG_TO_FILE:
g_msg_to = on_off ?
g_msg_to | D_MSG_TO_FILE :
g_msg_to & ~D_MSG_TO_FILE;
break;
case D_MSG_TO_ALL:
g_msg_to = on_off ? D_MSG_TO_ALL : 0;
@@ -114,14 +318,18 @@ void d_log_set_level(int to, int level)
case D_MSG_TO_SYSLOG:
g_log_level_syslog = level;
break;
case D_MSG_TO_LOGD:
g_log_level_logd = level;
case D_MSG_TO_NETWORK:
g_log_level_network = level;
break;
case D_MSG_TO_FILE:
g_log_level_file = level;
break;
case D_MSG_TO_ALL:
g_log_level_console = level;
g_log_level_stdout = level;
g_log_level_syslog = level;
g_log_level_logd = level;
g_log_level_network = level;
g_log_level_file = level;
break;
default:
break;
@@ -138,8 +346,10 @@ int d_log_get_level(int to)
return g_log_level_stdout;
case D_MSG_TO_SYSLOG:
return g_log_level_syslog;
case D_MSG_TO_LOGD:
return g_log_level_logd;
case D_MSG_TO_NETWORK:
return g_log_level_network;
case D_MSG_TO_FILE:
return g_log_level_file;
default:
break;
}
@@ -160,14 +370,18 @@ void d_log_full(int to)
case D_MSG_TO_SYSLOG:
g_log_level_syslog = D_LOG_LEVEL_FULL;
break;
case D_MSG_TO_LOGD:
g_log_level_logd = D_LOG_LEVEL_FULL;
case D_MSG_TO_NETWORK:
g_log_level_network = D_LOG_LEVEL_FULL;
break;
case D_MSG_TO_FILE:
g_log_level_file = D_LOG_LEVEL_FULL;
break;
case D_MSG_TO_ALL:
g_log_level_console = D_LOG_LEVEL_FULL;
g_log_level_stdout = D_LOG_LEVEL_FULL;
g_log_level_syslog = D_LOG_LEVEL_FULL;
g_log_level_logd = D_LOG_LEVEL_FULL;
g_log_level_network = D_LOG_LEVEL_FULL;
g_log_level_file = D_LOG_LEVEL_FULL;
break;
default:
break;
@@ -187,14 +401,18 @@ void d_log_off(int to)
case D_MSG_TO_SYSLOG:
g_log_level_syslog = D_LOG_LEVEL_NONE;
break;
case D_MSG_TO_LOGD:
g_log_level_logd = D_LOG_LEVEL_NONE;
case D_MSG_TO_NETWORK:
g_log_level_network = D_LOG_LEVEL_NONE;
break;
case D_MSG_TO_FILE:
g_log_level_file = D_LOG_LEVEL_NONE;
break;
case D_MSG_TO_ALL:
g_log_level_console = D_LOG_LEVEL_NONE;
g_log_level_stdout = D_LOG_LEVEL_NONE;
g_log_level_syslog = D_LOG_LEVEL_NONE;
g_log_level_logd = D_LOG_LEVEL_NONE;
g_log_level_network = D_LOG_LEVEL_NONE;
g_log_level_file = D_LOG_LEVEL_NONE;
break;
default:
break;
@@ -254,7 +472,7 @@ void d_trace_off(int *mod_name)
int d_msg(int tp, int lv, c_time_t t, char *fn, int ln, char *fmt, ...)
{
char str[384] = {0}, fstr[HUGE_STRING_LEN] = {0}, *ac_str;
char str[HUGE_STRING_LEN] = {0}, fstr[HUGE_STRING_LEN] = {0}, *ac_str;
time_exp_t te;
size_t n;
char *lv_str[5] = {"NONE", "FATL", "ERRR", "WARN", "INFO"};
@@ -283,10 +501,15 @@ int d_msg(int tp, int lv, c_time_t t, char *fn, int ln, char *fmt, ...)
{
syslog(LOG_DEBUG, "%s", fstr);
}
if (g_logd_connected && (g_msg_to & D_MSG_TO_LOGD))
if (g_network_connected && (g_msg_to & D_MSG_TO_NETWORK))
{
sendto(g_logd_fd, fstr, n, 0,
(struct sockaddr *)&g_logd_addr, sizeof(g_logd_addr));
sendto(g_network_fd, fstr, n, 0,
(struct sockaddr *)&g_network_addr, sizeof(g_network_addr));
}
if (g_file_connected && (g_msg_to & D_MSG_TO_FILE))
{
size_t nbytes = n;
file_write(g_file, fstr, &nbytes);
}
if (g_console_connected && (g_msg_to & D_MSG_TO_CONSOLE))
{
@@ -300,7 +523,11 @@ int d_msg(int tp, int lv, c_time_t t, char *fn, int ln, char *fmt, ...)
}
case D_MSG_TYPE_TRACE:
{
n = vsprintf(fstr, fmt, args);
vsprintf(str, fmt, args);
n = sprintf(fstr, "["TIME_FMT_STR"] %s",
te.tm_mon + 1, te.tm_mday, te.tm_hour,
te.tm_min, te.tm_sec, te.tm_usec/1000, str);
if (g_msg_to & D_MSG_TO_STDOUT)
{
@@ -310,10 +537,15 @@ int d_msg(int tp, int lv, c_time_t t, char *fn, int ln, char *fmt, ...)
{
syslog(LOG_DEBUG, "%s", fstr);
}
if (g_logd_connected && (g_msg_to & D_MSG_TO_LOGD))
if (g_network_connected && (g_msg_to & D_MSG_TO_NETWORK))
{
sendto(g_logd_fd, fstr, n, 0,
(struct sockaddr *)&g_logd_addr, sizeof(g_logd_addr));
sendto(g_network_fd, fstr, n, 0,
(struct sockaddr *)&g_network_addr, sizeof(g_network_addr));
}
if (g_file_connected && (g_msg_to & D_MSG_TO_FILE))
{
size_t nbytes = n;
file_write(g_file, fstr, &nbytes);
}
if (g_console_connected && (g_msg_to & D_MSG_TO_CONSOLE))
{
@@ -353,12 +585,20 @@ int d_msg(int tp, int lv, c_time_t t, char *fn, int ln, char *fmt, ...)
{
syslog(LOG_INFO, "[%s\n", fstr + 13);
}
if (g_logd_connected && (g_msg_to & D_MSG_TO_LOGD) &&
lv <= g_log_level_logd)
if (g_network_connected && (g_msg_to & D_MSG_TO_NETWORK) &&
lv <= g_log_level_network)
{
fstr[n++] = '\n';
sendto(g_logd_fd, fstr, n, 0,
(struct sockaddr *)&g_logd_addr, sizeof(g_logd_addr));
sendto(g_network_fd, fstr, n, 0,
(struct sockaddr *)&g_network_addr, sizeof(g_network_addr));
}
if (g_file_connected && (g_msg_to & D_MSG_TO_FILE))
{
size_t nbytes;
fstr[n++] = '\n';
nbytes = n;
file_write(g_file, fstr, &nbytes);
}
if (g_console_connected && (g_msg_to & D_MSG_TO_CONSOLE) &&
lv <= g_log_level_console)
@@ -384,11 +624,19 @@ int d_msg(int tp, int lv, c_time_t t, char *fn, int ln, char *fmt, ...)
{
syslog(LOG_CRIT, "[%s\n", fstr + 13);
}
if (g_logd_connected && (g_msg_to & D_MSG_TO_LOGD))
if (g_network_connected && (g_msg_to & D_MSG_TO_NETWORK))
{
fstr[n++] = '\n';
sendto(g_logd_fd, fstr, n, 0,
(struct sockaddr *)&g_logd_addr, sizeof(g_logd_addr));
sendto(g_network_fd, fstr, n, 0,
(struct sockaddr *)&g_network_addr, sizeof(g_network_addr));
}
if (g_file_connected && (g_msg_to & D_MSG_TO_FILE))
{
size_t nbytes;
fstr[n++] = '\n';
nbytes = n;
file_write(g_file, fstr, &nbytes);
}
if (g_console_connected && (g_msg_to & D_MSG_TO_CONSOLE))
{

View File

@@ -12,12 +12,12 @@
char *EVT_NAME_UNKNOWN = "UNKNOWN";
msgq_id event_create(void)
msgq_id event_create(int opt)
{
msgq_id queue_id = 0;
/* Start threads */
queue_id = msgq_create(EVT_Q_DEPTH, EVENT_SIZE, MSGQ_O_BLOCK);
queue_id = msgq_create(EVT_Q_DEPTH, EVENT_SIZE, opt);
d_assert(queue_id != 0, return CORE_ERROR, "Message queue creation failed");
return queue_id;
@@ -50,6 +50,22 @@ status_t event_send(msgq_id queue_id, event_t *e)
return rv;
}
status_t event_recv(msgq_id queue_id, event_t *e)
{
status_t rv;
d_assert(e, return -1, "Null param");
d_assert(queue_id, return -1, "event queue isn't initialized");
rv = msgq_recv(queue_id, (char*)e, EVENT_SIZE);
if (rv == CORE_ERROR)
{
d_error("msgq_timedrecv failed", rv);
}
return rv;
}
status_t event_timedrecv(msgq_id queue_id, event_t *e, c_time_t timeout)
{
status_t rv;

View File

@@ -20,7 +20,7 @@ void fsm_init(void *s, void *_e)
fsm_t *fsm = s;
event_t *e = _e;
if (fsm->initial != (fsm_state_t)0)
if (fsm->initial != NULL)
{
(*fsm->initial)(s, e);
if (fsm->initial != fsm->state)
@@ -43,10 +43,16 @@ void fsm_dispatch(void *s, void *_e)
fsm_t *fsm = s;
event_t *e = _e;
fsm_handler_t tmp = fsm->state;
#if OLD_FSM_DISPATCH
fsm->state = (fsm_handler_t)0;
#endif
(*tmp)(s, e);
if (fsm->state != (fsm_state_t)0)
#if OLD_FSM_DISPATCH
if (fsm->state != NULL)
#else
if (fsm->state != tmp)
#endif
{
if (e)
{
@@ -64,13 +70,19 @@ void fsm_dispatch(void *s, void *_e)
}
else
{
#if OLD_FSM_DISPATCH
(*tmp)(s, &entry_event);
#else
(*fsm->state)(s, &entry_event);
#endif
}
}
#if OLD_FSM_DISPATCH
else
{
fsm->state = tmp;
}
#endif
}
void fsm_final(void *s, void *_e)
@@ -91,7 +103,7 @@ void fsm_final(void *s, void *_e)
}
}
if (fsm->final != (fsm_state_t)0)
if (fsm->final != NULL)
{
(*fsm->final)(s, e);
}

View File

@@ -101,12 +101,12 @@ CORE_DECLARE(void) hash_destroy(hash_t *ht)
{
next_he = he->next;
core_free(he);
CORE_FREE(he);
he = next_he;
}
core_free(ht->array);
core_free(ht);
CORE_FREE(ht->array);
CORE_FREE(ht);
}
/*
@@ -188,7 +188,7 @@ static void expand_array(hash_t *ht)
hi->this->next = new_array[i];
new_array[i] = hi->this;
}
core_free(ht->array);
CORE_FREE(ht->array);
ht->array = new_array;
ht->max = new_max;
}

View File

@@ -1,330 +0,0 @@
#include "core.h"
#include "core_jsmn.h"
/**
* Allocates a fresh unused token from the token pull.
*/
static jsmntok_t *jsmn_alloc_token(jsmn_parser *parser,
jsmntok_t *tokens, size_t num_tokens) {
jsmntok_t *tok;
if (parser->toknext >= num_tokens) {
return NULL;
}
tok = &tokens[parser->toknext++];
tok->start = tok->end = -1;
tok->size = 0;
#ifdef JSMN_PARENT_LINKS
tok->parent = -1;
#endif
return tok;
}
/**
* Fills token type and boundaries.
*/
static void jsmn_fill_token(jsmntok_t *token, jsmntype_t type,
int start, int end) {
token->type = type;
token->start = start;
token->end = end;
token->size = 0;
}
/**
* Fills next available token with JSON primitive.
*/
static int jsmn_parse_primitive(jsmn_parser *parser, const char *js,
size_t len, jsmntok_t *tokens, size_t num_tokens) {
jsmntok_t *token;
int start;
start = parser->pos;
for (; parser->pos < len && js[parser->pos] != '\0'; parser->pos++) {
switch (js[parser->pos]) {
#ifndef JSMN_STRICT
/* In strict mode primitive must be followed by "," or "}" or "]" */
case ':':
#endif
case '\t' : case '\r' : case '\n' : case ' ' :
case ',' : case ']' : case '}' :
goto found;
}
if (js[parser->pos] < 32 || js[parser->pos] >= 127) {
parser->pos = start;
return JSMN_ERROR_INVAL;
}
}
#ifdef JSMN_STRICT
/* In strict mode primitive must be followed by a comma/object/array */
parser->pos = start;
return JSMN_ERROR_PART;
#endif
found:
if (tokens == NULL) {
parser->pos--;
return 0;
}
token = jsmn_alloc_token(parser, tokens, num_tokens);
if (token == NULL) {
parser->pos = start;
return JSMN_ERROR_NOMEM;
}
jsmn_fill_token(token, JSMN_PRIMITIVE, start, parser->pos);
#ifdef JSMN_PARENT_LINKS
token->parent = parser->toksuper;
#endif
parser->pos--;
return 0;
}
/**
* Fills next token with JSON string.
*/
static int jsmn_parse_string(jsmn_parser *parser, const char *js,
size_t len, jsmntok_t *tokens, size_t num_tokens) {
jsmntok_t *token;
int start = parser->pos;
parser->pos++;
/* Skip starting quote */
for (; parser->pos < len && js[parser->pos] != '\0'; parser->pos++) {
char c = js[parser->pos];
/* Quote: end of string */
if (c == '\"') {
if (tokens == NULL) {
return 0;
}
token = jsmn_alloc_token(parser, tokens, num_tokens);
if (token == NULL) {
parser->pos = start;
return JSMN_ERROR_NOMEM;
}
jsmn_fill_token(token, JSMN_STRING, start+1, parser->pos);
#ifdef JSMN_PARENT_LINKS
token->parent = parser->toksuper;
#endif
return 0;
}
/* Backslash: Quoted symbol expected */
if (c == '\\' && parser->pos + 1 < len) {
int i;
parser->pos++;
switch (js[parser->pos]) {
/* Allowed escaped symbols */
case '\"': case '/' : case '\\' : case 'b' :
case 'f' : case 'r' : case 'n' : case 't' :
break;
/* Allows escaped symbol \uXXXX */
case 'u':
parser->pos++;
for(i = 0; i < 4 && parser->pos < len && js[parser->pos] != '\0'; i++) {
/* If it isn't a hex character we have an error */
if(!((js[parser->pos] >= 48 && js[parser->pos] <= 57) || /* 0-9 */
(js[parser->pos] >= 65 && js[parser->pos] <= 70) || /* A-F */
(js[parser->pos] >= 97 && js[parser->pos] <= 102))) { /* a-f */
parser->pos = start;
return JSMN_ERROR_INVAL;
}
parser->pos++;
}
parser->pos--;
break;
/* Unexpected symbol */
default:
parser->pos = start;
return JSMN_ERROR_INVAL;
}
}
}
parser->pos = start;
return JSMN_ERROR_PART;
}
/**
* Parse JSON string and fill tokens.
*/
int jsmn_parse(jsmn_parser *parser, const char *js, size_t len,
jsmntok_t *tokens, unsigned int num_tokens) {
int r;
int i;
jsmntok_t *token;
int count = parser->toknext;
for (; parser->pos < len && js[parser->pos] != '\0'; parser->pos++) {
char c;
jsmntype_t type;
c = js[parser->pos];
switch (c) {
case '{': case '[':
count++;
if (tokens == NULL) {
break;
}
token = jsmn_alloc_token(parser, tokens, num_tokens);
if (token == NULL)
return JSMN_ERROR_NOMEM;
if (parser->toksuper != -1) {
tokens[parser->toksuper].size++;
#ifdef JSMN_PARENT_LINKS
token->parent = parser->toksuper;
#endif
}
token->type = (c == '{' ? JSMN_OBJECT : JSMN_ARRAY);
token->start = parser->pos;
parser->toksuper = parser->toknext - 1;
break;
case '}': case ']':
if (tokens == NULL)
break;
type = (c == '}' ? JSMN_OBJECT : JSMN_ARRAY);
#ifdef JSMN_PARENT_LINKS
if (parser->toknext < 1) {
return JSMN_ERROR_INVAL;
}
token = &tokens[parser->toknext - 1];
for (;;) {
if (token->start != -1 && token->end == -1) {
if (token->type != type) {
return JSMN_ERROR_INVAL;
}
token->end = parser->pos + 1;
parser->toksuper = token->parent;
break;
}
if (token->parent == -1) {
if(token->type != type || parser->toksuper == -1) {
return JSMN_ERROR_INVAL;
}
break;
}
token = &tokens[token->parent];
}
#else
for (i = parser->toknext - 1; i >= 0; i--) {
token = &tokens[i];
if (token->start != -1 && token->end == -1) {
if (token->type != type) {
return JSMN_ERROR_INVAL;
}
parser->toksuper = -1;
token->end = parser->pos + 1;
break;
}
}
/* Error if unmatched closing bracket */
if (i == -1) return JSMN_ERROR_INVAL;
for (; i >= 0; i--) {
token = &tokens[i];
if (token->start != -1 && token->end == -1) {
parser->toksuper = i;
break;
}
}
#endif
break;
case '\"':
r = jsmn_parse_string(parser, js, len, tokens, num_tokens);
if (r < 0) return r;
count++;
if (parser->toksuper != -1 && tokens != NULL)
tokens[parser->toksuper].size++;
break;
case '\t' : case '\r' : case '\n' : case ' ':
break;
case ':':
parser->toksuper = parser->toknext - 1;
break;
case ',':
if (tokens != NULL && parser->toksuper != -1 &&
tokens[parser->toksuper].type != JSMN_ARRAY &&
tokens[parser->toksuper].type != JSMN_OBJECT) {
#ifdef JSMN_PARENT_LINKS
parser->toksuper = tokens[parser->toksuper].parent;
#else
for (i = parser->toknext - 1; i >= 0; i--) {
if (tokens[i].type == JSMN_ARRAY || tokens[i].type == JSMN_OBJECT) {
if (tokens[i].start != -1 && tokens[i].end == -1) {
parser->toksuper = i;
break;
}
}
}
#endif
}
break;
#ifdef JSMN_STRICT
/* In strict mode primitives are: numbers and booleans */
case '-': case '0': case '1' : case '2': case '3' : case '4':
case '5': case '6': case '7' : case '8': case '9':
case 't': case 'f': case 'n' :
/* And they must not be keys of the object */
if (tokens != NULL && parser->toksuper != -1) {
jsmntok_t *t = &tokens[parser->toksuper];
if (t->type == JSMN_OBJECT ||
(t->type == JSMN_STRING && t->size != 0)) {
return JSMN_ERROR_INVAL;
}
}
#else
/* In non-strict mode every unquoted value is a primitive */
default:
#endif
r = jsmn_parse_primitive(parser, js, len, tokens, num_tokens);
if (r < 0) return r;
count++;
if (parser->toksuper != -1 && tokens != NULL)
tokens[parser->toksuper].size++;
break;
#ifdef JSMN_STRICT
/* Unexpected char in strict mode */
default:
return JSMN_ERROR_INVAL;
#endif
}
}
if (tokens != NULL) {
for (i = parser->toknext - 1; i >= 0; i--) {
/* Unmatched opened object or array */
if (tokens[i].start != -1 && tokens[i].end == -1) {
return JSMN_ERROR_PART;
}
}
}
return count;
}
/**
* Creates a new parser based over a given buffer with an array of tokens
* available.
*/
void jsmn_init(jsmn_parser *parser) {
parser->pos = 0;
parser->toknext = 0;
parser->toksuper = -1;
}
int jsmntok_equal(char *json, jsmntok_t *token, const char *s)
{
if (strlen(s) == (size_t)(token->end - token->start) &&
strncmp(json + token->start, s, token->end - token->start) == 0)
{
return 0;
}
return -1;
}
char *jsmntok_to_string(char *json, jsmntok_t *token)
{
json[token->end] = '\0';
return json + token->start;
}

View File

@@ -143,3 +143,56 @@ char *core_cpystrn(char *dst, const char *src, size_t dst_size)
return (d);
}
char *core_env_get(const char *envvar)
{
#ifdef HAVE_GETENV
return getenv(envvar);
#else
return NULL;
#endif
}
status_t core_env_set(const char *envvar, const char *value)
{
#if defined(HAVE_SETENV)
if (0 > setenv(envvar, value, 1))
return CORE_ENOMEM;
return CORE_OK;
#elif defined(HAVE_PUTENV)
char buf[HUGE_STRING_LEN];
if (snprintf(buf, HUGE_STRING_LEN, "%s=%s", envvar, value) < 0)
return CORE_ENOMEM;
if (0 > putenv(buf))
return CORE_ENOMEM;
return CORE_OK;
#else
return CORE_ENOTIMPL;
#endif
}
status_t core_env_delete(const char *envvar)
{
#ifdef HAVE_UNSETENV
unsetenv(envvar);
return CORE_OK;
#else
/* hint: some platforms allow envvars to be unset via
* putenv("varname")... that isn't Single Unix spec,
* but if your platform doesn't have unsetenv() it is
* worth investigating and potentially adding a
* configure check to decide when to use that form of
* putenv() here
*/
return CORE_ENOTIMPL;
#endif
}

View File

@@ -77,7 +77,7 @@ msgq_id msgq_create(int qdepth, int msgsize, int opt)
return (msgq_id)md;
error_final:
if (md->pool) core_free(md->pool);
if (md->pool) CORE_FREE(md->pool);
if (md->mut_c) mutex_delete(md->mut_c);
if (md->mut_r) mutex_delete(md->mut_r);
if (md->mut_w) mutex_delete(md->mut_w);
@@ -94,7 +94,7 @@ status_t msgq_delete(msgq_id id)
d_assert(md != NULL, return CORE_ERROR, "param 'id' is null");
if (md->pool) core_free(md->pool);
if (md->pool) CORE_FREE(md->pool);
if (md->mut_c) mutex_delete(md->mut_c);
if (md->mut_r) mutex_delete(md->mut_r);
if (md->mut_w) mutex_delete(md->mut_w);

View File

@@ -44,6 +44,13 @@ status_t tm_init(void)
status_t tm_final(void)
{
if (pool_size(&timer_pool) != pool_avail(&timer_pool))
d_error("%d not freed in timer_pool[%d]",
pool_size(&timer_pool) - pool_avail(&timer_pool),
pool_size(&timer_pool));
d_trace(9, "%d not freed in timer_pool[%d]\n",
pool_size(&timer_pool) - pool_avail(&timer_pool),
pool_size(&timer_pool));
pool_final(&timer_pool);
return CORE_OK;
}

View File

@@ -22,7 +22,7 @@ static tlv_t* _tlv_add_leaf(
{
tlv_uint8_t *v = (tlv_uint8_t *)msg;
d_trace(5, "V_1B:%02x", v->u8);
d_trace2(25, "V_1B:%02x", v->u8);
if (parent_tlv)
tlv = tlv_embed(parent_tlv,
@@ -37,7 +37,7 @@ static tlv_t* _tlv_add_leaf(
{
tlv_uint16_t *v = (tlv_uint16_t *)msg;
d_trace(5, "V_2B:%04x", v->u16);
d_trace2(25, "V_2B:%04x", v->u16);
v->u16 = htons(v->u16);
@@ -55,7 +55,7 @@ static tlv_t* _tlv_add_leaf(
{
tlv_uint24_t *v = (tlv_uint24_t *)msg;
d_trace(5, "V_3B:%06x", v->u24);
d_trace2(25, "V_3B:%06x", v->u24);
v->u24 = v->u24 << 8;
v->u24 = htonl(v->u24);
@@ -74,7 +74,7 @@ static tlv_t* _tlv_add_leaf(
{
tlv_uint32_t *v = (tlv_uint32_t *)msg;
d_trace(5, "V_4B:%08x", v->u32);
d_trace2(25, "V_4B:%08x", v->u32);
v->u32 = htonl(v->u32);
@@ -90,8 +90,8 @@ static tlv_t* _tlv_add_leaf(
{
tlv_octet_t *v = (tlv_octet_t *)msg;
d_trace(5, "V_FSTR: ", v->data);
d_trace_hex(5, v->data, v->len);
d_trace2(25, "V_FSTR: ", v->data);
d_trace_hex(25, v->data, v->len);
if (parent_tlv)
tlv = tlv_embed(parent_tlv,
@@ -108,8 +108,8 @@ static tlv_t* _tlv_add_leaf(
d_assert(v->len > 0, return NULL, "Length is zero");
d_trace(5, "V_VSTR: ", v->data);
d_trace_hex(5, v->data, v->len);
d_trace2(25, "V_VSTR: ", v->data);
d_trace_hex(25, v->data, v->len);
if (parent_tlv)
tlv = tlv_embed(parent_tlv,
@@ -122,7 +122,7 @@ static tlv_t* _tlv_add_leaf(
}
case TLV_NULL:
{
d_trace(5, "V_NULL" );
d_trace2(25, "V_NULL" );
if (parent_tlv)
tlv = tlv_embed(parent_tlv,
@@ -179,7 +179,7 @@ static c_uint32_t _tlv_add_compound(tlv_t **root, tlv_t *parent_tlv,
if (desc->ctype == TLV_COMPOUND)
{
d_trace(5, "\nBUILD %sC#%d [%s] T:%d I:%d (vsz=%d) off:%p ",
d_trace2(25, "\nBUILD %sC#%d [%s] T:%d I:%d (vsz=%d) off:%p ",
indent, i, desc->name, desc->type, desc->instance,
desc->vsize, p + offset2);
@@ -197,7 +197,7 @@ static c_uint32_t _tlv_add_compound(tlv_t **root, tlv_t *parent_tlv,
}
else
{
d_trace(5, "\nBUILD %sL#%d [%s] T:%d L:%d I:%d "
d_trace2(25, "\nBUILD %sL#%d [%s] T:%d L:%d I:%d "
"(cls:%d vsz:%d) off:%p ",
indent, i, desc->name, desc->type, desc->length,
desc->instance, desc->ctype, desc->vsize,
@@ -224,7 +224,7 @@ static c_uint32_t _tlv_add_compound(tlv_t **root, tlv_t *parent_tlv,
{
if (desc->ctype == TLV_COMPOUND)
{
d_trace(5, "\nBUILD %sC#%d [%s] T:%d I:%d (vsz=%d) off:%p ",
d_trace2(25, "\nBUILD %sC#%d [%s] T:%d I:%d (vsz=%d) off:%p ",
indent, i, desc->name, desc->type, desc->instance,
desc->vsize, p + offset);
@@ -242,7 +242,7 @@ static c_uint32_t _tlv_add_compound(tlv_t **root, tlv_t *parent_tlv,
}
else
{
d_trace(5, "\nBUILD %sL#%d [%s] T:%d L:%d I:%d "
d_trace2(25, "\nBUILD %sL#%d [%s] T:%d L:%d I:%d "
"(cls:%d vsz:%d) off:%p ",
indent, i, desc->name, desc->type, desc->length,
desc->instance, desc->ctype, desc->vsize,
@@ -277,8 +277,8 @@ status_t tlv_build_msg(pkbuf_t **pkbuf, tlv_desc_t *desc, void *msg, int mode)
d_assert(desc->child_descs[0], return CORE_ERROR,
"TLV message descriptor has no members");
d_trace(5, "\n");
d_trace(3, "[GTP] Build %s\n", desc->name);
d_trace2(25, "\n");
d_trace2(25, "[GTP] Build %s\n", desc->name);
r = _tlv_add_compound(&root, NULL, desc, msg, 0);
d_assert(r > 0 && root, tlv_free_all(root); return CORE_ERROR,
@@ -309,12 +309,12 @@ static tlv_desc_t* _tlv_find_desc(c_uint8_t *desc_index,
d_assert(parent_desc, return NULL, "Null param");
d_assert(tlv, return NULL, "Null param");
d_trace(5, "_tlv_find_desc:T(%d), I(%d) - ", tlv->type, tlv->instance);
d_trace2(25, "_tlv_find_desc:T(%d), I(%d) - ", tlv->type, tlv->instance);
for (i = 0, desc = parent_desc->child_descs[i]; desc != NULL;
i++, desc = parent_desc->child_descs[i])
{
d_trace(5, "%d, ", desc->type);
d_trace2(25, "%d, ", desc->type);
if (desc->type == tlv->type && desc->instance == tlv->instance)
{
@@ -337,7 +337,7 @@ static tlv_desc_t* _tlv_find_desc(c_uint8_t *desc_index,
prev_desc = desc;
}
d_trace(5, "\n");
d_trace2(25, "\n");
return desc;
}
@@ -361,7 +361,7 @@ static status_t _tlv_parse_leaf(void *msg, tlv_desc_t *desc, tlv_t *tlv)
return CORE_ERROR;
}
v->u8 = *(c_uint8_t*)(tlv->value);
d_trace(5, "V_1B:%02x", v->u8);
d_trace2(25, "V_1B:%02x", v->u8);
break;
}
case TLV_UINT16:
@@ -376,7 +376,7 @@ static status_t _tlv_parse_leaf(void *msg, tlv_desc_t *desc, tlv_t *tlv)
}
v->u16 = ((((c_uint8_t*)tlv->value)[0]<< 8)&0xff00) |
((((c_uint8_t*)tlv->value)[1] )&0x00ff);
d_trace(5, "V_2B:%02x", v->u16);
d_trace2(25, "V_2B:%02x", v->u16);
break;
}
case TLV_UINT24:
@@ -392,7 +392,7 @@ static status_t _tlv_parse_leaf(void *msg, tlv_desc_t *desc, tlv_t *tlv)
v->u24 = ((((c_uint8_t*)tlv->value)[0]<<16)&0x00ff0000) |
((((c_uint8_t*)tlv->value)[1]<< 8)&0x0000ff00) |
((((c_uint8_t*)tlv->value)[2] )&0x000000ff);
d_trace(5, "V_3B:%06x", v->u24);
d_trace2(25, "V_3B:%06x", v->u24);
break;
}
case TLV_UINT32:
@@ -409,7 +409,7 @@ static status_t _tlv_parse_leaf(void *msg, tlv_desc_t *desc, tlv_t *tlv)
((((c_uint8_t*)tlv->value)[1]<<16)&0x00ff0000) |
((((c_uint8_t*)tlv->value)[2]<< 8)&0x0000ff00) |
((((c_uint8_t*)tlv->value)[3] )&0x000000ff);
d_trace(5, "V_4B:%08x", v->u32);
d_trace2(25, "V_4B:%08x", v->u32);
break;
}
case TLV_FIXED_STR:
@@ -426,8 +426,8 @@ static status_t _tlv_parse_leaf(void *msg, tlv_desc_t *desc, tlv_t *tlv)
v->data = tlv->value;
v->len = tlv->length;
d_trace(5, "V_FSTR: ", v->data);
d_trace_hex(5, v->data, v->len);
d_trace2(25, "V_FSTR: ", v->data);
d_trace_hex(25, v->data, v->len);
break;
}
case TLV_VAR_STR:
@@ -437,8 +437,8 @@ static status_t _tlv_parse_leaf(void *msg, tlv_desc_t *desc, tlv_t *tlv)
v->data = tlv->value;
v->len = tlv->length;
d_trace(5, "V_VSTR: ", v->data);
d_trace_hex(5, v->data, v->len);
d_trace2(25, "V_VSTR: ", v->data);
d_trace_hex(25, v->data, v->len);
break;
}
case TLV_NULL:
@@ -520,7 +520,7 @@ static status_t _tlv_parse_compound(void *msg, tlv_desc_t *parent_desc,
return CORE_ERROR;
}
d_trace(5, "\nPARSE %sC#%d [%s] T:%d I:%d (vsz=%d) off:%p ",
d_trace2(25, "\nPARSE %sC#%d [%s] T:%d I:%d (vsz=%d) off:%p ",
indent, i++, desc->name, desc->type, desc->instance,
desc->vsize, p + offset);
@@ -538,7 +538,7 @@ static status_t _tlv_parse_compound(void *msg, tlv_desc_t *parent_desc,
}
else
{
d_trace(5, "\nPARSE %sL#%d [%s] T:%d L:%d I:%d "
d_trace2(25, "\nPARSE %sL#%d [%s] T:%d L:%d I:%d "
"(cls:%d vsz:%d) off:%p ",
indent, i++, desc->name, desc->type, desc->length,
desc->instance, desc->ctype, desc->vsize, p + offset);
@@ -555,7 +555,7 @@ static status_t _tlv_parse_compound(void *msg, tlv_desc_t *parent_desc,
tlv = tlv->next;
}
d_trace(5, "\n");
d_trace2(25, "\n");
return CORE_OK;
}
@@ -574,8 +574,8 @@ status_t tlv_parse_msg(void *msg, tlv_desc_t *desc, pkbuf_t *pkbuf, int mode)
d_assert(desc->child_descs[0], return CORE_ERROR,
"TLV message descriptor has no members");
d_trace(5, "\n");
d_trace(3, "[GTP] Parse %s\n", desc->name);
d_trace2(25, "\n");
d_trace2(25, "[GTP] Parse %s\n", desc->name);
root = tlv_parse_block(pkbuf->len, pkbuf->payload, mode);
if (root == NULL)

View File

@@ -1,23 +0,0 @@
## Process this file with automake to produce Makefile.in
noinst_LTLIBRARIES = libcoreunix.la
libcoreunix_la_SOURCES = \
../../include/arch/core_private_common.h \
../../include/arch/unix/core_arch_file.h \
../../include/arch/unix/core_arch_mutex.h \
../../include/arch/unix/core_arch_semaphore.h \
../../include/arch/unix/core_arch_thread.h \
cond.c file.c net_lib.c thread.c errorcodes.c mutex.c rwlock.c \
start.c time.c semaphore.c signal.c pkbuf.c rand.c atomic.c
AM_CPPFLAGS = \
-I$(top_srcdir) \
-I$(top_srcdir)/lib/core/include/arch/@OSDIR@ \
-I$(top_srcdir)/lib/core/include
AM_CFLAGS = \
-Wall -Werror @OSCPPFLAGS@
MAINTAINERCLEANFILES = Makefile.in
MOSTLYCLEANFILES = core *.stackdump

View File

@@ -16,7 +16,8 @@
#include "core.h"
#include "core_lib.h"
#include "core_net.h"
#include "core_arch_network.h"
static char *stuffbuffer(char *buf, size_t bufsize, const char *s)
{

View File

@@ -4,7 +4,6 @@
#include "core_general.h"
#include "core_debug.h"
#include "core_pool.h"
#include "core_net.h"
pool_declare(file_pool, file_t, MAX_NUM_OF_FILE);
@@ -100,6 +99,8 @@ status_t file_open(file_t **new,
os_file_t fd;
int oflags = 0;
d_assert(fname, return CORE_ERROR,);
if ((flag & FILE_READ) && (flag & FILE_WRITE))
{
oflags = O_RDWR;
@@ -178,6 +179,8 @@ status_t file_close(file_t *file)
{
status_t rv = CORE_OK;
d_assert(file, return CORE_ERROR,);
if (close(file->filedes) == 0)
{
file->filedes = -1;
@@ -201,6 +204,8 @@ status_t file_close(file_t *file)
status_t file_remove(const char *path)
{
d_assert(path, return CORE_ERROR,);
if (unlink(path) == 0)
{
return CORE_OK;
@@ -220,6 +225,9 @@ static status_t file_transfer_contents(
file_info_t finfo;
file_perms_t perms;
d_assert(from_path, return CORE_ERROR,);
d_assert(to_path, return CORE_ERROR,);
/* Open source file. */
status = file_open(&s, from_path, FILE_READ, FILE_OS_DEFAULT);
if (status)
@@ -297,6 +305,9 @@ static status_t file_transfer_contents(
status_t file_rename(const char *from_path, const char *to_path)
{
d_assert(from_path, return CORE_ERROR,);
d_assert(to_path, return CORE_ERROR,);
if (rename(from_path, to_path) != 0)
{
return errno;
@@ -306,6 +317,9 @@ status_t file_rename(const char *from_path, const char *to_path)
status_t file_link(const char *from_path, const char *to_path)
{
d_assert(from_path, return CORE_ERROR,);
d_assert(to_path, return CORE_ERROR,);
if (link(from_path, to_path) == -1)
{
return errno;
@@ -330,6 +344,8 @@ status_t file_append(
status_t file_eof(file_t *fptr)
{
d_assert(fptr, return CORE_ERROR,);
if (fptr->eof_hit == 1)
{
return CORE_EOF;
@@ -342,6 +358,9 @@ status_t file_read(file_t *thefile, void *buf, size_t *nbytes)
ssize_t rv;
size_t bytes_read;
d_assert(thefile, return CORE_ERROR,);
d_assert(nbytes, return CORE_ERROR,);
if (*nbytes <= 0)
{
*nbytes = 0;
@@ -373,6 +392,10 @@ status_t file_write(
{
size_t rv;
d_assert(thefile, return CORE_ERROR,);
d_assert(buf, return CORE_ERROR,);
d_assert(nbytes, return CORE_ERROR,);
do
{
rv = write(thefile->filedes, buf, *nbytes);
@@ -393,6 +416,11 @@ status_t file_writev(file_t *thefile,
status_t rv;
ssize_t bytes;
d_assert(thefile, return CORE_ERROR,);
d_assert(vec, return CORE_ERROR,);
d_assert(nvec, return CORE_ERROR,);
d_assert(nbytes, return CORE_ERROR,);
if ((bytes = writev(thefile->filedes, vec, nvec)) < 0)
{
*nbytes = 0;
@@ -430,6 +458,9 @@ status_t file_read_full(file_t *thefile, void *buf,
status_t status;
size_t total_read = 0;
d_assert(thefile, return CORE_ERROR,);
d_assert(buf, return CORE_ERROR,);
do {
size_t amt = nbytes;
@@ -450,6 +481,9 @@ status_t file_write_full(file_t *thefile,
status_t status;
size_t total_written = 0;
d_assert(thefile, return CORE_ERROR,);
d_assert(buf, return CORE_ERROR,);
do {
size_t amt = nbytes;
@@ -473,6 +507,11 @@ status_t file_writev_full(file_t *thefile,
size_t amt = 0;
size_t total = 0;
d_assert(thefile, return CORE_ERROR,);
d_assert(vec, return CORE_ERROR,);
d_assert(nvec, return CORE_ERROR,);
d_assert(bytes_written, return CORE_ERROR,);
for (i = 0; i < nvec; i++)
{
total += vec[i].iov_len;
@@ -522,12 +561,16 @@ status_t file_putc(char ch, file_t *thefile)
{
size_t nbytes = 1;
d_assert(thefile, return CORE_ERROR,);
return file_write(thefile, &ch, &nbytes);
}
status_t file_getc(char *ch, file_t *thefile)
{
size_t nbytes = 1;
d_assert(thefile, return CORE_ERROR,);
return file_read(thefile, ch, &nbytes);
}
@@ -538,6 +581,9 @@ status_t file_gets(char *str, int len, file_t *thefile)
const char *str_start = str;
char *final = str + len - 1;
d_assert(str, return CORE_ERROR,);
d_assert(thefile, return CORE_ERROR,);
if (len <= 1)
{
/* sort of like fgets(), which returns NULL and stores no bytes
@@ -577,6 +623,9 @@ status_t file_gets(char *str, int len, file_t *thefile)
status_t file_puts(const char *str, file_t *thefile)
{
d_assert(str, return CORE_ERROR,);
d_assert(thefile, return CORE_ERROR,);
return file_write_full(thefile, str, strlen(str), NULL);
}
@@ -584,6 +633,8 @@ status_t file_sync(file_t *thefile)
{
status_t rv = CORE_OK;
d_assert(thefile, return CORE_ERROR,);
if (fsync(thefile->filedes))
{
rv = get_os_error();
@@ -597,6 +648,9 @@ status_t file_seek(file_t *thefile,
{
off_t rv;
d_assert(thefile, return CORE_ERROR,);
d_assert(offset, return CORE_ERROR,);
thefile->eof_hit = 0;
rv = lseek(thefile->filedes, *offset, where);
@@ -614,6 +668,9 @@ status_t file_seek(file_t *thefile,
status_t file_name_get(const char **fname, file_t *thefile)
{
d_assert(fname, return CORE_ERROR,);
d_assert(thefile, return CORE_ERROR,);
*fname = thefile->fname;
return CORE_OK;
}
@@ -622,6 +679,8 @@ status_t file_perms_set(const char *fname, file_perms_t perms)
{
mode_t mode = unix_perms2mode(perms);
d_assert(fname, return CORE_ERROR,);
if (chmod(fname, mode) == -1)
return errno;
return CORE_OK;
@@ -633,6 +692,8 @@ status_t file_attrs_set(const char *fname,
status_t status;
file_info_t finfo;
d_assert(fname, return CORE_ERROR,);
/* Don't do anything if we can't handle the requested attributes */
if (!(attr_mask & (ATTR_READONLY | ATTR_EXECUTABLE)))
return CORE_OK;
@@ -684,6 +745,8 @@ status_t file_mtime_set(const char *fname, c_time_t mtime)
status_t status;
file_info_t finfo;
d_assert(fname, return CORE_ERROR,);
status = file_stat(&finfo, fname, FILE_INFO_ATIME);
if (status)
{
@@ -727,6 +790,8 @@ status_t dir_make(const char *path, file_perms_t perm)
{
mode_t mode = unix_perms2mode(perm);
d_assert(path, return CORE_ERROR,);
if (mkdir(path, mode) == 0)
{
return CORE_OK;
@@ -742,6 +807,8 @@ status_t dir_make(const char *path, file_perms_t perm)
/* Remove trailing separators that don't affect the meaning of PATH. */
static void path_canonicalize (char *dir)
{
d_assert(dir, return,);
/* At some point this could eliminate redundant components. For
* now, it just makes sure there is no trailing slash. */
size_t len = strlen (dir);
@@ -755,11 +822,14 @@ static void path_canonicalize (char *dir)
}
/* Remove one component off the end of PATH. */
static void path_remove_last_component (char *dir, const char *path)
void path_remove_last_component (char *dir, const char *path)
{
int i;
int len = 0;
d_assert(dir, return,);
d_assert(path, return,);
strcpy(dir, path);
path_canonicalize (dir);
for (i = (strlen(dir) - 1); i >= 0; i--) {
@@ -775,6 +845,8 @@ status_t dir_make_recursive(const char *path, file_perms_t perm)
{
status_t err = 0;
d_assert(path, return CORE_ERROR,);
err = dir_make(path, perm); /* Try to make PATH right out */
if (err == EEXIST) /* It's OK if PATH exists */
@@ -801,6 +873,8 @@ status_t dir_make_recursive(const char *path, file_perms_t perm)
}
status_t dir_remove(const char *path)
{
d_assert(path, return CORE_ERROR,);
if (rmdir(path) == 0)
{
return CORE_OK;
@@ -860,6 +934,9 @@ static filetype_e filetype_from_mode(mode_t mode)
static void fill_out_finfo(file_info_t *finfo, struct_stat *info,
c_int32_t wanted)
{
d_assert(finfo, return,);
d_assert(info, return,);
finfo->valid = FILE_INFO_MIN | FILE_INFO_IDENT | FILE_INFO_NLINK
| FILE_INFO_OWNER | FILE_INFO_PROT;
finfo->protection = unix_mode2perms(info->st_mode);
@@ -924,6 +1001,9 @@ status_t file_info_get(file_info_t *finfo,
{
struct_stat info;
d_assert(finfo, return CORE_ERROR,);
d_assert(thefile, return CORE_ERROR,);
if (fstat(thefile->filedes, &info) == 0)
{
strcpy(finfo->fname, thefile->fname);
@@ -937,6 +1017,8 @@ status_t file_info_get(file_info_t *finfo,
status_t file_trunc(file_t *fp, off_t offset)
{
d_assert(fp, return CORE_ERROR,);
if (ftruncate(fp->filedes, offset) == -1)
{
return errno;
@@ -946,6 +1028,8 @@ status_t file_trunc(file_t *fp, off_t offset)
c_int32_t file_flags_get(file_t *f)
{
d_assert(f, return CORE_ERROR,);
return f->flags;
}
@@ -955,6 +1039,9 @@ status_t file_stat(file_info_t *finfo,
struct_stat info;
int srv;
d_assert(finfo, return CORE_ERROR,);
d_assert(fname, return CORE_ERROR,);
if (wanted & FILE_INFO_LINK)
srv = lstat(fname, &info);
else
@@ -1006,6 +1093,8 @@ status_t file_stat(file_info_t *finfo,
status_t temp_dir_get(char *temp_dir)
{
d_assert(temp_dir, return CORE_ERROR,);
strcpy(temp_dir, "/tmp");
return CORE_OK;
}

View File

@@ -22,8 +22,7 @@ status_t mutex_final(void)
d_error("%d not freed in mutex_pool[%d]",
pool_size(&mutex_pool) - pool_avail(&mutex_pool),
pool_size(&mutex_pool));
d_trace(1, "%d not freed in mutex_pool[%d]\n",
d_trace(9, "%d not freed in mutex_pool[%d]\n",
pool_size(&mutex_pool) - pool_avail(&mutex_pool),
pool_size(&mutex_pool));
pool_final(&mutex_pool);

File diff suppressed because it is too large Load Diff

View File

@@ -24,11 +24,11 @@ pool_declare(pkbuf_pool, pkbuf_t, MAX_NUM_OF_PKBUF);
#define SIZEOF_CLUSTER_8192 CORE_ALIGN(8192+MAX_SIZEOF_HEADROOM, BOUNDARY)
#define MAX_NUM_OF_CLUSTER_128 256
#define MAX_NUM_OF_CLUSTER_256 32
#define MAX_NUM_OF_CLUSTER_512 32
#define MAX_NUM_OF_CLUSTER_1024 32
#define MAX_NUM_OF_CLUSTER_2048 32
#define MAX_NUM_OF_CLUSTER_8192 32
#define MAX_NUM_OF_CLUSTER_256 256
#define MAX_NUM_OF_CLUSTER_512 256
#define MAX_NUM_OF_CLUSTER_1024 256
#define MAX_NUM_OF_CLUSTER_2048 256
#define MAX_NUM_OF_CLUSTER_8192 256
typedef c_uint8_t cluster_128_t[SIZEOF_CLUSTER_128];
typedef c_uint8_t cluster_256_t[SIZEOF_CLUSTER_256];
@@ -83,69 +83,53 @@ status_t pkbuf_final(void)
void pkbuf_show(void)
{
if (pool_size(&pkbuf_pool) != pool_avail(&pkbuf_pool))
if (pool_used(&pkbuf_pool))
d_error("%d not freed in pkbuf_pool[%d]",
pool_size(&pkbuf_pool) - pool_avail(&pkbuf_pool),
pool_size(&pkbuf_pool));
d_trace(3, "%d not freed in pkbuf_pool[%d]\n",
pool_size(&pkbuf_pool) - pool_avail(&pkbuf_pool),
pool_size(&pkbuf_pool));
pool_used(&pkbuf_pool), pool_size(&pkbuf_pool));
d_trace(9, "%d not freed in pkbuf_pool[%d]\n",
pool_used(&pkbuf_pool), pool_size(&pkbuf_pool));
if (pool_size(&clbuf_pool) != pool_avail(&clbuf_pool))
if (pool_used(&clbuf_pool))
d_error("%d not freed in clbuf_pool[%d]",
pool_size(&clbuf_pool) - pool_avail(&clbuf_pool),
pool_size(&clbuf_pool));
d_trace(3, "%d not freed in clbuf_pool[%d]\n",
pool_size(&clbuf_pool) - pool_avail(&clbuf_pool),
pool_size(&clbuf_pool));
pool_used(&clbuf_pool), pool_size(&clbuf_pool));
d_trace(9, "%d not freed in clbuf_pool[%d]\n",
pool_used(&clbuf_pool), pool_size(&clbuf_pool));
if (pool_size(&cluster_128_pool) != pool_avail(&cluster_128_pool))
if (pool_used(&cluster_128_pool))
d_error("%d not freed in cluster128_pool[%d]",
pool_size(&cluster_128_pool) - pool_avail(&cluster_128_pool),
pool_size(&cluster_128_pool));
d_trace(3, "%d not freed in cluster128_pool[%d]\n",
pool_size(&cluster_128_pool) - pool_avail(&cluster_128_pool),
pool_size(&cluster_128_pool));
pool_used(&cluster_128_pool), pool_size(&cluster_128_pool));
d_trace(9, "%d not freed in cluster128_pool[%d]\n",
pool_used(&cluster_128_pool), pool_size(&cluster_128_pool));
if (pool_size(&cluster_256_pool) != pool_avail(&cluster_256_pool))
if (pool_used(&cluster_256_pool))
d_error("%d not freed in cluster256_pool[%d]",
pool_size(&cluster_256_pool) - pool_avail(&cluster_256_pool),
pool_size(&cluster_256_pool));
d_trace(3, "%d not freed in cluster256_pool[%d]\n",
pool_size(&cluster_256_pool) - pool_avail(&cluster_256_pool),
pool_size(&cluster_256_pool));
pool_used(&cluster_256_pool), pool_size(&cluster_256_pool));
d_trace(9, "%d not freed in cluster256_pool[%d]\n",
pool_used(&cluster_256_pool), pool_size(&cluster_256_pool));
if (pool_size(&cluster_512_pool) != pool_avail(&cluster_512_pool))
if (pool_used(&cluster_512_pool))
d_error("%d not freed in cluster512_pool[%d]",
pool_size(&cluster_512_pool) - pool_avail(&cluster_512_pool),
pool_size(&cluster_512_pool));
d_trace(3, "%d not freed in cluster512_pool[%d]\n",
pool_size(&cluster_512_pool) - pool_avail(&cluster_512_pool),
pool_size(&cluster_512_pool));
if (pool_size(&cluster_1024_pool) != pool_avail(&cluster_1024_pool))
pool_used(&cluster_512_pool), pool_size(&cluster_512_pool));
d_trace(9, "%d not freed in cluster512_pool[%d]\n",
pool_used(&cluster_512_pool), pool_size(&cluster_512_pool));
if (pool_used(&cluster_1024_pool))
d_error("%d not freed in cluster1024_pool[%d]",
pool_size(&cluster_1024_pool) - pool_avail(&cluster_1024_pool),
pool_size(&cluster_1024_pool));
d_trace(3, "%d not freed in cluster1024_pool[%d]\n",
pool_size(&cluster_1024_pool) - pool_avail(&cluster_1024_pool),
pool_size(&cluster_1024_pool));
pool_used(&cluster_1024_pool), pool_size(&cluster_1024_pool));
d_trace(9, "%d not freed in cluster1024_pool[%d]\n",
pool_used(&cluster_1024_pool), pool_size(&cluster_1024_pool));
if (pool_size(&cluster_2048_pool) != pool_avail(&cluster_2048_pool))
if (pool_used(&cluster_2048_pool))
d_error("%d not freed in cluster2048_pool[%d]",
pool_size(&cluster_2048_pool) - pool_avail(&cluster_2048_pool),
pool_size(&cluster_2048_pool));
d_trace(3, "%d not freed in cluster2048_pool[%d]\n",
pool_size(&cluster_2048_pool) - pool_avail(&cluster_2048_pool),
pool_size(&cluster_2048_pool));
pool_used(&cluster_2048_pool), pool_size(&cluster_2048_pool));
d_trace(9, "%d not freed in cluster2048_pool[%d]\n",
pool_used(&cluster_2048_pool), pool_size(&cluster_2048_pool));
if (pool_size(&cluster_8192_pool) != pool_avail(&cluster_8192_pool))
if (pool_used(&cluster_8192_pool))
d_error("%d not freed in cluster8192_pool[%d]",
pool_size(&cluster_8192_pool) - pool_avail(&cluster_8192_pool),
pool_size(&cluster_8192_pool));
d_trace(3, "%d not freed in cluster8192_pool[%d]\n",
pool_size(&cluster_8192_pool) - pool_avail(&cluster_8192_pool),
pool_size(&cluster_8192_pool));
pool_used(&cluster_8192_pool), pool_size(&cluster_8192_pool));
d_trace(9, "%d not freed in cluster8192_pool[%d]\n",
pool_used(&cluster_8192_pool), pool_size(&cluster_8192_pool));
}
static clbuf_t* clbuf_alloc(c_uint16_t length);
@@ -564,18 +548,20 @@ void *core_malloc(size_t size)
return p->payload;
}
void core_free(void *ptr)
status_t core_free(void *ptr)
{
c_uint16_t headroom = sizeof(pkbuf_t *);
pkbuf_t *p = NULL;
if (!ptr)
return;
return CORE_OK;
memcpy(&p, ptr - headroom, headroom);
d_assert(p, return, "Null param");
d_assert(p, return CORE_ERROR, "Null param");
pkbuf_free(p);
return CORE_OK;
}
void *core_calloc(size_t nmemb, size_t size)
@@ -629,3 +615,44 @@ void *core_realloc(void *ptr, size_t size)
}
}
char *core_strdup(const char *s)
{
char *res;
size_t len;
if (s == NULL)
return NULL;
len = strlen(s) + 1;
res = core_memdup(s, len);
return res;
}
char *core_strndup(const char *s, size_t n)
{
char *res;
const char *end;
if (s == NULL)
return NULL;
end = memchr(s, '\0', n);
if (end != NULL)
n = end - s;
res = core_malloc(n + 1);
memcpy(res, s, n);
res[n] = '\0';
return res;
}
void *core_memdup(const void *m, size_t n)
{
void *res;
if (m == NULL)
return NULL;
res = core_malloc(n);
memcpy(res, m, n);
return res;
}

430
lib/core/src/unix/sctp.c Normal file
View File

@@ -0,0 +1,430 @@
#define TRACE_MODULE _sctp
#include "core_debug.h"
#include "core_arch_network.h"
#if HAVE_NETINET_SCTP_H
#include <netinet/sctp.h>
#endif
static status_t subscribe_to_events(sock_id id);
static status_t set_paddrparams(sock_id id, c_uint32_t spp_hbinterval);
static status_t set_rtoinfo(sock_id id,
c_uint32_t srto_initial, c_uint32_t srto_min, c_uint32_t srto_max);
static status_t set_initmsg(sock_id id,
c_uint32_t sinit_num_ostreams, c_uint32_t sinit_max_instreams,
c_uint32_t sinit_max_attempts, c_uint32_t sinit_max_init_timeo);
static int sctp_num_ostreams = -1;
void sctp_set_num_ostreams(int sctp_streams)
{
sctp_num_ostreams = sctp_streams;
}
status_t sctp_socket(sock_id *new, int family, int type)
{
status_t rv;
rv = sock_socket(new, family, type, IPPROTO_SCTP);
d_assert(rv == CORE_OK, return CORE_ERROR,);
rv = subscribe_to_events(*new);
d_assert(rv == CORE_OK, return CORE_ERROR,);
/* heartbit interval : 5 secs */
rv = set_paddrparams(*new, 5000);
d_assert(rv == CORE_OK, return CORE_ERROR,);
/*
* RTO info
*
* initial : 3 secs
* min : 1 sec
* max : 5 secs
*/
rv = set_rtoinfo(*new, 3000, 1000, 5000);
d_assert(rv == CORE_OK, return CORE_ERROR,);
/*
* INITMSG
*
* max number of input streams : 65535
* max attemtps : 4
* max initial timeout : 8 secs
*/
rv = set_initmsg(*new, sctp_num_ostreams, 65535, 4, 8000);
d_assert(rv == CORE_OK, return CORE_ERROR,);
return CORE_OK;
}
status_t sctp_server(sock_id *new, int type, c_sockaddr_t *sa_list)
{
status_t rv;
c_sockaddr_t *addr;
char buf[CORE_ADDRSTRLEN];
addr = sa_list;
while(addr)
{
rv = sctp_socket(new, addr->c_sa_family, type);
if (rv == CORE_OK)
{
d_assert(sock_setsockopt(*new, SOCK_O_REUSEADDR, 1) == CORE_OK,
return CORE_ERROR,
"setsockopt [%s]:%d failed(%d:%s)",
CORE_ADDR(addr, buf), CORE_PORT(addr),
errno, strerror(errno));
if (sock_bind(*new, addr) == CORE_OK)
{
d_trace(1, "sctp_server() [%s]:%d\n",
CORE_ADDR(addr, buf), CORE_PORT(addr));
break;
}
rv = sock_delete(*new);
d_assert(rv == CORE_OK, return CORE_ERROR,);
}
addr = addr->next;
}
if (addr == NULL)
{
d_error("sctp_server() [%s]:%d failed(%d:%s)",
CORE_ADDR(sa_list, buf), CORE_PORT(sa_list),
errno, strerror(errno));
return CORE_ERROR;
}
rv = sock_listen(*new);
d_assert(rv == CORE_OK, return CORE_ERROR,);
return CORE_OK;
}
status_t sctp_client(sock_id *new, int type, c_sockaddr_t *sa_list)
{
status_t rv;
c_sockaddr_t *addr;
char buf[CORE_ADDRSTRLEN];
addr = sa_list;
while(addr)
{
rv = sctp_socket(new, addr->c_sa_family, type);
if (rv == CORE_OK)
{
if (sock_connect(*new, addr) == CORE_OK)
{
d_trace(1, "sctp_client() [%s]:%d\n",
CORE_ADDR(addr, buf), CORE_PORT(addr));
break;
}
rv = sock_delete(*new);
d_assert(rv == CORE_OK, return CORE_ERROR,);
}
addr = addr->next;
}
if (addr == NULL)
{
d_error("sctp_client() [%s]:%d failed(%d:%s)",
CORE_ADDR(sa_list, buf), CORE_PORT(sa_list),
errno, strerror(errno));
return CORE_ERROR;
}
return CORE_OK;
}
status_t sctp_connect(sock_id id, c_sockaddr_t *sa_list)
{
c_sockaddr_t *addr;
char buf[CORE_ADDRSTRLEN];
d_assert(id, return CORE_ERROR,);
addr = sa_list;
while(addr)
{
if (sock_connect(id, addr) == CORE_OK)
{
d_trace(1, "sctp_connect() [%s]:%d\n",
CORE_ADDR(addr, buf), CORE_PORT(addr));
break;
}
addr = addr->next;
}
if (addr == NULL)
{
d_error("sctp_connect() [%s]:%d failed(%d:%s)",
CORE_ADDR(sa_list, buf), CORE_PORT(sa_list),
errno, strerror(errno));
return CORE_ERROR;
}
return CORE_OK;
}
int core_sctp_sendmsg(sock_id id, const void *msg, size_t len,
c_sockaddr_t *to, c_uint32_t ppid, c_uint16_t stream_no)
{
sock_t *sock = (sock_t *)id;
int size;
socklen_t addrlen = 0;
d_assert(id, return -1, );
if (to)
addrlen = sockaddr_len(to);
size = sctp_sendmsg(sock->fd, msg, len,
to ? &to->sa : NULL, addrlen,
htonl(ppid),
0, /* flags */
stream_no,
0, /* timetolive */
0); /* context */
if (size < 0)
{
d_error("sctp_sendmsg(len:%ld) failed(%d:%s)",
len, errno, strerror(errno));
}
return size;
}
int core_sctp_recvmsg(sock_id id, void *msg, size_t len,
c_sockaddr_t *from, sctp_info_t *sinfo, int *msg_flags)
{
sock_t *sock = (sock_t *)id;
int size;
socklen_t addrlen = sizeof(struct sockaddr_storage);
int flags = 0;
struct sctp_sndrcvinfo sndrcvinfo;
d_assert(id, return -1,);
size = sctp_recvmsg(sock->fd, msg, len,
from ? &from->sa : NULL, from ? &addrlen : NULL,
&sndrcvinfo, &flags);
if (size < 0)
{
d_error("sctp_recvmsg(%d) failed(%d:%s)",
size, errno, strerror(errno));
return size;
}
if (msg_flags)
{
*msg_flags = flags;
}
if (sinfo)
{
sinfo->ppid = ntohl(sndrcvinfo.sinfo_ppid);
sinfo->stream_no = sndrcvinfo.sinfo_stream;
}
return size;
}
int core_sctp_recvdata(sock_id id, void *msg, size_t len,
c_sockaddr_t *from, sctp_info_t *sinfo)
{
int size;
int flags = 0;
do
{
size = core_sctp_recvmsg(id, msg, len, from, sinfo, &flags);
if (size < 0)
{
d_error("core_sctp_recvdata(%d) failed(%d:%s)",
size, errno, strerror(errno));
return size;
}
if (flags & MSG_NOTIFICATION)
{
/* Nothing */
}
else if (flags & MSG_EOR)
{
break;
}
else
{
d_assert(0, return -1,);
}
} while(1);
return size;
}
static status_t subscribe_to_events(sock_id id)
{
sock_t *sock = (sock_t *)id;
struct sctp_event_subscribe event;
d_assert(id, return CORE_ERROR,);
memset(&event, 0, sizeof(event));
event.sctp_data_io_event = 1;
event.sctp_association_event = 1;
event.sctp_send_failure_event = 1;
event.sctp_shutdown_event = 1;
if (setsockopt(sock->fd, IPPROTO_SCTP, SCTP_EVENTS,
&event, sizeof( event)) != 0 )
{
d_error("Unable to subscribe to SCTP events: (%d:%s)",
errno, strerror( errno ));
return CORE_ERROR;
}
return CORE_OK;
}
static status_t set_paddrparams(sock_id id, c_uint32_t spp_hbinterval)
{
sock_t *sock = (sock_t *)id;
struct sctp_paddrparams heartbeat;
socklen_t socklen;
d_assert(id, return CORE_ERROR,);
memset(&heartbeat, 0, sizeof(heartbeat));
socklen = sizeof(heartbeat);
if (getsockopt(sock->fd, IPPROTO_SCTP, SCTP_PEER_ADDR_PARAMS,
&heartbeat, &socklen) != 0 )
{
d_error("getsockopt for SCTP_PEER_ADDR failed(%d:%s)",
errno, strerror(errno));
return CORE_ERROR;
}
d_trace(3,"Old spp _flags = 0x%x hbinter = %d pathmax = %d\n",
heartbeat.spp_flags,
heartbeat.spp_hbinterval,
heartbeat.spp_pathmaxrxt);
heartbeat.spp_hbinterval = spp_hbinterval;
if (setsockopt(sock->fd, IPPROTO_SCTP, SCTP_PEER_ADDR_PARAMS,
&heartbeat, sizeof( heartbeat)) != 0 )
{
d_error("setsockopt for SCTP_PEER_ADDR_PARAMS failed(%d:%s)",
errno, strerror(errno));
return CORE_ERROR;
}
d_trace(3,"New spp _flags = 0x%x hbinter = %d pathmax = %d\n",
heartbeat.spp_flags,
heartbeat.spp_hbinterval,
heartbeat.spp_pathmaxrxt);
return CORE_OK;
}
static status_t set_rtoinfo(sock_id id,
c_uint32_t srto_initial, c_uint32_t srto_min, c_uint32_t srto_max)
{
sock_t *sock = (sock_t *)id;
struct sctp_rtoinfo rtoinfo;
socklen_t socklen;
d_assert(id, return CORE_ERROR,);
memset(&rtoinfo, 0, sizeof(rtoinfo));
socklen = sizeof(rtoinfo);
if (getsockopt(sock->fd, IPPROTO_SCTP, SCTP_RTOINFO,
&rtoinfo, &socklen) != 0 )
{
d_error("getsockopt for SCTP_RTOINFO failed(%d:%s)",
errno, strerror( errno ));
return CORE_ERROR;
}
d_trace(3,"Old RTO (initial:%d max:%d min:%d)\n",
rtoinfo.srto_initial,
rtoinfo.srto_max,
rtoinfo.srto_min);
rtoinfo.srto_initial = srto_initial;
rtoinfo.srto_min = srto_min;
rtoinfo.srto_max = srto_max;
if (setsockopt(sock->fd, IPPROTO_SCTP, SCTP_RTOINFO,
&rtoinfo, sizeof(rtoinfo)) != 0 )
{
d_error("setsockopt for SCTP_RTOINFO failed(%d:%s)",
errno, strerror( errno ));
return CORE_ERROR;
}
d_trace(3,"New RTO (initial:%d max:%d min:%d)\n",
rtoinfo.srto_initial,
rtoinfo.srto_max,
rtoinfo.srto_min);
return CORE_OK;
}
static status_t set_initmsg(sock_id id,
c_uint32_t sinit_num_ostreams, c_uint32_t sinit_max_instreams,
c_uint32_t sinit_max_attempts, c_uint32_t sinit_max_init_timeo)
{
sock_t *sock = (sock_t *)id;
struct sctp_initmsg initmsg;
socklen_t socklen;
d_assert(id, return CORE_ERROR,);
d_assert(sinit_num_ostreams > 1, return CORE_ERROR,
"Invalid SCTP number of output streams = %d\n", sctp_num_ostreams);
memset(&initmsg, 0, sizeof(initmsg));
socklen = sizeof(initmsg);
if (getsockopt(sock->fd, IPPROTO_SCTP, SCTP_INITMSG,
&initmsg, &socklen) != 0 )
{
d_error("getsockopt for SCTP_INITMSG failed(%d:%s)",
errno, strerror( errno ));
return CORE_ERROR;
}
d_trace(3,"Old INITMSG (numout:%d maxin:%d maxattempt:%d maxinit_to:%d)\n",
initmsg.sinit_num_ostreams,
initmsg.sinit_max_instreams,
initmsg.sinit_max_attempts,
initmsg.sinit_max_init_timeo);
initmsg.sinit_num_ostreams = sinit_num_ostreams;
initmsg.sinit_max_instreams = sinit_max_instreams;
initmsg.sinit_max_attempts = sinit_max_attempts;
initmsg.sinit_max_init_timeo = sinit_max_init_timeo;
if (setsockopt(sock->fd, IPPROTO_SCTP, SCTP_INITMSG,
&initmsg, sizeof(initmsg)) != 0 )
{
d_error("setsockopt for SCTP_INITMSG failed(%d:%s)",
errno, strerror( errno ));
return CORE_ERROR;
}
d_trace(3,"New INITMSG (numout:%d maxin:%d maxattempt:%d maxinit_to:%d)\n",
initmsg.sinit_num_ostreams,
initmsg.sinit_max_instreams,
initmsg.sinit_max_attempts,
initmsg.sinit_max_init_timeo);
return CORE_OK;
}

View File

@@ -0,0 +1,545 @@
#define TRACE_MODULE _sockaddr
#include "core_debug.h"
#include "core_lib.h"
#include "core_pkbuf.h"
#include "core_arch_network.h"
status_t core_getaddrinfo(c_sockaddr_t **sa_list,
int family, const char *hostname, c_uint16_t port, int flags)
{
*sa_list = NULL;
return core_addaddrinfo(sa_list, family, hostname, port, flags);
}
status_t core_freeaddrinfo(c_sockaddr_t *sa_list)
{
c_sockaddr_t *next = NULL, *addr = NULL;
addr = sa_list;
while(addr)
{
next = addr->next;
CORE_FREE(addr);
addr = next;
}
return CORE_OK;
}
status_t core_addaddrinfo(c_sockaddr_t **sa_list,
int family, const char *hostname, c_uint16_t port, int flags)
{
int rc;
char service[NI_MAXSERV];
struct addrinfo hints, *ai, *ai_list;
c_sockaddr_t *prev;
char buf[CORE_ADDRSTRLEN];
d_assert(sa_list, return CORE_ERROR,);
memset(&hints, 0, sizeof(hints));
hints.ai_family = family;
hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = flags;
snprintf(service, sizeof(service), "%u", port);
rc = getaddrinfo(hostname, service, &hints, &ai_list);
if (rc != 0)
{
d_error("getaddrinfo(%d:%s:%d:0x%x) failed(%d:%s)",
family, hostname, port, flags, errno, strerror(errno));
return CORE_ERROR;
}
prev = NULL;
if (*sa_list)
{
prev = *sa_list;
while(prev->next) prev = prev->next;
}
for (ai = ai_list; ai; ai = ai->ai_next)
{
c_sockaddr_t *new;
if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
continue;
new = core_calloc(1, sizeof(c_sockaddr_t));
memcpy(&new->sa, ai->ai_addr, ai->ai_addrlen);
new->c_sa_port = htons(port);
d_trace(3, "addr:%s, port:%d\n", CORE_ADDR(new, buf), port);
if (!prev)
*sa_list = new;
else
prev->next = new;
prev = new;
}
freeaddrinfo(ai_list);
if (prev == NULL)
{
d_error("core_getaddrinfo(%d:%s:%d:%d) failed(%d:%s)",
family, hostname, port, flags, errno, strerror(errno));
return CORE_ERROR;
}
return CORE_OK;
}
status_t core_filteraddrinfo(c_sockaddr_t **sa_list, int family)
{
c_sockaddr_t *addr = NULL, *prev = NULL, *next = NULL;
d_assert(sa_list, return CORE_ERROR,);
prev = NULL;
addr = *sa_list;
while(addr)
{
next = addr->next;
if (addr->c_sa_family != family)
{
if (prev)
prev->next = addr->next;
else
*sa_list = addr->next;
CORE_FREE(addr);
}
else
{
prev = addr;
}
addr = next;
}
return CORE_OK;
}
status_t core_copyaddrinfo(c_sockaddr_t **dst, const c_sockaddr_t *src)
{
c_sockaddr_t *d;
const c_sockaddr_t *s;
for (*dst = d = NULL, s = src; s; s = s->next)
{
if (!d)
{
d = core_calloc(1, sizeof *s);
*dst = memcpy(d, s, sizeof *s);
}
else
{
d->next = core_calloc(1, sizeof(c_sockaddr_t));
d = memcpy(d->next, s, sizeof *s);
}
}
return CORE_OK;
}
status_t core_sortaddrinfo(c_sockaddr_t **sa_list, int family)
{
c_sockaddr_t *head = NULL, *addr = NULL, *new = NULL, *old = NULL;
d_assert(sa_list, return CORE_ERROR,);
old = *sa_list;
while(old)
{
addr = old;
old = old->next;
if (head == NULL || addr->c_sa_family == family)
{
addr->next = head;
head = addr;
}
else
{
new = head;
while(new->next != NULL && new->next->c_sa_family != family)
{
new = new->next;
}
addr->next = new->next;
new->next = addr;
}
}
*sa_list = head;
return CORE_OK;
}
c_sockaddr_t *core_link_local_addr_by_dev(const char *dev)
{
struct ifaddrs *iflist, *cur;
int rc;
d_assert(dev, return NULL,);
rc = getifaddrs(&iflist);
if (rc != 0)
{
d_error("getifaddrs failed(%d:%s)", errno, strerror(errno));
return NULL;
}
for (cur = iflist; cur != NULL; cur = cur->ifa_next)
{
c_sockaddr_t *addr = NULL;
if (cur->ifa_addr == NULL) /* may happen with ppp interfaces */
continue;
if (strcmp(dev, cur->ifa_name) != 0)
continue;
if (cur->ifa_addr->sa_family == AF_INET)
continue;
addr = (c_sockaddr_t *)cur->ifa_addr;
if (!IN6_IS_ADDR_LINKLOCAL(&addr->sin6.sin6_addr))
continue;
addr = core_calloc(1, sizeof(c_sockaddr_t));
d_assert(addr, return NULL,);
memcpy(&addr->sa, cur->ifa_addr, sockaddr_len(cur->ifa_addr));
freeifaddrs(iflist);
return addr;
}
freeifaddrs(iflist);
return NULL;
}
const char *core_inet_ntop(void *sa, char *buf, int buflen)
{
int family;
c_sockaddr_t *sockaddr = NULL;
d_assert(buf, return NULL,);
sockaddr = sa;
d_assert(sockaddr, return NULL,);
family = sockaddr->c_sa_family;
switch(family)
{
case AF_INET:
d_assert(buflen >= INET_ADDRSTRLEN, return NULL,);
return inet_ntop(family,
&sockaddr->sin.sin_addr, buf, INET_ADDRSTRLEN);
case AF_INET6:
d_assert(buflen >= CORE_ADDRSTRLEN, return NULL,);
return inet_ntop(family,
&sockaddr->sin6.sin6_addr, buf, INET6_ADDRSTRLEN);
default:
d_assert(0, return NULL, "Unknown family(%d)", family);
}
}
status_t core_inet_pton(int family, const char *src, void *sa)
{
c_sockaddr_t *dst = NULL;
d_assert(src, return CORE_ERROR,);
dst = sa;
d_assert(dst, return CORE_ERROR,);
dst->c_sa_family = family;
switch(family)
{
case AF_INET:
return inet_pton(family, src, &dst->sin.sin_addr) == 1 ?
CORE_OK : CORE_ERROR;
case AF_INET6:
return inet_pton(family, src, &dst->sin6.sin6_addr) == 1 ?
CORE_OK : CORE_ERROR;
default:
d_assert(0, return CORE_ERROR, "Unknown family(%d)", family);
}
}
socklen_t sockaddr_len(const void *sa)
{
const c_sockaddr_t *sockaddr = sa;
d_assert(sa, return 0,);
switch(sockaddr->c_sa_family)
{
case AF_INET:
return sizeof(struct sockaddr_in);
case AF_INET6:
return sizeof(struct sockaddr_in6);
default:
d_assert(0, return 0, "Unknown family(%d)", sockaddr->c_sa_family);
}
}
int sockaddr_is_equal(void *p, void *q)
{
c_sockaddr_t *a, *b;
a = p;
d_assert(a, return 0,);
b = q;
d_assert(b, return 0,);
if (a->c_sa_family != b->c_sa_family)
return 0;
if (a->c_sa_family == AF_INET && memcmp(
&a->sin.sin_addr, &b->sin.sin_addr, sizeof(struct in_addr)) == 0)
return 1;
else if (a->c_sa_family == AF_INET6 && memcmp(
&a->sin6.sin6_addr, &b->sin6.sin6_addr, sizeof(struct in6_addr)) == 0)
return 1;
else
d_assert(0, return 0, "Unknown family(%d)", a->c_sa_family);
return 0;
}
static status_t parse_network(ipsubnet_t *ipsub, const char *network)
{
/* legacy syntax for ip addrs: a.b.c. ==> a.b.c.0/24 for example */
int shift;
char *s, *t;
int octet;
char buf[sizeof "255.255.255.255"];
if (strlen(network) < sizeof buf)
{
strcpy(buf, network);
}
else
{
return CORE_EBADIP;
}
/* parse components */
s = buf;
ipsub->sub[0] = 0;
ipsub->mask[0] = 0;
shift = 24;
while (*s)
{
t = s;
if (!c_isdigit(*t))
{
return CORE_EBADIP;
}
while (c_isdigit(*t))
{
++t;
}
if (*t == '.')
{
*t++ = 0;
}
else if (*t)
{
return CORE_EBADIP;
}
if (shift < 0)
{
return CORE_EBADIP;
}
octet = atoi(s);
if (octet < 0 || octet > 255)
{
return CORE_EBADIP;
}
ipsub->sub[0] |= octet << shift;
ipsub->mask[0] |= 0xFFUL << shift;
s = t;
shift -= 8;
}
ipsub->sub[0] = ntohl(ipsub->sub[0]);
ipsub->mask[0] = ntohl(ipsub->mask[0]);
ipsub->family = AF_INET;
return CORE_OK;
}
/* return values:
* CORE_EINVAL not an IP address; caller should see
* if it is something else
* CORE_BADIP IP address portion is is not valid
* CORE_BADMASK mask portion is not valid
*/
static status_t parse_ip(
ipsubnet_t *ipsub, const char *ipstr, int network_allowed)
{
/* supported flavors of IP:
*
* . IPv6 numeric address string (e.g., "fe80::1")
*
* IMPORTANT: Don't store IPv4-mapped IPv6 address as an IPv6 address.
*
* . IPv4 numeric address string (e.g., "127.0.0.1")
*
* . IPv4 network string (e.g., "9.67")
*
* IMPORTANT: This network form is only allowed if network_allowed is on.
*/
int rc;
rc = inet_pton(AF_INET6, ipstr, ipsub->sub);
if (rc == 1)
{
if (IN6_IS_ADDR_V4MAPPED((struct in6_addr *)ipsub->sub))
{
/* ipsubnet_test() assumes that we don't create IPv4-mapped IPv6
* addresses; this of course forces the user to specify
* IPv4 addresses in a.b.c.d style instead of ::ffff:a.b.c.d style.
*/
d_error("Cannot support IPv4-mapped IPv6: "
"Use IPv4 address in a.b.c.d style "
"instead of ::ffff:a.b.c.d style");
return CORE_EBADIP;
}
ipsub->family = AF_INET6;
}
else
{
rc = inet_pton(AF_INET, ipstr, ipsub->sub);
if (rc == 1)
{
ipsub->family = AF_INET;
}
}
if (rc != 1)
{
if (network_allowed)
{
return parse_network(ipsub, ipstr);
}
else
{
return CORE_EBADIP;
}
}
return CORE_OK;
}
static int looks_like_ip(const char *ipstr)
{
if (strlen(ipstr) == 0)
{
return 0;
}
if (strchr(ipstr, ':'))
{
/* definitely not a hostname;
* assume it is intended to be an IPv6 address */
return 1;
}
/* simple IPv4 address string check */
while ((*ipstr == '.') || c_isdigit(*ipstr))
ipstr++;
return (*ipstr == '\0');
}
static void fix_subnet(ipsubnet_t *ipsub)
{
/* in case caller specified more bits in network address than are
* valid according to the mask, turn off the extra bits
*/
int i;
for (i = 0; i < sizeof ipsub->mask / sizeof(c_int32_t); i++)
{
ipsub->sub[i] &= ipsub->mask[i];
}
}
/* be sure not to store any IPv4 address as a v4-mapped IPv6 address */
CORE_DECLARE(status_t) core_ipsubnet(
ipsubnet_t *ipsub, const char *ipstr, const char *mask_or_numbits)
{
status_t rv;
char *endptr;
long bits, maxbits = 32;
d_assert(ipsub, return CORE_ERROR,);
d_assert(ipstr, return CORE_ERROR,);
/* filter out stuff which doesn't look remotely like an IP address;
* this helps callers like mod_access which have a syntax allowing
* hostname or IP address;
* CORE_EINVAL tells the caller that it was probably not intended
* to be an IP address
*/
if (!looks_like_ip(ipstr))
{
d_error("looks_like_ip() is failed");
return CORE_EINVAL;
}
/* assume ipstr is an individual IP address, not a subnet */
memset(ipsub->mask, 0xFF, sizeof ipsub->mask);
rv = parse_ip(ipsub, ipstr, mask_or_numbits == NULL);
if (rv != CORE_OK)
{
d_error("parse_ip() is failed");
return rv;
}
if (mask_or_numbits)
{
if (ipsub->family == AF_INET6)
{
maxbits = 128;
}
bits = strtol(mask_or_numbits, &endptr, 10);
if (*endptr == '\0' && bits > 0 && bits <= maxbits)
{
/* valid num-bits string; fill in mask appropriately */
int cur_entry = 0;
c_int32_t cur_bit_value;
memset(ipsub->mask, 0, sizeof ipsub->mask);
while (bits > 32)
{
ipsub->mask[cur_entry] = 0xFFFFFFFF; /* all 32 bits */
bits -= 32;
++cur_entry;
}
cur_bit_value = 0x80000000;
while (bits)
{
ipsub->mask[cur_entry] |= cur_bit_value;
--bits;
cur_bit_value /= 2;
}
ipsub->mask[cur_entry] = htonl(ipsub->mask[cur_entry]);
}
else if (inet_pton(AF_INET, mask_or_numbits, ipsub->mask) == 1 &&
ipsub->family == AF_INET)
{
/* valid IPv4 netmask */
}
else
{
d_error("Bad netmask");
return CORE_EBADMASK;
}
}
fix_subnet(ipsub);
return CORE_OK;
}

814
lib/core/src/unix/socket.c Normal file
View File

@@ -0,0 +1,814 @@
#define TRACE_MODULE _sock
#include "core_pool.h"
#include "core_debug.h"
#include "core_pkbuf.h"
#include "core_arch_network.h"
#define MAX_SOCK_POOL_SIZE 512
#define MAX_SOCK_NODE_POOL_SIZE 512
static int max_fd;
static list_t fd_list;
static fd_set read_fds;
static mutex_id mutex;
pool_declare(sock_pool, sock_t, MAX_SOCK_POOL_SIZE);
pool_declare(sock_node_pool, sock_node_t, MAX_SOCK_NODE_POOL_SIZE);
static status_t sononblock(int sd);
static status_t soblock(int sd);
static void set_fds(fd_set *fds);
static void fd_dispatch(fd_set *fds);
/*
* Init/Final
*/
status_t network_init(void)
{
mutex_create(&mutex, MUTEX_DEFAULT);
pool_init(&sock_pool, MAX_SOCK_POOL_SIZE);
pool_init(&sock_node_pool, MAX_SOCK_NODE_POOL_SIZE);
max_fd = 0;
list_init(&fd_list);
memset(&read_fds, 0, sizeof(fd_set));
return CORE_OK;
}
status_t network_final(void)
{
if (pool_size(&sock_pool) != pool_avail(&sock_pool))
d_error("%d not freed in sock_pool[%d]",
pool_size(&sock_pool) - pool_avail(&sock_pool),
pool_size(&sock_pool));
d_trace(3, "%d not freed in sock_pool[%d]\n",
pool_size(&sock_pool) - pool_avail(&sock_pool),
pool_size(&sock_pool));
if (pool_size(&sock_node_pool) != pool_avail(&sock_node_pool))
d_error("%d not freed in sock_node_pool[%d]",
pool_size(&sock_node_pool) - pool_avail(&sock_node_pool),
pool_size(&sock_node_pool));
d_trace(3, "%d not freed in sock_node_pool[%d]\n",
pool_size(&sock_node_pool) - pool_avail(&sock_node_pool),
pool_size(&sock_node_pool));
pool_final(&sock_pool);
pool_final(&sock_node_pool);
mutex_delete(mutex);
return CORE_OK;
}
/*
* Socket
*/
status_t sock_create(sock_id *new)
{
sock_t *sock = NULL;
pool_alloc_node(&sock_pool, &sock);
d_assert(sock, return CORE_ENOMEM,);
memset(sock, 0, sizeof(sock_t));
sock->fd = -1;
*new = (sock_id)sock;
return CORE_OK;
}
status_t sock_delete(sock_id id)
{
sock_t *sock = (sock_t *)id;
d_assert(id, return CORE_ERROR,);
if (sock_is_registered(id))
sock_unregister(id);
if (sock->fd >= 0)
close(sock->fd);
sock->fd = -1;
pool_free_node(&sock_pool, sock);
return CORE_OK;
}
status_t sock_delete_list(list_t *list)
{
status_t rv;
sock_node_t *snode;
d_assert(list, return CORE_ERROR,);
for (snode = list_first(list); snode; snode = list_next(snode))
{
rv = sock_delete(snode->sock);
d_assert(rv == CORE_OK, return CORE_ERROR,);
}
return CORE_OK;
}
status_t sock_socket(sock_id *new, int family, int type, int protocol)
{
status_t rv;
sock_t *sock = NULL;
rv = sock_create(new);
d_assert(rv == CORE_OK, return CORE_ERROR,);
sock = (sock_t *)(*new);
sock->family = family;
sock->fd = socket(sock->family, type, protocol);
if (sock->fd < 0)
{
d_warn("socket create(%d:%d:%d) failed(%d:%s)",
sock->family, type, protocol, errno, strerror(errno));
return CORE_ERROR;
}
d_trace(1, "socket create(%d:%d:%d)\n", sock->family, type, protocol);
return CORE_OK;
}
status_t sock_setsockopt(sock_id id, c_int32_t opt, c_int32_t on)
{
sock_t *sock = (sock_t *)id;
int one;
status_t rv;
d_assert(sock, return CORE_ERROR,);
if (on)
one = 1;
else
one = 0;
switch(opt)
{
case SOCK_O_REUSEADDR:
if (on != sock_is_option_set(sock, SOCK_O_REUSEADDR))
{
if (setsockopt(sock->fd, SOL_SOCKET, SO_REUSEADDR,
(void *)&one, sizeof(int)) == -1)
{
return errno;
}
sock_set_option(sock, SOCK_O_REUSEADDR, on);
}
break;
case SOCK_O_NONBLOCK:
if (sock_is_option_set(sock, SOCK_O_NONBLOCK) != on)
{
if (on)
{
if ((rv = sononblock(sock->fd)) != CORE_OK)
return rv;
}
else
{
if ((rv = soblock(sock->fd)) != CORE_OK)
return rv;
}
sock_set_option(sock, SOCK_O_NONBLOCK, on);
}
break;
default:
d_error("Not implemented(%d)", opt);
return CORE_EINVAL;
}
return CORE_OK;
}
status_t sock_bind(sock_id id, c_sockaddr_t *addr)
{
sock_t *sock = (sock_t *)id;
char buf[CORE_ADDRSTRLEN];
socklen_t addrlen;
d_assert(sock, return CORE_ERROR,);
d_assert(addr, return CORE_ERROR,);
addrlen = sockaddr_len(addr);
d_assert(addrlen, return CORE_ERROR,);
if (bind(sock->fd, &addr->sa, addrlen) != 0)
{
d_error("socket bind(%d) [%s]:%d failed(%d:%s)",
addr->c_sa_family, CORE_ADDR(addr, buf), CORE_PORT(addr),
errno, strerror(errno));
return CORE_ERROR;
}
memcpy(&sock->local_addr, addr, sizeof(sock->local_addr));
d_trace(1, "socket bind %s:%d\n", CORE_ADDR(addr, buf), CORE_PORT(addr));
return CORE_OK;
}
status_t sock_connect(sock_id id, c_sockaddr_t *addr)
{
sock_t *sock = (sock_t *)id;
char buf[CORE_ADDRSTRLEN];
socklen_t addrlen;
d_assert(sock, return CORE_ERROR,);
d_assert(addr, return CORE_ERROR,);
addrlen = sockaddr_len(addr);
d_assert(addrlen, return CORE_ERROR,);
if (connect(sock->fd, &addr->sa, addrlen) != 0)
{
d_error("socket connect[%s]:%d failed(%d:%s)",
CORE_ADDR(addr, buf), CORE_PORT(addr), errno, strerror(errno));
return CORE_ERROR;
}
memcpy(&sock->remote_addr, addr, sizeof(sock->remote_addr));
d_trace(1, "socket connect %s:%d\n", CORE_ADDR(addr, buf), CORE_PORT(addr));
return CORE_OK;
}
status_t sock_listen(sock_id id)
{
int rc;
sock_t *sock = (sock_t *)id;
d_assert(sock, return CORE_ERROR,);
rc = listen(sock->fd, 5);
if (rc < 0)
{
d_error("listen failed(%d:%s)", errno, strerror(errno));
return CORE_ERROR;
}
return CORE_OK;
}
status_t sock_accept(sock_id *new, sock_id id)
{
sock_t *sock = (sock_t *)id;
sock_t *new_sock = NULL;
int new_fd = -1;
c_sockaddr_t addr;
socklen_t addrlen;
memset(&addr, 0, sizeof(addr));
addrlen = sizeof(addr.ss);
d_assert(id, return CORE_ERROR,);
new_fd = accept(sock->fd, &addr.sa, &addrlen);
if (new_fd < 0)
{
d_error("accept failed(%d:%s)", errno, strerror(errno));
return CORE_ERROR;
}
pool_alloc_node(&sock_pool, &new_sock);
d_assert(new_sock, return CORE_ENOMEM,);
memset(new_sock, 0, sizeof(sock_t));
new_sock->family = sock->family;
new_sock->fd = new_fd;
memcpy(&new_sock->remote_addr, &addr, sizeof(new_sock->remote_addr));
*new = (sock_id)new_sock;
return CORE_OK;
}
int sock_family(sock_id id)
{
sock_t *sock = (sock_t *)id;
d_assert(id, return -1,);
return sock->family;
}
c_sockaddr_t *sock_local_addr(sock_id id)
{
sock_t *sock = (sock_t *)id;
d_assert(id, return NULL,);
return &sock->local_addr;
}
c_sockaddr_t *sock_remote_addr(sock_id id)
{
sock_t *sock = (sock_t *)id;
d_assert(id, return NULL,);
return &sock->remote_addr;
}
/*
* Socket Node
*/
status_t sock_add_node(
list_t *list, sock_node_t **node, c_sockaddr_t *sa_list, int family)
{
status_t rv;
c_sockaddr_t *new_list = NULL;
d_assert(list, return CORE_OK,);
d_assert(node, return CORE_OK,);
d_assert(sa_list, return CORE_OK,);
rv = core_copyaddrinfo(&new_list, sa_list);
d_assert(rv == CORE_OK, return CORE_OK,);
if (family != AF_UNSPEC)
{
rv = core_filteraddrinfo(&new_list, family);
d_assert(rv == CORE_OK, return CORE_OK,);
}
if (new_list)
{
pool_alloc_node(&sock_node_pool, node);
d_assert(*node, return CORE_OK,);
memset(*node, 0, sizeof(sock_node_t));
(*node)->list = new_list;
list_append(list, *node);
}
return CORE_OK;
}
status_t sock_remove_node(list_t *list, sock_node_t *node)
{
d_assert(node, return CORE_ERROR,);
list_remove(list, node);
core_freeaddrinfo(node->list);
pool_free_node(&sock_node_pool, node);
return CORE_OK;
}
status_t sock_remove_all_nodes(list_t *list)
{
sock_node_t *node = NULL, *next_node = NULL;
node = list_first(list);
while(node)
{
next_node = list_next(node);
sock_remove_node(list, node);
node = next_node;
}
return CORE_OK;
}
status_t sock_probe_node(
list_t *list, list_t *list6, const char *dev, c_uint16_t port)
{
sock_node_t *node = NULL;
struct ifaddrs *iflist, *cur;
int rc;
rc = getifaddrs(&iflist);
if (rc != 0)
{
d_error("getifaddrs failed(%d:%s)", errno, strerror(errno));
return CORE_ERROR;
}
for (cur = iflist; cur != NULL; cur = cur->ifa_next)
{
c_sockaddr_t *addr = NULL;
if (cur->ifa_flags & IFF_LOOPBACK)
continue;
if (cur->ifa_flags & IFF_POINTOPOINT)
continue;
if (cur->ifa_addr == NULL) /* may happen with ppp interfaces */
continue;
if (dev && strcmp(dev, cur->ifa_name) != 0)
continue;
addr = (c_sockaddr_t *)cur->ifa_addr;
if (cur->ifa_addr->sa_family == AF_INET)
{
if (!list) continue;
#ifndef IN_IS_ADDR_LOOPBACK
#define IN_IS_ADDR_LOOPBACK(a) \
((((long int) (a)->s_addr) & ntohl(0xff000000)) == ntohl(0x7f000000))
#endif /* IN_IS_ADDR_LOOPBACK */
/* An IP equivalent to IN6_IS_ADDR_UNSPECIFIED */
#ifndef IN_IS_ADDR_UNSPECIFIED
#define IN_IS_ADDR_UNSPECIFIED(a) \
(((long int) (a)->s_addr) == 0x00000000)
#endif /* IN_IS_ADDR_UNSPECIFIED */
if (IN_IS_ADDR_UNSPECIFIED(&addr->sin.sin_addr) ||
IN_IS_ADDR_LOOPBACK(&addr->sin.sin_addr))
continue;
}
else if (cur->ifa_addr->sa_family == AF_INET6)
{
if (!list6) continue;
if (IN6_IS_ADDR_UNSPECIFIED(&addr->sin6.sin6_addr) ||
IN6_IS_ADDR_LOOPBACK(&addr->sin6.sin6_addr) ||
IN6_IS_ADDR_MULTICAST(&addr->sin6.sin6_addr) ||
IN6_IS_ADDR_LINKLOCAL(&addr->sin6.sin6_addr) ||
IN6_IS_ADDR_SITELOCAL(&addr->sin6.sin6_addr))
continue;
}
else
continue;
addr = core_calloc(1, sizeof(c_sockaddr_t));
d_assert(addr, return CORE_ERROR,);
memcpy(&addr->sa, cur->ifa_addr, sockaddr_len(cur->ifa_addr));
addr->c_sa_port = htons(port);
pool_alloc_node(&sock_node_pool, &node);
d_assert(node, return CORE_ERROR,);
memset(node, 0, sizeof(sock_node_t));
node->list = addr;
if (addr->c_sa_family == AF_INET)
{
d_assert(list, return CORE_ERROR,);
list_append(list, node);
}
else if (addr->c_sa_family == AF_INET6)
{
d_assert(list6, return CORE_ERROR,);
list_append(list6, node);
}
else
d_assert(0, return CORE_ERROR,);
}
freeifaddrs(iflist);
return CORE_OK;
}
status_t sock_fill_scope_id_in_local(c_sockaddr_t *sa_list)
{
struct ifaddrs *iflist = NULL, *cur;
int rc;
c_sockaddr_t *addr, *ifaddr;
for (addr = sa_list; addr != NULL; addr = addr->next)
{
if (addr->c_sa_family != AF_INET6)
continue;
if (!IN6_IS_ADDR_LINKLOCAL(&addr->sin6.sin6_addr))
continue;
if (addr->sin6.sin6_scope_id != 0)
continue;
if (iflist == NULL)
{
rc = getifaddrs(&iflist);
if (rc != 0)
{
d_error("getifaddrs failed(%d:%s)", errno, strerror(errno));
return CORE_ERROR;
}
}
for (cur = iflist; cur != NULL; cur = cur->ifa_next)
{
ifaddr = (c_sockaddr_t *)cur->ifa_addr;
if (cur->ifa_addr == NULL) /* may happen with ppp interfaces */
continue;
if (cur->ifa_addr->sa_family != AF_INET6)
continue;
if (!IN6_IS_ADDR_LINKLOCAL(&ifaddr->sin6.sin6_addr))
continue;
if (memcmp(&addr->sin6.sin6_addr,
&ifaddr->sin6.sin6_addr, sizeof(struct in6_addr)) == 0)
{
/* Fill Scope ID in localhost */
addr->sin6.sin6_scope_id = ifaddr->sin6.sin6_scope_id;
}
}
}
if (iflist)
freeifaddrs(iflist);
return CORE_OK;
}
/*
* Send/Recv
*/
ssize_t sock_write(sock_id id, const void *buf, size_t len)
{
sock_t *sock = (sock_t *)id;
ssize_t size;
d_assert(id, return -1,);
size = write(sock->fd, buf, len);
if (size < 0)
{
d_error("sock_write(len:%ld) failed(%d:%s)",
len, errno, strerror(errno));
}
return size;
}
ssize_t sock_read(sock_id id, void *buf, size_t len)
{
sock_t *sock = (sock_t *)id;
ssize_t size;
d_assert(id, return -1,);
size = read(sock->fd, buf, len);
if (size < 0)
{
d_error("sock_read(len:%ld) failed(%d:%s)",
len, errno, strerror(errno));
}
return size;
}
ssize_t core_send(sock_id id, const void *buf, size_t len, int flags)
{
sock_t *sock = (sock_t *)id;
ssize_t size;
d_assert(id, return -1,);
size = send(sock->fd, buf, len, flags);
if (size < 0)
{
d_error("core_send(len:%ld) failed(%d:%s)",
len, errno, strerror(errno));
}
return size;
}
ssize_t core_sendto(sock_id id,
const void *buf, size_t len, int flags, const c_sockaddr_t *to)
{
sock_t *sock = (sock_t *)id;
ssize_t size;
socklen_t addrlen;
d_assert(id, return -1,);
d_assert(to, return -1,);
addrlen = sockaddr_len(to);
d_assert(addrlen, return CORE_ERROR,);
size = sendto(sock->fd, buf, len, flags, &to->sa, addrlen);
if (size < 0)
{
d_error("core_sendto(len:%ld) failed(%d:%s)",
len, errno, strerror(errno));
}
return size;
}
ssize_t core_recv(sock_id id, void *buf, size_t len, int flags)
{
sock_t *sock = (sock_t *)id;
ssize_t size;
d_assert(id, return -1,);
size = recv(sock->fd, buf, len, flags);
if (size < 0)
{
d_error("core_recv(len:%ld) failed(%d:%s)",
len, errno, strerror(errno));
}
return size;
}
ssize_t core_recvfrom(sock_id id,
void *buf, size_t len, int flags, c_sockaddr_t *from)
{
sock_t *sock = (sock_t *)id;
ssize_t size;
socklen_t addrlen = sizeof(struct sockaddr_storage);
d_assert(id, return -1,);
d_assert(from, return -1,);
size = recvfrom(sock->fd, buf, len, flags, &from->sa, &addrlen);
if (size < 0)
{
d_error("corek_recvfrom(len:%ld) failed(%d:%s)",
len, errno, strerror(errno));
}
return size;
}
/*
* Select Loop
*/
status_t sock_register(sock_id id, sock_handler handler, void *data)
{
sock_t *sock = (sock_t *)id;
d_assert(id, return CORE_ERROR,);
if (sock_is_registered(id))
{
d_error("socket has already been registered");
return CORE_ERROR;
}
if (sock_setsockopt(id, SOCK_O_NONBLOCK, 1) == CORE_ERROR)
{
d_error("cannot set socket to non-block");
return CORE_ERROR;
}
if (sock->fd > max_fd)
{
max_fd = sock->fd;
}
sock->handler = handler;
sock->data = data;
list_append(&fd_list, sock);
return CORE_OK;
}
status_t sock_unregister(sock_id id)
{
d_assert(id, return CORE_ERROR,);
list_remove(&fd_list, id);
return CORE_OK;
}
int sock_is_registered(sock_id id)
{
sock_t *sock = (sock_t *)id;
sock_t *iter = NULL;
d_assert(id, return CORE_ERROR,);
for (iter = list_first(&fd_list); iter != NULL; iter = list_next(iter))
{
if (iter == sock)
{
return 1;
}
}
return 0;
}
int sock_select_loop(c_time_t timeout)
{
struct timeval tv;
int rc;
if (timeout > 0)
{
tv.tv_sec = time_sec(timeout);
tv.tv_usec = time_usec(timeout);
}
set_fds(&read_fds);
rc = select(max_fd + 1, &read_fds, NULL, NULL, timeout > 0 ? &tv : NULL);
if (rc < 0)
{
if (errno != EINTR && errno != 0)
d_error("select failed(%d:%s)", errno, strerror(errno));
return rc;
}
/* Timeout */
if (rc == 0)
{
return rc;
}
/* Dispatch Handler */
fd_dispatch(&read_fds);
return 0;
}
static status_t soblock(int sd)
{
/* BeOS uses setsockopt at present for non blocking... */
#ifndef BEOS
int fd_flags;
fd_flags = fcntl(sd, F_GETFL, 0);
#if defined(O_NONBLOCK)
fd_flags &= ~O_NONBLOCK;
#elif defined(O_NDELAY)
fd_flags &= ~O_NDELAY;
#elif defined(FNDELAY)
fd_flags &= ~FNDELAY;
#else
#error Please teach CORE how to make sockets blocking on your platform.
#endif
if (fcntl(sd, F_SETFL, fd_flags) == -1)
{
return errno;
}
#else
int on = 0;
if (setsockopt(sd, SOL_SOCKET, SO_NONBLOCK, &on, sizeof(int)) < 0)
return errno;
#endif /* BEOS */
return CORE_OK;
}
static status_t sononblock(int sd)
{
#ifndef BEOS
int fd_flags;
fd_flags = fcntl(sd, F_GETFL, 0);
#if defined(O_NONBLOCK)
fd_flags |= O_NONBLOCK;
#elif defined(O_NDELAY)
fd_flags |= O_NDELAY;
#elif defined(FNDELAY)
fd_flags |= FNDELAY;
#else
#error Please teach CORE how to make sockets non-blocking on your platform.
#endif
if (fcntl(sd, F_SETFL, fd_flags) == -1)
{
return errno;
}
#else
int on = 1;
if (setsockopt(sd, SOL_SOCKET, SO_NONBLOCK, &on, sizeof(int)) < 0)
return errno;
#endif /* BEOS */
return CORE_OK;
}
static void set_fds(fd_set *fds)
{
sock_t *sock = NULL;
FD_ZERO(fds);
for (sock = list_first(&fd_list); sock != NULL; sock = list_next(sock))
{
FD_SET(sock->fd, fds);
}
}
static void fd_dispatch(fd_set *fds)
{
sock_t *sock = NULL;
for (sock = list_first(&fd_list); sock != NULL; sock = list_next(sock))
{
if (FD_ISSET(sock->fd, fds))
{
if (sock->handler)
{
sock->handler((sock_id)sock, sock->data);
}
}
}
}

View File

@@ -11,7 +11,7 @@
#include "core_rwlock.h"
#include "core_semaphore.h"
#include "core_thread.h"
#include "core_net.h"
#include "core_network.h"
#include "core_file.h"
#include "core_pkbuf.h"
#include "core_signal.h"
@@ -45,13 +45,12 @@ status_t core_initialize(void)
rwlock_init();
atomic_init();
thread_init();
net_init();
network_init();
file_init();
pkbuf_init();
tlv_init();
tm_init();
msgq_init();
d_msg_init();
signal_init();
return CORE_OK;
@@ -65,13 +64,12 @@ void core_terminate(void)
}
/* Reverse ordered finalization */
d_msg_final();
msgq_final();
tm_final();
tlv_final();
pkbuf_final();
file_final();
net_final();
network_final();
thread_final();
atomic_final();
rwlock_final();

93
lib/core/src/unix/tcp.c Normal file
View File

@@ -0,0 +1,93 @@
#define TRACE_MODULE _tcp
#include "core_debug.h"
#include "core_arch_network.h"
status_t tcp_server(sock_id *new, c_sockaddr_t *sa_list)
{
status_t rv;
c_sockaddr_t *addr;
char buf[CORE_ADDRSTRLEN];
d_assert(new, return CORE_ERROR,);
d_assert(sa_list, return CORE_ERROR,);
addr = sa_list;
while(addr)
{
rv = sock_socket(new, addr->c_sa_family, SOCK_STREAM, IPPROTO_TCP);
if (rv == CORE_OK)
{
d_assert(sock_setsockopt(*new, SOCK_O_REUSEADDR, 1) == CORE_OK,
return CORE_ERROR,
"setsockopt [%s]:%d failed(%d:%s)",
CORE_ADDR(addr, buf), CORE_PORT(addr),
errno, strerror(errno));
if (sock_bind(*new, addr) == CORE_OK)
{
d_trace(1, "tcp_server() [%s]:%d\n",
CORE_ADDR(addr, buf), CORE_PORT(addr));
break;
}
rv = sock_delete(*new);
d_assert(rv == CORE_OK, return CORE_ERROR,);
}
addr = addr->next;
}
if (addr == NULL)
{
d_error("tcp_server() [%s]:%d failed(%d:%s)",
CORE_ADDR(sa_list, buf), CORE_PORT(sa_list),
errno, strerror(errno));
return CORE_ERROR;
}
rv = sock_listen(*new);
d_assert(rv == CORE_OK, return CORE_ERROR,);
return CORE_OK;
}
status_t tcp_client(sock_id *new, c_sockaddr_t *sa_list)
{
status_t rv;
c_sockaddr_t *addr;
char buf[CORE_ADDRSTRLEN];
d_assert(new, return CORE_ERROR,);
d_assert(sa_list, return CORE_ERROR,);
addr = sa_list;
while(addr)
{
rv = sock_socket(new, addr->c_sa_family, SOCK_STREAM, IPPROTO_TCP);
if (rv == CORE_OK)
{
if (sock_connect(*new, addr) == CORE_OK)
{
d_trace(1, "tcp_client() [%s]:%d\n",
CORE_ADDR(addr, buf), CORE_PORT(addr));
break;
}
rv = sock_delete(*new);
d_assert(rv == CORE_OK, return CORE_ERROR,);
}
addr = addr->next;
}
if (addr == NULL)
{
d_error("tcp_client() [%s]:%d failed(%d:%s)",
CORE_ADDR(sa_list, buf), CORE_PORT(sa_list),
errno, strerror(errno));
return CORE_ERROR;
}
return CORE_OK;
}

View File

@@ -123,8 +123,7 @@ status_t time_exp_get(c_time_t *t, time_exp_t *xt)
return CORE_OK;
}
status_t time_exp_gmt_get(c_time_t *t,
time_exp_t *xt)
status_t time_exp_gmt_get(c_time_t *t, time_exp_t *xt)
{
status_t status = time_exp_get(t, xt);
if (status == CORE_OK)

366
lib/core/src/unix/tun.c Normal file
View File

@@ -0,0 +1,366 @@
#define TRACE_MODULE _core_tun
#include "core_debug.h"
#include "core_arch_network.h"
#if LINUX == 1
#include <linux/if_tun.h>
#else
#include <netinet6/in6_var.h>
#include <netinet6/nd6.h>
#endif
#if HAVE_NET_ROUTE_H
#include <net/route.h>
#endif
status_t tun_open(sock_id *new, char *ifname, int is_tap)
{
status_t rv;
sock_t *sock = NULL;
int fd = -1;
#if LINUX == 1
char *dev = "/dev/net/tun";
int rc;
struct ifreq ifr;
int flags = IFF_NO_PI;
fd = open(dev, O_RDWR);
if (fd < 0)
{
d_error("open() failed(%d:%s) : dev[%s]", errno, strerror(errno), dev);
return -1;
}
#else
char name[C_PATH_MAX];
int tun = 0;
#define TUNTAP_ID_MAX 255
for (tun = 0; tun < TUNTAP_ID_MAX; tun++)
{
(void)snprintf(name, sizeof(name), "/dev/tun%i", tun);
if ((fd = open(name, O_RDWR)) > 0)
{
(void)snprintf(name, sizeof(name), "tun%i", tun);
ifname = name;
break;
}
}
#endif
rv = sock_create(new);
d_assert(rv == CORE_OK, return CORE_ERROR,);
sock = (sock_t *)(*new);
d_assert(sock, return CORE_ERROR,);
/* Save socket descriptor */
sock->fd = fd;
/* Save the interface name */
strncpy(sock->ifname, ifname, IFNAMSIZ);
#if LINUX == 1
memset(&ifr, 0, sizeof(ifr));
ifr.ifr_flags = (is_tap ? (flags | IFF_TAP) : (flags | IFF_TUN));
strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
rc = ioctl(sock->fd, TUNSETIFF, (void *)&ifr);
if (rc < 0)
{
d_error("ioctl() failed(%d:%s) : dev[%s] flags[0x%x]",
errno, strerror(errno), ifname, flags);
goto cleanup;
}
#endif
return CORE_OK;
#if LINUX == 1
cleanup:
sock_delete(*new);
return CORE_ERROR;
#endif
}
status_t tun_set_ipv4(sock_id id, ipsubnet_t *ipaddr, ipsubnet_t *ipsub)
{
#if LINUX != 1
sock_t *sock = NULL;
int fd;
struct ifaliasreq ifa;
struct ifreq ifr;
struct sockaddr_in addr;
struct sockaddr_in mask;
char buf[512];
int len;
struct rt_msghdr *rtm;
struct sockaddr_in dst, gw;
struct sockaddr_in *paddr;
d_assert(ipaddr, return CORE_ERROR,);
d_assert(ipsub, return CORE_ERROR,);
sock = (sock_t *)id;
d_assert(id, return CORE_ERROR,);
fd = socket(ipaddr->family, SOCK_DGRAM, 0);
(void)memset(&ifa, '\0', sizeof ifa);
(void)strlcpy(ifa.ifra_name, sock->ifname, sizeof ifa.ifra_name);
(void)memset(&ifr, '\0', sizeof ifr);
(void)strlcpy(ifr.ifr_name, sock->ifname, sizeof ifr.ifr_name);
#if 0
/* Delete previously assigned address */
(void)ioctl(fd, SIOCDIFADDR, &ifr);
#endif
(void)memset(&addr, '\0', sizeof(addr));
addr.sin_family = ipaddr->family;
addr.sin_addr.s_addr = ipaddr->sub[0];
addr.sin_len = sizeof(addr);
(void)memcpy(&ifa.ifra_addr, &addr, sizeof(addr));
(void)memcpy(&ifa.ifra_broadaddr, &addr, sizeof(addr));
(void)memset(&mask, '\0', sizeof(mask));
mask.sin_family = ipaddr->family;
mask.sin_addr.s_addr = ipaddr->mask[0];
mask.sin_len = sizeof(mask);
(void)memcpy(&ifa.ifra_mask, &mask, sizeof(ifa.ifra_mask));
if (ioctl(fd, SIOCAIFADDR, &ifa) == -1) {
d_error("Can't IP address(%d:%s) : dev[%s]",
errno, strerror(errno), sock->ifname);
return CORE_ERROR;
}
close(fd); /* SOCK_DGRAM */
fd = socket(PF_ROUTE, SOCK_RAW, 0);
if (fd < 0)
{
d_error("Can't open PF_ROUTE(%d:%s)", errno, strerror(errno));
return CORE_ERROR;
}
(void)memset(&buf, 0, sizeof(buf));
rtm = (struct rt_msghdr *)buf;
rtm->rtm_type = RTM_ADD;
rtm->rtm_version = RTM_VERSION;
rtm->rtm_pid = getpid();
rtm->rtm_seq = 0;
rtm->rtm_flags = RTF_UP | RTF_GATEWAY;
rtm->rtm_addrs = RTA_DST | RTA_GATEWAY | RTA_NETMASK;
paddr = (struct sockaddr_in *)(rtm + 1);
(void)memset(&dst, '\0', sizeof(dst));
dst.sin_family = ipaddr->family;
dst.sin_addr.s_addr = ipsub->sub[0];
dst.sin_len = sizeof(dst);
(void)memcpy(paddr, &dst, sizeof(dst));
paddr = (struct sockaddr_in *)((char *)paddr +
CORE_ALIGN(sizeof(*paddr), sizeof(c_uintptr_t)));
(void)memset(&gw, '\0', sizeof(gw));
gw.sin_family = ipaddr->family;
gw.sin_addr.s_addr = ipaddr->sub[0];
gw.sin_len = sizeof(gw);
(void)memcpy(paddr, &gw, sizeof(gw));
paddr = (struct sockaddr_in *)((char *)paddr +
CORE_ALIGN(sizeof(*paddr), sizeof(c_uintptr_t)));
(void)memset(&mask, '\0', sizeof(mask));
mask.sin_family = ipaddr->family;
mask.sin_addr.s_addr = ipsub->mask[0];
mask.sin_len = sizeof(mask);
(void)memcpy(paddr, &mask, sizeof(mask));
paddr = (struct sockaddr_in *)((char *)paddr +
CORE_ALIGN(sizeof(*paddr), sizeof(c_uintptr_t)));
len = (char*)paddr - buf;
rtm->rtm_msglen = len;
if (write(fd, buf, len) < 0)
{
d_error("Can't add routing(%d:%s)", errno, strerror(errno));
return CORE_ERROR;
}
close(fd); /* PF_ROUTE, SOCK_RAW */
#endif /* LINUX == 1 */
return CORE_OK;
}
status_t tun_set_ipv6(sock_id id, ipsubnet_t *ipaddr, ipsubnet_t *ipsub)
{
#if LINUX != 1
sock_t *sock = NULL;
int fd;
struct in6_aliasreq ifa;
struct in6_ifreq ifr;
struct sockaddr_in6 addr;
struct sockaddr_in6 mask;
char buf[512];
int len;
struct rt_msghdr *rtm;
#if 0
struct sockaddr_in6 dst, gw;
#else
struct sockaddr_in6 dst;
#endif
struct sockaddr_in6 *paddr;
d_assert(ipaddr, return CORE_ERROR,);
d_assert(ipsub, return CORE_ERROR,);
sock = (sock_t *)id;
d_assert(id, return CORE_ERROR,);
fd = socket(ipaddr->family, SOCK_DGRAM, 0);
(void)memset(&ifa, '\0', sizeof ifa);
(void)strlcpy(ifa.ifra_name, sock->ifname, sizeof ifa.ifra_name);
(void)memset(&ifr, '\0', sizeof ifr);
(void)strlcpy(ifr.ifr_name, sock->ifname, sizeof ifr.ifr_name);
#if 0
/* Delete previously assigned address */
(void)ioctl(fd, SIOCDIFADDR, &ifr);
#endif
(void)memset(&addr, '\0', sizeof(addr));
addr.sin6_family = ipaddr->family;
memcpy(addr.sin6_addr.s6_addr, ipaddr->sub, sizeof ipaddr->sub);
addr.sin6_len = sizeof(addr);
(void)memcpy(&ifa.ifra_addr, &addr, sizeof(addr));
(void)memcpy(&ifa.ifra_dstaddr, &addr, sizeof(addr));
(void)memset(&mask, '\0', sizeof(mask));
mask.sin6_family = ipaddr->family;
memcpy(mask.sin6_addr.s6_addr, ipaddr->mask, sizeof ipaddr->mask);
mask.sin6_len = sizeof(mask);
(void)memcpy(&ifa.ifra_prefixmask, &mask, sizeof(ifa.ifra_prefixmask));
ifa.ifra_lifetime.ia6t_vltime = ND6_INFINITE_LIFETIME;
ifa.ifra_lifetime.ia6t_pltime = ND6_INFINITE_LIFETIME;
if (ioctl(fd, SIOCAIFADDR_IN6, &ifa) == -1) {
d_error("Can't IP address(%d:%s) : dev[%s]",
errno, strerror(errno), sock->ifname);
return CORE_ERROR;
}
close(fd); /* SOCK_DGRAM */
fd = socket(PF_ROUTE, SOCK_RAW, 0);
if (fd < 0)
{
d_error("Can't open PF_ROUTE(%d:%s)", errno, strerror(errno));
return CORE_ERROR;
}
(void)memset(&buf, 0, sizeof(buf));
rtm = (struct rt_msghdr *)buf;
rtm->rtm_type = RTM_DELETE;
rtm->rtm_version = RTM_VERSION;
rtm->rtm_pid = getpid();
rtm->rtm_seq = 0;
rtm->rtm_addrs = RTA_DST;
paddr = (struct sockaddr_in6 *)(rtm + 1);
(void)memset(&dst, '\0', sizeof(dst));
dst.sin6_family = ipaddr->family;
memcpy(dst.sin6_addr.s6_addr, ipaddr->sub, sizeof ipsub->sub);
dst.sin6_len = sizeof(dst);
(void)memcpy(paddr, &dst, sizeof(dst));
paddr = (struct sockaddr_in6 *)((char *)paddr +
CORE_ALIGN(sizeof(*paddr), sizeof(c_uintptr_t)));
len = (char*)paddr - buf;
rtm->rtm_msglen = len;
if (write(fd, buf, len) < 0)
{
d_error("Can't add routing(%d:%s)", errno, strerror(errno));
return CORE_ERROR;
}
#if 0
(void)memset(&buf, 0, sizeof(buf));
rtm = (struct rt_msghdr *)buf;
rtm->rtm_type = RTM_ADD;
rtm->rtm_version = RTM_VERSION;
rtm->rtm_pid = getpid();
rtm->rtm_seq = 0;
rtm->rtm_flags = RTF_UP | RTF_GATEWAY;
rtm->rtm_addrs = RTA_DST | RTA_GATEWAY | RTA_NETMASK;
paddr = (struct sockaddr_in6 *)(rtm + 1);
(void)memset(&dst, '\0', sizeof(dst));
dst.sin6_family = ipaddr->family;
memcpy(dst.sin6_addr.s6_addr, ipsub->sub, sizeof ipsub->sub);
dst.sin6_len = sizeof(dst);
(void)memcpy(paddr, &dst, sizeof(dst));
paddr = (struct sockaddr_in6 *)((char *)paddr +
CORE_ALIGN(sizeof(*paddr), sizeof(c_uintptr_t)));
(void)memset(&gw, '\0', sizeof(gw));
gw.sin6_family = ipaddr->family;
memcpy(gw.sin6_addr.s6_addr, ipaddr->sub, sizeof ipaddr->sub);
gw.sin6_len = sizeof(gw);
(void)memcpy(paddr, &gw, sizeof(gw));
paddr = (struct sockaddr_in6 *)((char *)paddr +
CORE_ALIGN(sizeof(*paddr), sizeof(c_uintptr_t)));
(void)memset(&mask, '\0', sizeof(mask));
mask.sin6_family = ipaddr->family;
memcpy(mask.sin6_addr.s6_addr, ipsub->mask, sizeof ipsub->mask);
mask.sin6_len = sizeof(mask);
(void)memcpy(paddr, &mask, sizeof(mask));
paddr = (struct sockaddr_in6 *)((char *)paddr +
CORE_ALIGN(sizeof(*paddr), sizeof(c_uintptr_t)));
len = (char*)paddr - buf;
rtm->rtm_msglen = len;
if (write(fd, buf, len) < 0)
{
d_error("Can't add routing(%d:%s)", errno, strerror(errno));
return CORE_ERROR;
}
#endif
close(fd); /* PF_ROUTE, SOCK_RAW */
#endif /* LINUX == 1 */
return CORE_OK;
}
status_t tun_set_ip(sock_id id, ipsubnet_t *gw, ipsubnet_t *sub)
{
status_t rv = CORE_OK;
d_assert(id, return CORE_ERROR,);
d_assert(gw, return CORE_ERROR,);
d_assert(sub, return CORE_ERROR,);
if (gw->family == AF_INET)
rv = tun_set_ipv4(id, gw, sub);
else if (gw->family == AF_INET6)
{
#if 0
rv = tun_set_ipv6(id, gw, sub);
#endif
}
else
d_assert(0, return CORE_ERROR,);
return rv;
}

134
lib/core/src/unix/udp.c Normal file
View File

@@ -0,0 +1,134 @@
#define TRACE_MODULE _udp
#include "core_debug.h"
#include "core_arch_network.h"
status_t udp_socket(sock_id *new, int family)
{
status_t rv;
rv = sock_socket(new, family, SOCK_DGRAM, IPPROTO_UDP);
d_assert(rv == CORE_OK && new, return CORE_ERROR,);
d_trace(1, "udp socket(%d)\n", family);
return CORE_OK;
}
status_t udp_server(sock_id *new, c_sockaddr_t *sa_list)
{
status_t rv;
c_sockaddr_t *addr;
char buf[CORE_ADDRSTRLEN];
d_assert(new, return CORE_ERROR,);
d_assert(sa_list, return CORE_ERROR,);
addr = sa_list;
while(addr)
{
rv = udp_socket(new, addr->c_sa_family);
if (rv == CORE_OK)
{
d_assert(sock_setsockopt(*new, SOCK_O_REUSEADDR, 1) == CORE_OK,
return CORE_ERROR,
"setsockopt [%s]:%d failed(%d:%s)",
CORE_ADDR(addr, buf), CORE_PORT(addr),
errno, strerror(errno));
if (sock_bind(*new, addr) == CORE_OK)
{
d_trace(1, "udp_server() [%s]:%d\n",
CORE_ADDR(addr, buf), CORE_PORT(addr));
break;
}
rv = sock_delete(*new);
d_assert(rv == CORE_OK, return CORE_ERROR,);
}
addr = addr->next;
}
if (addr == NULL)
{
d_error("udp_server() [%s]:%d failed(%d:%s)",
CORE_ADDR(sa_list, buf), CORE_PORT(sa_list),
errno, strerror(errno));
return CORE_ERROR;
}
return CORE_OK;
}
status_t udp_client(sock_id *new, c_sockaddr_t *sa_list)
{
status_t rv;
c_sockaddr_t *addr;
char buf[CORE_ADDRSTRLEN];
d_assert(new, return CORE_ERROR,);
d_assert(sa_list, return CORE_ERROR,);
addr = sa_list;
while(addr)
{
rv = udp_socket(new, addr->c_sa_family);
if (rv == CORE_OK)
{
if (sock_connect(*new, addr) == CORE_OK)
{
d_trace(1, "udp_client() [%s]:%d\n",
CORE_ADDR(addr, buf), CORE_PORT(addr));
break;
}
rv = sock_delete(*new);
d_assert(rv == CORE_OK, return CORE_ERROR,);
}
addr = addr->next;
}
if (addr == NULL)
{
d_error("udp_client() [%s]:%d failed(%d:%s)",
CORE_ADDR(sa_list, buf), CORE_PORT(sa_list), errno,
strerror(errno));
return CORE_ERROR;
}
return CORE_OK;
}
status_t udp_connect(sock_id id, c_sockaddr_t *sa_list)
{
c_sockaddr_t *addr;
char buf[CORE_ADDRSTRLEN];
d_assert(id, return CORE_ERROR,);
d_assert(sa_list, return CORE_ERROR,);
addr = sa_list;
while(addr)
{
if (sock_connect(id, addr) == CORE_OK)
{
d_trace(1, "udp_connect() [%s]:%d\n",
CORE_ADDR(addr, buf), CORE_PORT(addr));
break;
}
addr = addr->next;
}
if (addr == NULL)
{
d_error("udp_connect() [%s]:%d failed(%d:%s)",
CORE_ADDR(sa_list, buf), CORE_PORT(sa_list),
errno, strerror(errno));
return CORE_ERROR;
}
return CORE_OK;
}

View File

@@ -3,17 +3,20 @@
bin_PROGRAMS = testcore
testcore_SOURCES = \
abts.c testds.c testfsm.c testnetlib.c testthread.c testtlv.c \
abts.c testds.c testfsm.c testsock.c testthread.c testtlv.c \
testaes.c testfile.c testlock.c testatomic.c testsha.c testtime.c \
testdir.c testfilecopy.c testmsgq.c testsleep.c testtimer.c \
testpkbuf.c testmisc.c testhash.c \
testpkbuf.c testmisc.c testhash.c test3gpp.c \
abts.h abts_tests.h testutil.c testutil.h
if !USRSCTP
testcore_SOURCES += testsctp.c
endif
testcore_LDADD = \
$(top_srcdir)/lib/core/src/libcore.la
AM_CPPFLAGS = \
-I$(top_srcdir)/lib/core/include/arch/@OSDIR@ \
-I$(top_srcdir)/lib/core/include
AM_CFLAGS = \

View File

@@ -217,12 +217,12 @@ static void abts_free(abts_suite *suite)
while (ptr != NULL) {
next_ptr = ptr->next;
core_free((void*)ptr->name);
core_free(ptr);
CORE_FREE((void*)ptr->name);
CORE_FREE(ptr);
ptr = next_ptr;
}
core_free(suite);
CORE_FREE(suite);
}
void abts_log_message(const char *fmt, ...)
@@ -473,7 +473,7 @@ int main(int argc, const char *const argv[]) {
abts_free(suite);
core_free(testlist);
CORE_FREE(testlist);
return rv;
}

View File

@@ -28,7 +28,10 @@ const struct testlist {
{testtlv},
{testaes},
{testsha2},
{testnetlib},
{testsock},
#ifndef DARWIN
{testsctp},
#endif
{testtime},
{testtimer},
{testthread},
@@ -42,6 +45,7 @@ const struct testlist {
{testpkbuf},
{testmisc},
{testhash},
{test3gpp},
};
#endif /* APR_TEST_INCLUDES */

View File

@@ -1,11 +1,11 @@
#include "core_lib.h"
#include "core_debug.h"
#include "types.h"
#include "3gpp_types.h"
#include "testutil.h"
static void _base_test1(abts_case *tc, void *data)
static void _3gpp_test1(abts_case *tc, void *data)
{
status_t rv;
plmn_id_t plmn_id;
@@ -26,11 +26,11 @@ static void _base_test1(abts_case *tc, void *data)
ABTS_INT_EQUAL(tc, 2, plmn_id_mnc_len(&plmn_id));
}
abts_suite *test_base(abts_suite *suite)
abts_suite *test3gpp(abts_suite *suite)
{
suite = ADD_SUITE(suite)
abts_run_test(suite, _base_test1, NULL);
abts_run_test(suite, _3gpp_test1, NULL);
return suite;
}

View File

@@ -126,8 +126,8 @@ static void aes_test2(abts_case *tc, void *data)
rc = memcmp(tmp, test_vector[i].decipher_output, 16);
ABTS_INT_EQUAL(tc, 0, rc);
core_free(test_vector[i].key);
core_free(test_vector[i].rk);
CORE_FREE(test_vector[i].key);
CORE_FREE(test_vector[i].rk);
}
}

View File

@@ -109,7 +109,7 @@ static void test_read(abts_case *tc, void *data)
ABTS_SIZE_EQUAL(tc, strlen(TESTSTR), nbytes);
ABTS_STR_EQUAL(tc, TESTSTR, str);
core_free(str);
CORE_FREE(str);
file_close(filetest);
}
@@ -289,7 +289,7 @@ static void test_seek(abts_case *tc, void *data)
ABTS_SIZE_EQUAL(tc, 5, nbytes);
ABTS_STR_EQUAL(tc, TESTSTR + strlen(TESTSTR) - 5, str);
core_free(str);
CORE_FREE(str);
file_close(filetest);
}
@@ -329,7 +329,7 @@ static void test_gets(abts_case *tc, void *data)
ABTS_INT_EQUAL(tc, CORE_EOF, rv);
ABTS_STR_EQUAL(tc, "", str);
core_free(str);
CORE_FREE(str);
file_close(f);
}
@@ -476,7 +476,7 @@ static void file_contents_equal(abts_case *tc,
CORE_ASSERT_OK(tc, "close file", file_close(f));
core_free(actual);
CORE_FREE(actual);
}
#define LINE1 "this is a line of text\n"

View File

@@ -137,6 +137,54 @@ static void misc_test7(abts_case *tc, void *data)
ABTS_TRUE(tc, strcmp("001010123456819", out) == 0);
}
#define TEST_ENVVAR_NAME "core_test_envvar"
#define TEST_ENVVAR2_NAME "core_test_envvar2"
#define TEST_ENVVAR_VALUE "Just a value that we'll check"
static void misc_test8(abts_case *tc, void *data)
{
char *value;
status_t rv;
rv = core_env_set(TEST_ENVVAR_NAME, TEST_ENVVAR_VALUE);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
value = core_env_get(TEST_ENVVAR_NAME);
ABTS_PTR_NOTNULL(tc, value);
ABTS_STR_EQUAL(tc, TEST_ENVVAR_VALUE, value);
rv = core_env_delete(TEST_ENVVAR_NAME);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
value = core_env_get(TEST_ENVVAR_NAME);
ABTS_PTR_NULL(tc, value);
rv = core_env_set(TEST_ENVVAR_NAME, "");
ABTS_INT_EQUAL(tc, CORE_OK, rv);
value = core_env_get(TEST_ENVVAR_NAME);
ABTS_PTR_NOTNULL(tc, value);
ABTS_STR_EQUAL(tc, "", value);
rv = core_env_delete(TEST_ENVVAR_NAME);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
value = core_env_get(TEST_ENVVAR_NAME);
ABTS_PTR_NULL(tc, value);
rv = core_env_set(TEST_ENVVAR2_NAME, TEST_ENVVAR_VALUE);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
value = core_env_get(TEST_ENVVAR2_NAME);
ABTS_PTR_NOTNULL(tc, value);
ABTS_STR_EQUAL(tc, TEST_ENVVAR_VALUE, value);
value = core_env_get(TEST_ENVVAR_NAME);
ABTS_PTR_NULL(tc, value);
value = core_env_get(TEST_ENVVAR2_NAME);
ABTS_PTR_NOTNULL(tc, value);
ABTS_STR_EQUAL(tc, TEST_ENVVAR_VALUE, value);
rv = core_env_delete(TEST_ENVVAR2_NAME);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
value = core_env_get(TEST_ENVVAR2_NAME);
ABTS_PTR_NULL(tc, value);
}
abts_suite *testmisc(abts_suite *suite)
{
suite = ADD_SUITE(suite)
@@ -148,6 +196,7 @@ abts_suite *testmisc(abts_suite *suite)
abts_run_test(suite, misc_test5, NULL);
abts_run_test(suite, misc_test6, NULL);
abts_run_test(suite, misc_test7, NULL);
abts_run_test(suite, misc_test8, NULL);
return suite;
}

View File

@@ -14,11 +14,9 @@
static char buffer[TEST_BUFFER_SIZE];
static int tcp_server_started = 0;
static int udp_server_started = 0;
static int sctp_stream_server_started = 0;
static int sctp_seq_server_started = 0;
pthread_t tserver_tid,userver_tid,streamserver_tid, seqserver_tid;
net_sock_t *tserver_sock,*userver_sock,*streamserver_sock,*seqserver_sock;
pthread_t tserver_tid,userver_tid;
net_sock_t *tserver_sock,*userver_sock;
static void *tcp_session_main(void *param)
{
@@ -108,6 +106,7 @@ static void start_tcp_server()
{
sleep(1);
}
sleep(1);
return;
}
@@ -183,171 +182,6 @@ static void stop_udp_server()
pthread_join(userver_tid, NULL);
}
static void *sctp_stream_session_main(void *param)
{
int rc;
net_sock_t *net_sock = (net_sock_t *)param;
while (1)
{
rc = net_read(net_sock, buffer, TEST_BUFFER_SIZE, 1);
if (rc > 0)
{
if (!strncmp(buffer, "QUIT",4))
{
break;
}
else
{
/* Send received data */
rc = net_send(net_sock, buffer, rc);
}
}
else if (rc == 0)
{
/* Timeout */
}
else
{
if (rc != -2 && net_sock->sndrcv_errno != EAGAIN)
break;
}
}
net_close(net_sock);
return NULL;
}
static void start_stream_sctp_session(net_sock_t *net_sock)
{
pthread_t tid;
pthread_create(&tid, NULL, sctp_stream_session_main, (void *)net_sock);
pthread_detach(tid);
return;
}
static void *sctp_stream_server_main(void *param)
{
int rc;
net_sock_t *new_sock;
rc = net_listen(&streamserver_sock,
SOCK_STREAM, IPPROTO_SCTP, TEST_SERVER_PORT);
if (rc != 0)
{
d_error("net_sctp_listen Error(rc = %d)\n",rc);
return NULL;
}
sctp_stream_server_started = 1;
while (1)
{
rc = net_accept(&new_sock, streamserver_sock, 1);
if (rc >0)
{
/* New connection arrived. Start session */
start_stream_sctp_session(new_sock);
}
else if (rc == 0)
{
/* Timeout */
}
else
{
/* Error occured */
break;
}
}
return NULL;
}
static void start_stream_sctp_server()
{
pthread_create(&streamserver_tid, NULL, sctp_stream_server_main, NULL);
while (sctp_stream_server_started == 0)
{
sleep(1);
}
return;
}
static void stop_stream_sctp_server()
{
net_close(streamserver_sock);
pthread_join(streamserver_tid, NULL);
}
static void *sctp_seq_server_main(void *param)
{
int rc;
rc = net_listen(&seqserver_sock,
SOCK_SEQPACKET, IPPROTO_SCTP, TEST_SERVER_PORT);
if (rc != 0)
{
d_error("net_sctp Error(rc = %d)\n",rc);
return NULL;
}
sctp_seq_server_started = 1;
while (1)
{
d_trace(1,"Wait for data....\n");
rc = net_read(seqserver_sock, buffer, TEST_BUFFER_SIZE, 2);
if (rc >0)
{
d_trace(1,"RECV %d bytes\n", rc);
if (!strncmp(buffer, "QUIT",4))
{
break;
}
else
{
/* Send received data */
rc = net_send(seqserver_sock, buffer, rc);
d_trace(1,"SEND %d bytes\n", rc);
if (rc == -1)
{
printf("error = %d\n", seqserver_sock->sndrcv_errno);
}
}
}
else if (rc == 0)
{
/* Timeout */
}
else
{
/* Error occured */
if (rc != -2 && seqserver_sock->sndrcv_errno != EAGAIN)
break;
}
}
return NULL;
}
static void start_seq_sctp_server()
{
pthread_create(&seqserver_tid, NULL, sctp_seq_server_main, NULL);
while (sctp_seq_server_started == 0)
{
sleep(1);
}
return;
}
static void stop_seq_sctp_server()
{
net_close(seqserver_sock);
pthread_join(seqserver_tid, NULL);
}
static void netlib1(abts_case *tc, void *data)
{
int rc = 0;
@@ -529,139 +363,6 @@ static void netlib3(abts_case *tc, void *data)
}
static void netlib4(abts_case *tc, void *data)
{
int rc = 0;
net_sock_t *net_sock[TEST_MAX_NUM];
char inputbuf[TEST_MAX_NUM][25];
char outputbuf[TEST_MAX_NUM][25];
int i;
/* Start SCTP Server */
start_stream_sctp_server();
/* Connect to invalid port */
d_log_set_level(D_MSG_TO_STDOUT, D_LOG_LEVEL_FATAL);
for (i =0 ; i<TEST_MAX_NUM; i++)
{
net_sock[i] = NULL;
rc = net_open(&net_sock[i], "127.0.0.1", 0,TEST_SERVER_PORT + 1,
SOCK_STREAM, IPPROTO_SCTP);
ABTS_INT_EQUAL(tc, -1, rc);
ABTS_PTR_NULL(tc, net_sock[i]);
}
d_log_set_level(D_MSG_TO_STDOUT, D_LOG_LEVEL_FULL);
for (i =0 ; i<TEST_MAX_NUM; i++)
{
net_sock[i] = NULL;
rc = net_open(&net_sock[i], "127.0.0.1", 0, TEST_SERVER_PORT,
SOCK_STREAM, IPPROTO_SCTP);
ABTS_INT_EQUAL(tc, 0, rc);
ABTS_PTR_NOTNULL(tc, net_sock[i]);
}
for (i=0; i< TEST_MAX_NUM; i++)
{
sprintf(inputbuf[i],"asdf%d",i);
memset(outputbuf[i], 0, sizeof(outputbuf[i]));
rc = net_send(net_sock[i], inputbuf[i], strlen(inputbuf[i])+1);
ABTS_INT_EQUAL(tc, strlen(inputbuf[i])+1, rc);
rc = 0;
while (1)
{
int n;
n = net_read(net_sock[i], outputbuf[i], sizeof(outputbuf[1]), 1);
if (n < 0 && net_sock[i]->sndrcv_errno == EAGAIN)
continue;
rc += n;
if (n == 0 || n == 6)
break;
}
ABTS_INT_EQUAL(tc, 6, rc);
ABTS_INT_EQUAL(tc, 6, strlen(outputbuf[i])+1);
ABTS_STR_EQUAL(tc, inputbuf[i], outputbuf[i]);
}
for (i = 0 ; i< TEST_MAX_NUM; i++)
{
rc = net_close(net_sock[i]);
ABTS_INT_EQUAL(tc, 0, rc);
}
stop_stream_sctp_server();
}
static void netlib5(abts_case *tc, void *data)
{
int rc = 0;
net_sock_t *net_sock[TEST_MAX_NUM];
char inputbuf[TEST_MAX_NUM][25];
char outputbuf[TEST_MAX_NUM][25];
int i;
/* Connect to invalid port.
* In SCTP cases, net_open should be success always
*/
for (i =0 ; i<TEST_MAX_NUM; i++)
{
net_sock[i] = NULL;
rc = net_open(&net_sock[i], "127.0.0.1", 0, TEST_SERVER_PORT + 1,
SOCK_SEQPACKET, IPPROTO_SCTP);
ABTS_INT_EQUAL(tc, 0, rc);
ABTS_PTR_NOTNULL(tc, net_sock[i]);
}
for (i = 0 ; i< TEST_MAX_NUM; i++)
{
rc = net_close(net_sock[i]);
ABTS_INT_EQUAL(tc, 0, rc);
}
/* Start SCTP Server */
start_seq_sctp_server();
for (i =0 ; i<TEST_MAX_NUM; i++)
{
net_sock[i] = NULL;
rc = net_open(&net_sock[i], "127.0.0.1", 0, TEST_SERVER_PORT,
SOCK_SEQPACKET, IPPROTO_SCTP);
ABTS_INT_EQUAL(tc, 0, rc);
ABTS_PTR_NOTNULL(tc, net_sock[i]);
}
for (i=0; i< TEST_MAX_NUM; i++)
{
sprintf(inputbuf[i],"asdf%d",i);
memset(outputbuf[i], 0, sizeof(outputbuf[i]));
rc = net_sendto(net_sock[i], inputbuf[i], strlen(inputbuf[i])+1,
inet_addr("127.0.0.1"), TEST_SERVER_PORT);
ABTS_INT_EQUAL(tc, strlen(inputbuf[i])+1, rc);
rc = 0;
while (1)
{
int n;
n = net_read(net_sock[i], outputbuf[i], sizeof(outputbuf[i]), 1);
if (n < 0 && net_sock[i]->sndrcv_errno == EAGAIN)
continue;
rc += n;
if (n == 0 || n == 6)
break;
}
ABTS_INT_EQUAL(tc, 6, rc);
ABTS_INT_EQUAL(tc, 6, strlen(outputbuf[i])+1);
ABTS_STR_EQUAL(tc, inputbuf[i], outputbuf[i]);
}
for (i = 0 ; i< TEST_MAX_NUM; i++)
{
rc = net_close(net_sock[i]);
ABTS_INT_EQUAL(tc, 0, rc);
}
stop_seq_sctp_server();
}
static void netlib6(abts_case *tc, void *data)
{
int rc;
net_ftp_t *ftp_session = NULL;
@@ -741,7 +442,7 @@ static void filter_updu(char *buf, int len)
}
}
static void netlib7(abts_case *tc, void *data)
static void netlib5(abts_case *tc, void *data)
{
net_link_t *net_link = NULL;
int promisc = 1;
@@ -788,7 +489,7 @@ static int make_test_updu(char *src_addr, char *dst_addr, char *buf, int len)
return rc;
}
static void netlib8(abts_case *tc, void *data)
static void netlib6(abts_case *tc, void *data)
{
net_link_t *net_link = NULL;
int promisc = 1;
@@ -827,14 +528,28 @@ abts_suite *testnetlib(abts_suite *suite)
suite = ADD_SUITE(suite);
abts_run_test(suite, netlib1, NULL);
/*
* OpenSUSE OBS
* - Ubuntu 17.04 i586 failed
* - Jinyoung Fixed
*
[ 542s] testnetlib : Line 262: expected <0>, but saw <-1>
[ 542s] [10/30 07:48:38.730] ERRR: connect error(111:Connection refused)(proto:6 remote:127.0.0.1 dport:5121 lport:0) (net_lib.c:353)
[ 542s] [10/30 07:48:38.730] ERRR: connect error(111:Connection refused)(proto:6 remote:127.0.0.1 dport:5121 lport:0) (net_lib.c:353)
[ 542s] [10/30 07:48:38.730] ERRR: connect error(111:Connection refused)(proto:6 remote:127.0.0.1 dport:5121 lport:0) (net_lib.c:353)
[ 542s] [10/30 07:48:38.730] ERRR: connect error(111:Connection refused)(proto:6 remote:127.0.0.1 dport:5121 lport:0) (net_lib.c:353)
[ 542s] [10/30 07:48:38.730] ASSERT: !(net_sock && buffer). Invalid params
[ 542s] (net_lib.c:590)
[ 542s] [10/30 07:48:38.730] ASSERT: !(net_sock). net_sock is NULL
[ 542s] (net_lib.c:408)
[ 542s] [10/30 07:48:38.730] ASSERT: !(net_sock). net_sock is NULL
*/
abts_run_test(suite, netlib2, NULL);
abts_run_test(suite, netlib3, NULL);
abts_run_test(suite, netlib4, NULL);
#if LINUX == 1
abts_run_test(suite, netlib5, NULL);
abts_run_test(suite, netlib6, NULL);
#if LINUX == 1
abts_run_test(suite, netlib7, NULL);
abts_run_test(suite, netlib8, NULL);
#endif
return suite;

View File

@@ -5,7 +5,7 @@ static void pkbuf_test1(abts_case *tc, void *data)
{
char *ptr = core_malloc(256);
ABTS_PTR_NOTNULL(tc, ptr);
core_free(ptr);
CORE_FREE(ptr);
}
static void pkbuf_test2(abts_case *tc, void *data)
@@ -17,14 +17,14 @@ static void pkbuf_test2(abts_case *tc, void *data)
ABTS_INT_EQUAL(tc, 0, ptr[i]);
}
ABTS_PTR_NOTNULL(tc, ptr);
core_free(ptr);
CORE_FREE(ptr);
}
static void pkbuf_test3(abts_case *tc, void *data)
{
char *ptr = core_realloc(0, 10);
ABTS_PTR_NOTNULL(tc, ptr);
core_free(ptr);
CORE_FREE(ptr);
ptr = core_malloc(20);
ABTS_PTR_NOTNULL(tc, ptr);
@@ -49,7 +49,7 @@ static void pkbuf_test4(abts_case *tc, void *data)
SIZEOF_VOIDP);
ABTS_TRUE(tc, p != q);
ABTS_TRUE(tc, memcmp(p, q, 10) == 0);
core_free(p);
CORE_FREE(p);
}

335
lib/core/test/testsctp.c Normal file
View File

@@ -0,0 +1,335 @@
#include "core_debug.h"
#include "core_thread.h"
#include "core_network.h"
#include "testutil.h"
#define DATASTR "This is a test"
#define STRLEN 8092
#define PORT 7777
#define PORT2 7778
#define PPID 12345
#ifndef AI_PASSIVE
#define AI_PASSIVE 1
#endif
static void sctp_test1(abts_case *tc, void *data)
{
sock_id sctp;
c_sockaddr_t *addr;
status_t rv;
rv = sctp_socket(&sctp, AF_INET6, SOCK_SEQPACKET);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = sock_delete(sctp);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = core_getaddrinfo(&addr, AF_INET, NULL, PORT, AI_PASSIVE);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = sctp_server(&sctp, SOCK_STREAM, addr);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = core_freeaddrinfo(addr);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = sock_delete(sctp);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = core_getaddrinfo(&addr, AF_UNSPEC, NULL, PORT, AI_PASSIVE);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = sctp_server(&sctp, SOCK_SEQPACKET, addr);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = core_freeaddrinfo(addr);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = sock_delete(sctp);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
}
static thread_id test2_thread;
static void *THREAD_FUNC test2_main(thread_id id, void *data)
{
abts_case *tc = data;
status_t rv;
sock_id sctp;
char str[STRLEN];
ssize_t size;
c_uint32_t ppid;
sctp_info_t sinfo;
c_sockaddr_t *addr;
c_sockaddr_t from;
rv = core_getaddrinfo(&addr, AF_UNSPEC, NULL, PORT, 0);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = sctp_client(&sctp, SOCK_SEQPACKET, addr);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = core_freeaddrinfo(addr);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
size = core_sctp_recvdata(sctp, str, STRLEN, &from, &sinfo);
ABTS_INT_EQUAL(tc, strlen(DATASTR), size);
ABTS_INT_EQUAL(tc, PPID, sinfo.ppid);
rv = sock_delete(sctp);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
thread_exit(id, size);
return NULL;
}
static void sctp_test2(abts_case *tc, void *data)
{
status_t rv;
sock_id sctp, sctp2;
ssize_t size;
c_sockaddr_t *addr;
rv = core_getaddrinfo(&addr, AF_INET6, NULL, PORT, AI_PASSIVE);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = sctp_server(&sctp, SOCK_STREAM, addr);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = core_freeaddrinfo(addr);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = thread_create(&test2_thread, NULL, test2_main, tc);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = sock_accept(&sctp2, sctp);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
size = core_sctp_sendmsg(sctp2, DATASTR, strlen(DATASTR), NULL, PPID, 0);
ABTS_INT_EQUAL(tc, strlen(DATASTR), size);
thread_join(&rv, test2_thread);
ABTS_INT_EQUAL(tc, strlen(DATASTR), size);
rv = sock_delete(sctp2);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = sock_delete(sctp);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
}
static thread_id test3_thread;
static void *THREAD_FUNC test3_main(thread_id id, void *data)
{
abts_case *tc = data;
status_t rv;
sock_id sctp;
c_sockaddr_t *addr;
c_sockaddr_t *to;
char str[STRLEN];
ssize_t size;
int rc;
rv = sctp_socket(&sctp, AF_INET, SOCK_SEQPACKET);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = core_getaddrinfo(&to, AF_INET, NULL, PORT, 0);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
size = core_sctp_sendmsg(sctp, DATASTR, strlen(DATASTR), to, PPID, 0);
ABTS_INT_EQUAL(tc, strlen(DATASTR), size);
rv = core_freeaddrinfo(to);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = sock_delete(sctp);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
thread_exit(id, size);
return NULL;
}
static void sctp_test3(abts_case *tc, void *data)
{
sock_id sctp;
status_t rv;
ssize_t size;
c_sockaddr_t from, *addr;
char str[STRLEN];
char buf[CORE_ADDRSTRLEN];
sctp_info_t sinfo;
rv = core_getaddrinfo(&addr, AF_INET, NULL, PORT, AI_PASSIVE);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = sctp_server(&sctp, SOCK_SEQPACKET, addr);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = core_freeaddrinfo(addr);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = thread_create(&test3_thread, NULL, test3_main, tc);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
size = core_sctp_recvdata(sctp, str, STRLEN, &from, &sinfo);
ABTS_INT_EQUAL(tc, strlen(DATASTR), size);
ABTS_INT_EQUAL(tc, PPID, sinfo.ppid);
thread_join(&rv, test3_thread);
ABTS_INT_EQUAL(tc, strlen(DATASTR), rv);
rv = sock_delete(sctp);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
}
static thread_id test4_thread;
static void *THREAD_FUNC test4_main(thread_id id, void *data)
{
abts_case *tc = data;
status_t rv;
sock_id sctp;
c_sockaddr_t *addr;
char str[STRLEN];
ssize_t size;
sctp_info_t sinfo;
rv = core_getaddrinfo(&addr, AF_UNSPEC, NULL, PORT, 0);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = sctp_client(&sctp, SOCK_STREAM, addr);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = core_freeaddrinfo(addr);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
size = core_sctp_sendmsg(sctp, DATASTR, strlen(DATASTR), NULL, PPID, 0);
ABTS_INT_EQUAL(tc, strlen(DATASTR), size);
size = core_sctp_recvdata(sctp, str, STRLEN, NULL, &sinfo);
ABTS_INT_EQUAL(tc, strlen(DATASTR), size);
ABTS_INT_EQUAL(tc, PPID, sinfo.ppid);
rv = sock_delete(sctp);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
thread_exit(id, size);
return NULL;
}
static void sctp_test4(abts_case *tc, void *data)
{
sock_id sctp;
status_t rv;
ssize_t size;
c_sockaddr_t from, *addr;
char str[STRLEN];
sctp_info_t sinfo;
char buf[CORE_ADDRSTRLEN];
rv = core_getaddrinfo(&addr, AF_INET6, NULL, PORT, AI_PASSIVE);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = sctp_server(&sctp, SOCK_SEQPACKET, addr);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = core_freeaddrinfo(addr);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = thread_create(&test4_thread, NULL, test4_main, tc);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
size = core_sctp_recvdata(sctp, str, STRLEN, &from, &sinfo);
ABTS_INT_EQUAL(tc, strlen(DATASTR), size);
ABTS_STR_EQUAL(tc, "::1", CORE_ADDR(&from, buf));
ABTS_INT_EQUAL(tc, PPID, sinfo.ppid);
size = core_sctp_sendmsg(sctp, DATASTR, strlen(DATASTR), &from, PPID, 0);
ABTS_INT_EQUAL(tc, strlen(DATASTR), size);
thread_join(&rv, test4_thread);
ABTS_INT_EQUAL(tc, strlen(DATASTR), rv);
rv = sock_delete(sctp);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
}
static thread_id test5_thread;
static void *THREAD_FUNC test5_main(thread_id id, void *data)
{
abts_case *tc = data;
status_t rv;
sock_id sctp;
char str[STRLEN];
c_sockaddr_t from, *remote_addr, *addr;
sctp_info_t sinfo;
ssize_t size;
char buf[CORE_ADDRSTRLEN];
rv = core_getaddrinfo(&addr, AF_INET6, NULL, PORT2, AI_PASSIVE);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = sctp_server(&sctp, SOCK_SEQPACKET, addr);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = core_freeaddrinfo(addr);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = core_getaddrinfo(&addr, AF_INET6, NULL, PORT, 0);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = sctp_connect(sctp, addr);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = core_freeaddrinfo(addr);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
remote_addr = sock_remote_addr(sctp);
ABTS_STR_EQUAL(tc, "::1", CORE_ADDR(remote_addr, buf));
size = core_sctp_sendmsg(sctp, DATASTR, strlen(DATASTR),
remote_addr, PPID, 0);
ABTS_INT_EQUAL(tc, strlen(DATASTR), size);
size = core_sctp_recvdata(sctp, str, STRLEN, &from, &sinfo);
ABTS_INT_EQUAL(tc, strlen(DATASTR), size);
ABTS_STR_EQUAL(tc, "::1", CORE_ADDR(&from, buf));
ABTS_INT_EQUAL(tc, PPID, sinfo.ppid);
rv = sock_delete(sctp);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
thread_exit(id, size);
return NULL;
}
static void sctp_test5(abts_case *tc, void *data)
{
sock_id sctp;
status_t rv;
ssize_t size;
c_sockaddr_t from, *addr;
socklen_t addrlen;
char str[STRLEN];
sctp_info_t sinfo;
char buf[CORE_ADDRSTRLEN];
rv = core_getaddrinfo(&addr, AF_INET6, NULL, PORT, AI_PASSIVE);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = sctp_server(&sctp, SOCK_SEQPACKET, addr);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = core_freeaddrinfo(addr);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = thread_create(&test5_thread, NULL, test5_main, tc);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
size = core_sctp_recvdata(sctp, str, STRLEN, &from, &sinfo);
ABTS_INT_EQUAL(tc, strlen(DATASTR), size);
ABTS_STR_EQUAL(tc, "::1", CORE_ADDR(&from, buf));
ABTS_INT_EQUAL(tc, PPID, sinfo.ppid);
size = core_sctp_sendmsg(sctp, DATASTR, strlen(DATASTR), &from,
sinfo.ppid, 0);
ABTS_INT_EQUAL(tc, strlen(DATASTR), size);
thread_join(&rv, test5_thread);
ABTS_INT_EQUAL(tc, strlen(DATASTR), rv);
rv = sock_delete(sctp);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
}
abts_suite *testsctp(abts_suite *suite)
{
suite = ADD_SUITE(suite);
abts_run_test(suite, sctp_test1, NULL);
abts_run_test(suite, sctp_test2, NULL);
abts_run_test(suite, sctp_test3, NULL);
abts_run_test(suite, sctp_test4, NULL);
abts_run_test(suite, sctp_test5, NULL);
return suite;
}

458
lib/core/test/testsock.c Normal file
View File

@@ -0,0 +1,458 @@
#include "core_debug.h"
#include "core_thread.h"
#include "core_pkbuf.h"
#include "core_network.h"
#include "testutil.h"
#define DATASTR "This is a test"
#define STRLEN 8092
#define PORT 7777
#define PORT2 7778
#ifndef AI_PASSIVE
#define AI_PASSIVE 1
#endif
static void sock_test1(abts_case *tc, void *data)
{
sock_id udp;
c_sockaddr_t *addr;
status_t rv;
rv = core_getaddrinfo(&addr, AF_UNSPEC, NULL, PORT, AI_PASSIVE);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = udp_server(&udp, addr);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = core_freeaddrinfo(addr);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = sock_delete(udp);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = core_getaddrinfo(&addr, AF_UNSPEC, "127.0.0.1", PORT, AI_PASSIVE);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = udp_server(&udp, addr);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = core_freeaddrinfo(addr);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = sock_delete(udp);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = core_getaddrinfo(&addr, AF_UNSPEC, "::1", PORT, AI_PASSIVE);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = udp_server(&udp, addr);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = core_freeaddrinfo(addr);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = sock_delete(udp);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
}
static thread_id test2_thread;
static void *THREAD_FUNC test2_main(thread_id id, void *data)
{
abts_case *tc = data;
status_t rv;
sock_id tcp;
c_sockaddr_t *addr;
char str[STRLEN];
ssize_t size;
rv = core_getaddrinfo(&addr, AF_UNSPEC, "::1", PORT, AI_PASSIVE);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = tcp_client(&tcp, addr);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = core_freeaddrinfo(addr);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
size = core_recv(tcp, str, STRLEN, 0);
ABTS_INT_EQUAL(tc, strlen(DATASTR), size);
rv = sock_delete(tcp);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
thread_exit(id, size);
return NULL;
}
static void sock_test2(abts_case *tc, void *data)
{
status_t rv;
sock_id tcp, tcp2;
c_sockaddr_t *addr;
ssize_t size;
rv = core_getaddrinfo(&addr, AF_INET6, NULL, PORT, AI_PASSIVE);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = tcp_server(&tcp, addr);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = core_freeaddrinfo(addr);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = thread_create(&test2_thread, NULL, test2_main, tc);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = sock_accept(&tcp2, tcp);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
size = core_send(tcp2, DATASTR, strlen(DATASTR), 0);
ABTS_INT_EQUAL(tc, strlen(DATASTR), size);
thread_join(&rv, test2_thread);
ABTS_INT_EQUAL(tc, strlen(DATASTR), rv);
rv = sock_delete(tcp2);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = sock_delete(tcp);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
}
static thread_id test3_thread;
static void *THREAD_FUNC test3_main(thread_id id, void *data)
{
abts_case *tc = data;
status_t rv;
sock_id udp;
c_sockaddr_t *sa;
char str[STRLEN];
ssize_t size;
int rc;
char buf[CORE_ADDRSTRLEN];
rv = udp_socket(&udp, AF_INET);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = core_getaddrinfo(&sa, AF_INET, NULL, PORT, 0);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
size = core_sendto(udp, DATASTR, strlen(DATASTR), 0, sa);
ABTS_INT_EQUAL(tc, strlen(DATASTR), size);
rv = core_freeaddrinfo(sa);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = sock_delete(udp);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
thread_exit(id, size);
return NULL;
}
static void sock_test3(abts_case *tc, void *data)
{
sock_id udp;
status_t rv;
ssize_t size;
c_sockaddr_t sa, *addr;
socklen_t addrlen;
char str[STRLEN];
char buf[CORE_ADDRSTRLEN];
rv = core_getaddrinfo(&addr, AF_INET, NULL, PORT, AI_PASSIVE);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = udp_server(&udp, addr);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = core_freeaddrinfo(addr);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = thread_create(&test3_thread, NULL, test3_main, tc);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
size = core_recvfrom(udp, str, STRLEN, 0, &sa);
ABTS_INT_EQUAL(tc, strlen(DATASTR), size);
ABTS_STR_EQUAL(tc, "127.0.0.1", CORE_ADDR(&sa, buf));
thread_join(&rv, test3_thread);
ABTS_INT_EQUAL(tc, strlen(DATASTR), rv);
rv = sock_delete(udp);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
}
static thread_id test4_thread;
static void *THREAD_FUNC test4_main(thread_id id, void *data)
{
abts_case *tc = data;
status_t rv;
sock_id udp;
c_sockaddr_t *addr;
char str[STRLEN];
ssize_t size;
rv = core_getaddrinfo(&addr, AF_INET, NULL, PORT, 0);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = udp_client(&udp, addr);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = core_freeaddrinfo(addr);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
size = core_send(udp, DATASTR, strlen(DATASTR), 0);
ABTS_INT_EQUAL(tc, strlen(DATASTR), size);
size = core_recv(udp, str, STRLEN, 0);
ABTS_INT_EQUAL(tc, strlen(DATASTR), size);
rv = sock_delete(udp);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
thread_exit(id, size);
return NULL;
}
static void sock_test4(abts_case *tc, void *data)
{
sock_id udp;
status_t rv;
ssize_t size;
c_sockaddr_t sa, *addr;
socklen_t addrlen;
char str[STRLEN];
char buf[CORE_ADDRSTRLEN];
rv = core_getaddrinfo(&addr, AF_INET, NULL, PORT, AI_PASSIVE);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = udp_server(&udp, addr);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = core_freeaddrinfo(addr);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = thread_create(&test4_thread, NULL, test4_main, tc);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
size = core_recvfrom(udp, str, STRLEN, 0, &sa);
ABTS_INT_EQUAL(tc, strlen(DATASTR), size);
ABTS_STR_EQUAL(tc, "127.0.0.1", CORE_ADDR(&sa, buf));
size = core_sendto(udp, DATASTR, strlen(DATASTR), 0, &sa);
ABTS_INT_EQUAL(tc, strlen(DATASTR), size);
thread_join(&rv, test4_thread);
ABTS_INT_EQUAL(tc, strlen(DATASTR), rv);
rv = sock_delete(udp);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
}
static thread_id test5_thread;
static void *THREAD_FUNC test5_main(thread_id id, void *data)
{
abts_case *tc = data;
status_t rv;
sock_id udp;
c_sockaddr_t *addr;
char str[STRLEN];
ssize_t size;
rv = core_getaddrinfo(&addr, AF_INET6, NULL, PORT2, AI_PASSIVE);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = udp_server(&udp, addr);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = core_freeaddrinfo(addr);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = core_getaddrinfo(&addr, AF_INET6, NULL, PORT, 0);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = udp_connect(udp, addr);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = core_freeaddrinfo(addr);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
size = core_send(udp, DATASTR, strlen(DATASTR), 0);
ABTS_INT_EQUAL(tc, strlen(DATASTR), size);
size = core_recv(udp, str, STRLEN, 0);
ABTS_INT_EQUAL(tc, strlen(DATASTR), size);
rv = sock_delete(udp);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
thread_exit(id, size);
return NULL;
}
static void sock_test5(abts_case *tc, void *data)
{
sock_id udp;
status_t rv;
ssize_t size;
c_sockaddr_t sa, *addr;
socklen_t addrlen;
char str[STRLEN];
char buf[CORE_ADDRSTRLEN];
rv = core_getaddrinfo(&addr, AF_INET6, NULL, PORT, AI_PASSIVE);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = udp_server(&udp, addr);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = core_freeaddrinfo(addr);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = core_getaddrinfo(&addr, AF_INET6, NULL, PORT2, 0);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = udp_connect(udp, addr);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = core_freeaddrinfo(addr);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = thread_create(&test5_thread, NULL, test5_main, tc);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
size = core_recvfrom(udp, str, STRLEN, 0, &sa);
ABTS_INT_EQUAL(tc, strlen(DATASTR), size);
ABTS_STR_EQUAL(tc, "::1", CORE_ADDR(&sa, buf));
size = core_send(udp, DATASTR, strlen(DATASTR), 0);
ABTS_INT_EQUAL(tc, strlen(DATASTR), size);
thread_join(&rv, test5_thread);
ABTS_INT_EQUAL(tc, strlen(DATASTR), rv);
rv = sock_delete(udp);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
}
static void sock_test6(abts_case *tc, void *data)
{
c_sockaddr_t addr, *paddr, *dst;
char buf[CORE_ADDRSTRLEN];
status_t rv;
rv = core_inet_pton(AF_INET, "127.0.0.1", &addr);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
ABTS_STR_EQUAL(tc, "127.0.0.1", CORE_ADDR(&addr, buf));
rv = core_inet_pton(AF_INET6, "::1", &addr);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
ABTS_STR_EQUAL(tc, "::1", CORE_ADDR(&addr, buf));
paddr = NULL;
rv = core_addaddrinfo(&paddr, AF_UNSPEC, NULL, PORT, 0);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = core_sortaddrinfo(&paddr, AF_INET6);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
ABTS_STR_EQUAL(tc, "::1", CORE_ADDR(paddr, buf));
ABTS_PTR_NOTNULL(tc, paddr->next);
ABTS_STR_EQUAL(tc, "127.0.0.1", CORE_ADDR(paddr->next, buf));
rv = core_copyaddrinfo(&dst, paddr);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
ABTS_STR_EQUAL(tc, "::1", CORE_ADDR(dst, buf));
ABTS_PTR_NOTNULL(tc, paddr->next);
ABTS_STR_EQUAL(tc, "127.0.0.1", CORE_ADDR(dst->next, buf));
rv = core_freeaddrinfo(dst);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = core_sortaddrinfo(&paddr, AF_INET);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
ABTS_STR_EQUAL(tc, "127.0.0.1", CORE_ADDR(paddr, buf));
ABTS_PTR_NOTNULL(tc, paddr->next);
ABTS_STR_EQUAL(tc, "::1", CORE_ADDR(paddr->next, buf));
rv = core_filteraddrinfo(&paddr, AF_INET);
ABTS_PTR_NOTNULL(tc, paddr);
ABTS_STR_EQUAL(tc, "127.0.0.1", CORE_ADDR(paddr, buf));
rv = core_copyaddrinfo(&dst, paddr);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
ABTS_STR_EQUAL(tc, "127.0.0.1", CORE_ADDR(dst, buf));
rv = core_addaddrinfo(&dst, AF_UNSPEC, NULL, PORT, 0);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
ABTS_STR_EQUAL(tc, "127.0.0.1", CORE_ADDR(dst, buf));
rv = core_freeaddrinfo(dst);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = core_filteraddrinfo(&paddr, AF_INET6);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
ABTS_PTR_NULL(tc, paddr);
rv = core_copyaddrinfo(&dst, paddr);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
ABTS_PTR_NULL(tc, dst);
paddr = NULL;
rv = core_addaddrinfo(&paddr, AF_INET, "127.0.0.1", PORT, 0);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = core_addaddrinfo(&paddr, AF_INET, "127.0.0.2", PORT, 0);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = core_addaddrinfo(&paddr, AF_INET, "127.0.0.3", PORT, 0);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = core_filteraddrinfo(&paddr, AF_INET6);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
}
static void sock_test7(abts_case *tc, void *data)
{
status_t rv;
sock_node_t *node;
c_sockaddr_t *addr;
list_t list, list6;
list_init(&list);
list_init(&list6);
rv = core_getaddrinfo(&addr, AF_UNSPEC, "localhost", PORT, 0);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = sock_add_node(&list, &node, addr, AF_INET);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
core_freeaddrinfo(addr);
sock_remove_all_nodes(&list);
rv = sock_probe_node(&list, &list6, NULL, PORT);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
sock_remove_all_nodes(&list);
sock_remove_all_nodes(&list6);
}
static void sock_test8(abts_case *tc, void *data)
{
status_t rv;
ipsubnet_t ipsub;
rv = core_ipsubnet(&ipsub, "127.0.0.1", "8");
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = core_ipsubnet(&ipsub, "fe80::1", "64");
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = core_ipsubnet(&ipsub, "172.16.0.1", "16");
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = core_ipsubnet(&ipsub, "cafe::1", "64");
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = core_ipsubnet(&ipsub, "172.16.0.1", NULL);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
rv = core_ipsubnet(&ipsub, "cafe::1", NULL);
ABTS_INT_EQUAL(tc, CORE_OK, rv);
}
abts_suite *testsock(abts_suite *suite)
{
suite = ADD_SUITE(suite)
abts_run_test(suite, sock_test1, NULL);
abts_run_test(suite, sock_test2, NULL);
abts_run_test(suite, sock_test3, NULL);
abts_run_test(suite, sock_test4, NULL);
abts_run_test(suite, sock_test5, NULL);
abts_run_test(suite, sock_test6, NULL);
abts_run_test(suite, sock_test7, NULL);
abts_run_test(suite, sock_test8, NULL);
return suite;
}

View File

@@ -378,6 +378,15 @@ abts_suite *testtimer(abts_suite *suite)
{
suite = ADD_SUITE(suite)
/*
* OpenSUSE OBS
* - Ubuntu 16.10 i586 failed
* - It is probably VM issue
* [ 661s] testtimer : Line 176: expected <1449351760>, but saw <0>
* [ 661s] Line 305: expected <1019>, but saw <1024>
* [ 661s] Line 372: expected <1019>, but saw <1024>
* [ 661s] FAILED 3 of 4
*/
abts_run_test(suite, test_now, NULL);
abts_run_test(suite, timer_test_1, NULL);
abts_run_test(suite, timer_test_2, NULL);

View File

@@ -62,7 +62,8 @@ abts_suite *testfsm(abts_suite *suite);
abts_suite *testtlv(abts_suite *suite);
abts_suite *testaes(abts_suite *suite);
abts_suite *testsha2(abts_suite *suite);
abts_suite *testnetlib(abts_suite *suite);
abts_suite *testsock(abts_suite *suite);
abts_suite *testsctp(abts_suite *suite);
abts_suite *testtime(abts_suite *suite);
abts_suite *testtimer(abts_suite *suite);
abts_suite *testthread(abts_suite *suite);
@@ -76,5 +77,6 @@ abts_suite *testsleep(abts_suite *suite);
abts_suite *testpkbuf(abts_suite *suite);
abts_suite *testmisc(abts_suite *suite);
abts_suite *testhash(abts_suite *suite);
abts_suite *test3gpp(abts_suite *suite);
#endif /* CORE_TEST_INCLUDES */

View File

@@ -1,27 +1,45 @@
## Process this file with automake to produce Makefile.in
SUBDIRS = extensions gx s6a
noinst_LTLIBRARIES = libfd.la
pkglib_LTLIBRARIES = libfd.la
libfd_la_SOURCES = \
fd_message.h fd_logger.h fd_lib.h \
libapp_sip.c fd_message.c fd_logger.c fd_init.c
libapp_sip.c fd_message.c fd_logger.c fd_config.c fd_init.c \
\
s6a/s6a_dict.h s6a/s6a_message.h \
s6a/dict_init.c \
\
gx/gx_dict.h gx/gx_message.h \
gx/dict_init.c gx/gx_message.c \
\
rx/rx_dict.h rx/rx_message.h \
rx/dict_init.c rx/rx_message.c \
$(NULL)
libfd_la_DEPENDENCIES = \
$(top_srcdir)/lib/core/src/libcore.la \
$(top_srcdir)/lib/@FREEDIAMETER_DIR@/libfdcore/libfdcore.la \
$(top_srcdir)/lib/@FREEDIAMETER_DIR@/libfdproto/libfdproto.la
$(top_srcdir)/lib/@FREEDIAMETER_DIR@/libfdproto/libfdproto.la \
$(NULL)
libfd_la_LIBADD = \
$(top_srcdir)/lib/core/src/libcore.la \
$(top_srcdir)/lib/@FREEDIAMETER_DIR@/libfdcore/libfdcore.la \
$(top_srcdir)/lib/@FREEDIAMETER_DIR@/libfdproto/libfdproto.la
$(top_srcdir)/lib/@FREEDIAMETER_DIR@/libfdproto/libfdproto.la \
$(NULL)
AM_LDFLAGS = \
-version-info @LIBVERSION@ \
$(NULL)
AM_CPPFLAGS = \
-I$(top_srcdir)/lib/core/include \
-I$(top_srcdir)/lib/@FREEDIAMETER_DIR@/include
-I$(top_srcdir)/lib/@FREEDIAMETER_DIR@/include \
$(NULL)
AM_CFLAGS = \
-Wall -Werror
-Wall -Werror \
$(NULL)
MAINTAINERCLEANFILES = Makefile.in
MOSTLYCLEANFILES = *.stackdump

View File

@@ -1,18 +0,0 @@
## Process this file with automake to produce Makefile.in
pkglib_LTLIBRARIES = dbg_msg_dumps.la
dbg_msg_dumps_la_SOURCES = \
dbg_msg_dumps.c
AM_LDFLAGS = \
-module -avoid-version -shared
AM_CPPFLAGS = \
-I$(top_srcdir)/lib/@FREEDIAMETER_DIR@/include
AM_CFLAGS = \
-Wall -Werror
MAINTAINERCLEANFILES = Makefile.in
MOSTLYCLEANFILES = *.stackdump

View File

@@ -1,395 +0,0 @@
/*********************************************************************************************************
* Software License Agreement (BSD License) *
* Author: Sebastien Decugis <sdecugis@freediameter.net> *
* *
* Copyright (c) 2013, WIDE Project and NICT *
* All rights reserved. *
* *
* Redistribution and use of this software in source and binary forms, with or without modification, are *
* permitted provided that the following conditions are met: *
* *
* * Redistributions of source code must retain the above *
* copyright notice, this list of conditions and the *
* following disclaimer. *
* *
* * Redistributions in binary form must reproduce the above *
* copyright notice, this list of conditions and the *
* following disclaimer in the documentation and/or other *
* materials provided with the distribution. *
* *
* * Neither the name of the WIDE Project or NICT nor the *
* names of its contributors may be used to endorse or *
* promote products derived from this software without *
* specific prior written permission of WIDE Project and *
* NICT. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED *
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS *
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR *
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF *
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
*********************************************************************************************************/
/* This extension uses the hooks mechanism to display the full content of received and sent messages, for
learning & debugging purpose.
Do NOT use this extension in production environment because it will slow down all operation. */
/* You can add a configuration parameter on the LoadExtension line, e.g.
LoadExtension="dbg_msg_dump.fdx":"0x149";
The value is an hexadecimal value with the following bits meaning: */
#define HK_ERRORS_QUIET 0x0001 /* errors are not dumped -- removes the default handling as well */
#define HK_ERRORS_COMPACT 0x0002 /* errors in compact mode */
#define HK_ERRORS_FULL 0x0004 /* errors in full mode (1 line with all the data) */
#define HK_ERRORS_TREE 0x0008 /* errors in treeview mode (message split over multiple lines) */
#define HK_SNDRCV_QUIET 0x0010 /* send+rcv are not dumped -- removes the default handling as well */
#define HK_SNDRCV_COMPACT 0x0020 /* send+rcv in compact mode */
#define HK_SNDRCV_FULL 0x0040 /* send+rcv in full mode */
#define HK_SNDRCV_TREE 0x0080 /* send+rcv in tree mode */
#define HK_ROUTING_QUIET 0x0100 /* routing decisions are not dumped -- removes the default handling as well */
#define HK_ROUTING_COMPACT 0x0200 /* routing decisions in compact mode */
#define HK_ROUTING_FULL 0x0400 /* routing decisions in full mode */
#define HK_ROUTING_TREE 0x0800 /* routing decisions in tree mode */
#define HK_PEERS_QUIET 0x1000 /* peers connections events are not dumped -- removes the default handling as well */
#define HK_PEERS_COMPACT 0x2000 /* peers connections events in compact mode */
#define HK_PEERS_FULL 0x4000 /* peers connections events in full mode */
#define HK_PEERS_TREE 0x8000 /* peers connections events in tree mode */
/*
Default value is HK_ERRORS_TREE + HK_SNDRCV_TREE + HK_PEERS_TREE
*/
#include <freeDiameter/extension.h>
static struct fd_hook_hdl *md_hdl[4] = {NULL,NULL,NULL,NULL};
static uint32_t dump_level = HK_ERRORS_TREE | HK_SNDRCV_TREE | HK_PEERS_TREE; /* default */
static char * buf = NULL;
static size_t len;
static pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER;
/* The callback called when messages are received and sent */
static void md_hook_cb_tree(enum fd_hook_type type, struct msg * msg, struct peer_hdr * peer, void * other, struct fd_hook_permsgdata *pmd, void * regdata)
{
char * peer_name = peer ? peer->info.pi_diamid : "<unknown peer>";
CHECK_POSIX_DO( pthread_mutex_lock(&mtx), );
if (msg) {
CHECK_MALLOC_DO( fd_msg_dump_treeview(&buf, &len, NULL, msg, fd_g_config->cnf_dict, (type == HOOK_MESSAGE_PARSING_ERROR) ? 0 : 1, 1),
{ LOG_E("Error while dumping a message"); pthread_mutex_unlock(&mtx); return; } );
}
switch (type) {
/* errors */
case HOOK_MESSAGE_FAILOVER:
LOG_E("FAILOVER from '%s':", peer_name);
LOG_SPLIT(FD_LOG_ERROR, " ", buf, NULL);
break;
case HOOK_MESSAGE_PARSING_ERROR:
if (msg) {
DiamId_t id = NULL;
if (!fd_msg_source_get( msg, &id, NULL ))
id = (DiamId_t)"<error getting source>";
if (!id)
id = (DiamId_t)"<local>";
LOG_E("PARSING ERROR: '%s' from '%s': ", (char *)other, (char *)id);
LOG_SPLIT(FD_LOG_ERROR, " ", buf, NULL);
} else {
struct fd_cnx_rcvdata *rcv_data = other;
CHECK_MALLOC_DO(fd_dump_extend_hexdump(&buf, &len, NULL, rcv_data->buffer, rcv_data->length, 0, 0), break);
LOG_E("PARSING ERROR: %zdB msg from '%s': %s", rcv_data->length, peer_name, buf);
}
break;
case HOOK_MESSAGE_ROUTING_ERROR:
LOG_E("ROUTING ERROR '%s' for: ", (char *)other);
LOG_SPLIT(FD_LOG_ERROR, " ", buf, NULL);
break;
case HOOK_MESSAGE_DROPPED:
LOG_E("DROPPED '%s'", (char *)other);
LOG_SPLIT(FD_LOG_ERROR, " ", buf, NULL);
break;
/* send receive */
case HOOK_MESSAGE_RECEIVED:
LOG_N("RCV from '%s':", peer_name);
LOG_SPLIT(FD_LOG_NOTICE, " ", buf, NULL);
break;
case HOOK_MESSAGE_SENT:
LOG_N("SND to '%s':", peer_name);
LOG_SPLIT(FD_LOG_NOTICE, " ", buf, NULL);
break;
/* routing */
case HOOK_MESSAGE_LOCAL:
LOG_N("ISSUED:");
LOG_SPLIT(FD_LOG_NOTICE, " ", buf, NULL);
break;
case HOOK_MESSAGE_ROUTING_FORWARD:
LOG_N("FORWARDING: %s", buf);
LOG_SPLIT(FD_LOG_NOTICE, " ", buf, NULL);
break;
case HOOK_MESSAGE_ROUTING_LOCAL:
LOG_N("DISPATCHING: %s", buf);
LOG_SPLIT(FD_LOG_NOTICE, " ", buf, NULL);
break;
/* peers */
case HOOK_PEER_CONNECT_FAILED:
LOG_N("CONNECT FAILED to %s: %s", peer_name, (char *)other);
break;
case HOOK_PEER_CONNECT_SUCCESS:
{
char protobuf[40];
if (peer) {
CHECK_FCT_DO(fd_peer_cnx_proto_info(peer, protobuf, sizeof(protobuf)), break );
} else {
protobuf[0] = '-';
protobuf[1] = '\0';
}
LOG_N("CONNECTED TO '%s' (%s):", peer_name, protobuf);
LOG_SPLIT(FD_LOG_NOTICE, " ", buf, NULL);
}
break;
/* Not handled */
default:
break;
}
CHECK_POSIX_DO( pthread_mutex_unlock(&mtx), );
}
static void md_hook_cb_full(enum fd_hook_type type, struct msg * msg, struct peer_hdr * peer, void * other, struct fd_hook_permsgdata *pmd, void * regdata)
{
char * peer_name = peer ? peer->info.pi_diamid : "<unknown peer>";
CHECK_POSIX_DO( pthread_mutex_lock(&mtx), );
if (msg) {
CHECK_MALLOC_DO( fd_msg_dump_full(&buf, &len, NULL, msg, fd_g_config->cnf_dict, (type == HOOK_MESSAGE_PARSING_ERROR) ? 0 : 1, 1),
{ LOG_E("Error while dumping a message"); pthread_mutex_unlock(&mtx); return; } );
}
switch (type) {
/* errors */
case HOOK_MESSAGE_FAILOVER:
LOG_E("FAILOVER from '%s': %s", peer_name, buf);
break;
case HOOK_MESSAGE_PARSING_ERROR:
if (msg) {
DiamId_t id = NULL;
if (!fd_msg_source_get( msg, &id, NULL ))
id = (DiamId_t)"<error getting source>";
if (!id)
id = (DiamId_t)"<local>";
LOG_E("PARSING ERROR: '%s' from '%s': %s", (char *)other, (char *)id, buf);
} else {
struct fd_cnx_rcvdata *rcv_data = other;
CHECK_MALLOC_DO(fd_dump_extend_hexdump(&buf, &len, NULL, rcv_data->buffer, rcv_data->length, 0, 0), break);
LOG_E("PARSING ERROR: %zdB msg from '%s': %s", rcv_data->length, peer_name, buf);
}
break;
case HOOK_MESSAGE_ROUTING_ERROR:
LOG_E("ROUTING ERROR '%s' for: %s", (char *)other, buf);
break;
case HOOK_MESSAGE_DROPPED:
LOG_E("DROPPED '%s' %s", (char *)other, buf);
break;
/* send receive */
case HOOK_MESSAGE_RECEIVED:
LOG_N("RCV from '%s': %s", peer_name, buf);
break;
case HOOK_MESSAGE_SENT:
LOG_N("SND to '%s': %s", peer_name, buf);
break;
/* routing */
case HOOK_MESSAGE_LOCAL:
LOG_N("ISSUED: %s", buf);
break;
case HOOK_MESSAGE_ROUTING_FORWARD:
LOG_N("FORWARDING: %s", buf);
break;
case HOOK_MESSAGE_ROUTING_LOCAL:
LOG_N("DISPATCHING: %s", buf);
break;
/* peers */
case HOOK_PEER_CONNECT_FAILED:
LOG_N("CONNECT FAILED to %s: %s", peer_name, (char *)other);
break;
case HOOK_PEER_CONNECT_SUCCESS: {
char protobuf[40];
if (peer) {
CHECK_FCT_DO(fd_peer_cnx_proto_info(peer, protobuf, sizeof(protobuf)), break );
} else {
protobuf[0] = '-';
protobuf[1] = '\0';
}
LOG_N("CONNECTED TO '%s' (%s): %s", peer_name, protobuf, buf);
}
break;
/* Not handled */
default:
break;
}
CHECK_POSIX_DO( pthread_mutex_unlock(&mtx), );
}
static void md_hook_cb_compact(enum fd_hook_type type, struct msg * msg, struct peer_hdr * peer, void * other, struct fd_hook_permsgdata *pmd, void * regdata)
{
char * peer_name = peer ? peer->info.pi_diamid : "<unknown peer>";
CHECK_POSIX_DO( pthread_mutex_lock(&mtx), );
if (msg) {
CHECK_MALLOC_DO( fd_msg_dump_summary(&buf, &len, NULL, msg, fd_g_config->cnf_dict, 0, 0),
{ LOG_E("Error while dumping a message"); pthread_mutex_unlock(&mtx); return; } );
}
switch (type) {
/* errors */
case HOOK_MESSAGE_FAILOVER:
LOG_E("FAILOVER from '%s': %s", peer_name, buf);
break;
case HOOK_MESSAGE_PARSING_ERROR:
if (msg) {
DiamId_t id = NULL;
if (!fd_msg_source_get( msg, &id, NULL ))
id = (DiamId_t)"<error getting source>";
if (!id)
id = (DiamId_t)"<local>";
LOG_E("PARSING ERROR: '%s' from '%s': %s", (char *)other, (char *)id, buf);
} else {
struct fd_cnx_rcvdata *rcv_data = other;
CHECK_MALLOC_DO(fd_dump_extend_hexdump(&buf, &len, NULL, rcv_data->buffer, rcv_data->length, 0, 0), break);
LOG_E("PARSING ERROR: %zdB msg from '%s': %s", rcv_data->length, peer_name, buf);
}
break;
case HOOK_MESSAGE_ROUTING_ERROR:
LOG_E("ROUTING ERROR '%s' for: %s", (char *)other, buf);
break;
case HOOK_MESSAGE_DROPPED:
LOG_E("DROPPED '%s' %s", (char *)other, buf);
break;
/* send receive */
case HOOK_MESSAGE_RECEIVED:
LOG_N("RCV from '%s': %s", peer_name, buf);
break;
case HOOK_MESSAGE_SENT:
LOG_N("SND to '%s': %s", peer_name, buf);
break;
/* routing */
case HOOK_MESSAGE_LOCAL:
LOG_N("ISSUED: %s", buf);
break;
case HOOK_MESSAGE_ROUTING_FORWARD:
LOG_N("FORWARDING: %s", buf);
break;
case HOOK_MESSAGE_ROUTING_LOCAL:
LOG_N("DISPATCHING: %s", buf);
break;
/* peers */
case HOOK_PEER_CONNECT_FAILED:
LOG_N("CONNECT FAILED to %s: %s", peer_name, (char *)other);
break;
case HOOK_PEER_CONNECT_SUCCESS: {
char protobuf[40];
if (peer) {
CHECK_FCT_DO(fd_peer_cnx_proto_info(peer, protobuf, sizeof(protobuf)), break );
} else {
protobuf[0] = '-';
protobuf[1] = '\0';
}
LOG_N("CONNECTED TO '%s' (%s)", peer_name, protobuf);
}
break;
/* Not handled */
default:
break;
}
CHECK_POSIX_DO( pthread_mutex_unlock(&mtx), );
}
static void md_hook_cb_quiet(enum fd_hook_type type, struct msg * msg, struct peer_hdr * peer, void * other, struct fd_hook_permsgdata *pmd, void * regdata)
{
}
/* Entry point */
static int md_main(char * conffile)
{
uint32_t mask_errors, mask_sndrcv, mask_routing, mask_peers;
uint32_t mask_quiet, mask_compact, mask_full, mask_tree;
TRACE_ENTRY("%p", conffile);
if (conffile != NULL) {
char * endp;
dump_level = (uint32_t)strtoul(conffile, &endp, 16);
CHECK_PARAMS_DO( *endp == '\0', {
LOG_E("Configuration parameter must be in the form \"0xNNNN\"");
return EINVAL; });
}
mask_errors = HOOK_MASK( HOOK_MESSAGE_FAILOVER, HOOK_MESSAGE_PARSING_ERROR, HOOK_MESSAGE_ROUTING_ERROR, HOOK_MESSAGE_DROPPED );
mask_sndrcv = HOOK_MASK( HOOK_MESSAGE_RECEIVED, HOOK_MESSAGE_SENT );
mask_routing= HOOK_MASK( HOOK_MESSAGE_LOCAL, HOOK_MESSAGE_ROUTING_FORWARD, HOOK_MESSAGE_ROUTING_LOCAL );
mask_peers = HOOK_MASK( HOOK_PEER_CONNECT_FAILED, HOOK_PEER_CONNECT_SUCCESS );
mask_quiet = (dump_level & HK_ERRORS_QUIET) ? mask_errors : 0;
mask_quiet |= (dump_level & HK_SNDRCV_QUIET) ? mask_sndrcv : 0;
mask_quiet |= (dump_level & HK_ROUTING_QUIET) ? mask_routing : 0;
mask_quiet |= (dump_level & HK_PEERS_QUIET) ? mask_peers : 0;
mask_compact = (dump_level & HK_ERRORS_COMPACT) ? mask_errors : 0;
mask_compact |= (dump_level & HK_SNDRCV_COMPACT) ? mask_sndrcv : 0;
mask_compact |= (dump_level & HK_ROUTING_COMPACT) ? mask_routing : 0;
mask_compact |= (dump_level & HK_PEERS_COMPACT) ? mask_peers : 0;
mask_full = (dump_level & HK_ERRORS_FULL) ? mask_errors : 0;
mask_full |= (dump_level & HK_SNDRCV_FULL) ? mask_sndrcv : 0;
mask_full |= (dump_level & HK_ROUTING_FULL) ? mask_routing : 0;
mask_full |= (dump_level & HK_PEERS_FULL) ? mask_peers : 0;
mask_tree = (dump_level & HK_ERRORS_TREE) ? mask_errors : 0;
mask_tree |= (dump_level & HK_SNDRCV_TREE) ? mask_sndrcv : 0;
mask_tree |= (dump_level & HK_ROUTING_TREE) ? mask_routing : 0;
mask_tree |= (dump_level & HK_PEERS_TREE) ? mask_peers : 0;
if (mask_quiet) {
CHECK_FCT( fd_hook_register( mask_quiet, md_hook_cb_quiet, NULL, NULL, &md_hdl[0]) );
}
if (mask_compact) {
CHECK_FCT( fd_hook_register( mask_compact, md_hook_cb_compact, NULL, NULL, &md_hdl[1]) );
}
if (mask_full) {
CHECK_FCT( fd_hook_register( mask_full, md_hook_cb_full, NULL, NULL, &md_hdl[2]) );
}
if (mask_tree) {
CHECK_FCT( fd_hook_register( mask_tree, md_hook_cb_tree, NULL, NULL, &md_hdl[3]) );
}
return 0;
}
/* Cleanup */
void fd_ext_fini(void)
{
TRACE_ENTRY();
if (md_hdl[0]) { CHECK_FCT_DO( fd_hook_unregister( md_hdl[0] ), ); }
if (md_hdl[1]) { CHECK_FCT_DO( fd_hook_unregister( md_hdl[1] ), ); }
if (md_hdl[2]) { CHECK_FCT_DO( fd_hook_unregister( md_hdl[2] ), ); }
if (md_hdl[2]) { CHECK_FCT_DO( fd_hook_unregister( md_hdl[3] ), ); }
return ;
}
EXTENSION_ENTRY("dbg_msg_dumps", md_main);

View File

@@ -1,18 +0,0 @@
## Process this file with automake to produce Makefile.in
pkglib_LTLIBRARIES = dict_dcca.la
dict_dcca_la_SOURCES = \
dict_dcca.c
AM_LDFLAGS = \
-module -avoid-version -shared
AM_CPPFLAGS = \
-I$(top_srcdir)/lib/@FREEDIAMETER_DIR@/include
AM_CFLAGS = \
-Wall -Werror
MAINTAINERCLEANFILES = Makefile.in
MOSTLYCLEANFILES = *.stackdump

File diff suppressed because it is too large Load Diff

View File

@@ -1,18 +0,0 @@
## Process this file with automake to produce Makefile.in
pkglib_LTLIBRARIES = dict_dcca_3gpp.la
dict_dcca_3gpp_la_SOURCES = \
dict_dcca_3gpp.c
AM_LDFLAGS = \
-module -avoid-version -shared
AM_CPPFLAGS = \
-I$(top_srcdir)/lib/@FREEDIAMETER_DIR@/include
AM_CFLAGS = \
-Wall -Werror
MAINTAINERCLEANFILES = Makefile.in
MOSTLYCLEANFILES = *.stackdump

File diff suppressed because it is too large Load Diff

View File

@@ -1,789 +0,0 @@
| Attribute Name | Code | Section defined | Value Type | MUST | MAY | SHLD NOT | MUST NOT | Encr |
| # 3GPP 29.061-c00 (12.0.0 2012.12.20) | | | | | | | | |
| # 3GPP 29.061 is not very clear and self-inconsistent about M | | | | | | | | |
| # for this reason, other sources are assumed more trustworthy | | | | | | | | |
| # M inconsistently specified | | | | | | | | |
| 3GPP-IMSI | 1 | 16.4.7 | UTF8String | M,V | P | | | |
| # 29.061 says OctetString; dumps say UInt32; manually changed | | | | | | | | |
| # 29.061 says MUST NOT M; dumps say MUST | | | | | | | | |
| 3GPP-Charging-Id | 2 | 16.4.7 | Unsigned32 | M,V | P | | | |
| # 29.061 says MUST NOT M; dumps say MUST | | | | | | | | |
| 3GPP-PDP-Type | 3 | 16.4.7 | Enumerated | M,V | P | | | |
| 3GPP-CG-Address | 4 | 16.4.7 | OctetString | V | P | | M | |
| # 29.061 says MUST NOT M; old contrib/3gpp says MUST | | | | | | | | |
| 3GPP-GPRS-Negotiated-QoS-Profile | 5 | 16.4.7 | UTF8String | M,V | P | | | |
| # M inconsistently specified; old contrib/3gg says MUST NOT | | | | | | | | |
| 3GPP-SGSN-Address | 6 | 16.4.7 | OctetString | V | P | | M | |
| 3GPP-GGSN-Address | 7 | 16.4.7 | OctetString | V | P | | M | |
| # 29.061 says MUST NOT M; dumps say MUST | | | | | | | | |
| 3GPP-IMSI-MCC-MNC | 8 | 16.4.7 | UTF8String | M,V | P | | | |
| # 29.061 says MUST NOT M; old contrib/3gpp says MUST | | | | | | | | |
| 3GPP-GGSN-MCC-MNC | 9 | 16.4.7 | UTF8String | M,V | P | | | |
| # 29.061 says MUST NOT M; old contrib/3gpp says MUST | | | | | | | | |
| 3GPP-NSAPI | 10 | 16.4.7 | OctetString | M,V | P | | | |
| # added manually, missing in AVP table | | | | | | | | |
| 3GPP-Session-Stop-Indicator | 11 | 16.4.7 | OctetString | V | P | | M | |
| # 29.061 says MUST NOT M; old contrib/3gpp says MUST | | | | | | | | |
| 3GPP-Selection-Mode | 12 | 16.4.7 | UTF8String | M,V | P | | | |
| # 29.061 says MUST NOT M; old contrib/3gpp says MUST | | | | | | | | |
| 3GPP-Charging-Characteristics | 13 | 16.4.7 | UTF8String | M,V | P | | | |
| # 29.061 says MUST NOT M; old contrib/3gpp says MUST | | | | | | | | |
| 3GPP-CG-IPv6-Address | 14 | 16.4.7 | OctetString | M,V | P | | | |
| # M inconsistently specified | | | | | | | | |
| # 29.061 says MUST NOT M; old contrib/3gpp says MUST | | | | | | | | |
| 3GPP-SGSN-IPv6-Address | 15 | 16.4.7 | OctetString | M,V | P | | | |
| # 29.061 says MUST NOT M; old contrib/3gpp says MUST | | | | | | | | |
| 3GPP-GGSN-IPv6-Address | 16 | 16.4.7 | OctetString | M,V | P | | | |
| # 29.061 says MUST NOT M; old contrib/3gpp says MUST | | | | | | | | |
| 3GPP-IPv6-DNS-Servers | 17 | 16.4.7 | OctetString | M,V | P | | | |
| # 29.061 says MUST NOT M; old contrib/3gpp says MUST | | | | | | | | |
| 3GPP-SGSN-MCC-MNC | 18 | 16.4.7 | UTF8String | M,V | P | | | |
| # M inconsistently specified | | | | | | | | |
| 3GPP-IMEISV | 20 | 16.4.7 | OctetString | M,V | P | | | |
| # M inconsistently specified | | | | | | | | |
| 3GPP-RAT-Type | 21 | 16.4.7 | OctetString | M,V | P | | | |
| # M inconsistently specified | | | | | | | | |
| 3GPP-User-Location-Info | 22 | 16.4.7 | OctetString | M,V | P | | | |
| # M inconsistently specified | | | | | | | | |
| 3GPP-MS-TimeZone | 23 | 16.4.7 | OctetString | M,V | P | | | |
| 3GPP-CAMEL-Charging-Info | 24 | 16.4.7 | OctetString | V | P | | M | |
| 3GPP-Packet-Filter | 25 | 16.4.7 | OctetString | V | P | | M | |
| 3GPP-Negotiated-DSCP | 26 | 16.4.7 | OctetString | V | P | | M | |
| 3GPP-Allocate-IP-Type | 27 | 16.4.7 | OctetString | V | P | | M | |
| # added manually, missing in AVP table | | | | | | | | |
| External-Identifier | 28 | 16.4.7 | OctetString | V | P | | M | |
| TMGI | 900 | 17.07.02 | OctetString | M,V | P | | | |
| Required-MBMS-Bearer-Capabilities | 901 | 17.07.03 | UTF8String | M,V | P | | | |
| MBMS-StartStop-Indication | 902 | 17.07.05 | Enumerated | M,V | P | | | |
| MBMS-Service-Area | 903 | 17.07.06 | OctetString | M,V | P | | | |
| MBMS-Session-Duration | 904 | 17.07.07 | OctetString | M,V | P | | | |
| Alternative-APN | 905 | 17.07.08 | UTF8String | M,V | P | | | |
| MBMS-Service-Type | 906 | 17.07.09 | Enumerated | M,V | P | | | |
| MBMS-2G-3G-Indicator | 907 | 17.07.10 | Enumerated | M,V | P | | | |
| MBMS-Session-Identity | 908 | 17.07.11 | OctetString | M.V | P | | | |
| RAI | 909 | 17.07.12 | UTF8String | M,V | P | | | |
| Additional-MBMS-Trace-Info | 910 | 17.07.13 | OctetString | M,V | P | | | |
| MBMS-Time-To-Data-Transfer | 911 | 17.07.14 | OctetString | M,V | P | | | |
| MBMS-Session-Repetition-Number | 912 | 17.07.15 | OctetString | M.V | P | | | |
| MBMS-Required-QoS | 913 | 17.07.16 | UTF8String | M.V | P | | | |
| MBMS-Counting-Information | 914 | 17.07.17 | Enumerated | M.V | P | | | |
| MBMS-User-Data-Mode-Indication | 915 | 17.07.18 | Enumerated | M.V | P | | | |
| MBMS-GGSN-Address | 916 | 17.07.19 | OctetString | M.V | P | | | |
| MBMS-GGSN-IPv6-Address | 917 | 17.07.20 | OctetString | M.V | P | | | |
| MBMS-BMSC-SSM-IP-Address | 918 | 17.07.21 | OctetString | M.V | P | | | |
| MBMS-BMSC-SSM-IPv6-Address | 919 | 17.07.22 | OctetString | M.V | P | | | |
| MBMS-Flow-Identifier | 920 | 17.7.23 | OctetString | M,V | P | | | |
| CN-IP-Multicast-Distribution | 921 | 17.7.24 | Enumerated | M,V | P | | | |
| MBMS-HC-Indicator | 922 | 17.7.25 | Enumerated | M,V | P | | | |
| # 3GPP 29.140-700 (7.0.0 2007.07.05) | | | | | | | | |
| Served-User-Identity | 1100 | 6.3.1 | Grouped | M,V | | | | N |
| # reuses: MSISDN | 701 | 6.3.2 | OctetString | M,V | | | | N |
| VASP-ID | 1101 | 6.3.3 | UTF8String | M,V | | | | N |
| VAS-ID | 1102 | 6.3.4 | UTF8String | M,V | | | | N |
| Trigger-Event | 1103 | 6.3.5 | Enumerated | M,V | | | | N |
| # reuses: 3GPP-IMSI | 1 | 6.3.6 | UTF8String | M,V | | | | N |
| Sender-Address | 1104 | 6.3.7 | UTF8String | M,V | | | | N |
| Initial-Recipient-Address | 1105 | 6.3.8 | Grouped | M,V | | | | N |
| Result-Recipient-Address | 1106 | 6.3.9 | Grouped | M,V | | | | N |
| # conflicts with one in (more common) 32.329 | | | | | | | | |
| Sequence-Number-29.140 | 1107 | 6.3.10 | Unsigned32 | M,V | | | | N |
| # conflicts with one in (more common) 32.299 | | | | | | | | |
| Recipient-Address-29.140 | 1108 | 6.3.11 | UTF8String | M,V | | | | N |
| Routeing-Address | 1109 | 6.3.12 | UTF8String | M,V | | | | N |
| Originating-Interface | 1110 | 6.3.13 | Enumerated | M,V | | | | N |
| Delivery-Report | 1111 | 6.3.14 | Enumerated | M,V | | | | N |
| Read-Reply | 1112 | 6.3.15 | Enumerated | M,V | | | | N |
| Sender-Visibility | 1113 | 6.3.16 | Enumerated | M,V | | | | N |
| Service-Key | 1114 | 6.3.17 | UTF8String | M,V | | | | N |
| Billing-Information | 1115 | 6.3.18 | UTF8String | M,V | | | | N |
| # conflicts with one in (more common) 32.299 | | | | | | | | |
| Status-29.140 | 1116 | 6.3.19 | Grouped | M,V | | | | N |
| Status-Code | 1117 | 6.3.20 | UTF8String | M,V | | | | N |
| Status-Text | 1118 | 6.3.21 | UTF8String | M,V | | | | N |
| Routeing-Address-Resolution | 1119 | 6.3.22 | Enumerated | M,V | | | | N |
| # 3GPP 29.173-c00 (12.0.0 2013.03.13) | | | | | | | | |
| LMSI | 2400 | 6.4.2 | OctetString | M,V | | | | N |
| Serving-Node | 2401 | 6.4.3 | Grouped | M,V | | | | N |
| MME-Name | 2402 | 6.4.4 | DiameterIdentity | M,V | | | | N |
| MSC-Number | 2403 | 6.4.5 | OctetString | M,V | | | | N |
| LCS-Capabilities-Sets | 2404 | 6.4.6 | Unsigned32 | M,V | | | | N |
| GMLC-Address | 2405 | 6.4.7 | Address | M,V | | | | N |
| Additional-Serving-Node | 2406 | 6.4.8 | Grouped | M,V | | | | N |
| PPR-Address | 2407 | 6.4.9 | Address | M,V | | | | N |
| MME-Realm | 2408 | 6.4.12 | DiameterIdentity | V | | | M | N |
| SGSN-Name | 2409 | 6.4.13 | DiameterIdentity | V | | | M | N |
| SGSN-Realm | 2410 | 6.4.14 | DiameterIdentity | V | | | M | N |
| # 3GPP 29.210-670 (6.7.0 2006-12-18) | | | | | | | | |
| PDP-Session-Operation | 1015 | 5.2.21 | Enumerated | M,V | P | | | Y |
| # 3GPP 29.212-c00 (12.0.0 2013.03.15) | | | | | | | | |
| # Gx-specific | | | | | | | | |
| ADC-Revalidation-Time | 2801 | 5.3.93 | Time | V | P | | M | Y |
| ADC-Rule-Install | 1092 | 5.3.85 | Grouped | V | P | | M | Y |
| ADC-Rule-Remove | 1093 | 5.3.86 | Grouped | V | P | | M | Y |
| ADC-Rule-Definition | 1094 | 5.3.87 | Grouped | V | P | | M | Y |
| ADC-Rule-Base-Name | 1095 | 5.3.88 | UTF8String | V | P | | M | Y |
| ADC-Rule-Name | 1096 | 5.3.89 | OctetString | V | P | | M | Y |
| ADC-Rule-Report | 1097 | 5.3.90 | Grouped | V | P | | M | Y |
| Application-Detection-Information | 1098 | 5.3.91 | Grouped | V | P | | M | Y |
| Access-Network-Charging-Identifier-Gx | 1022 | 5.3.22 | Grouped | M,V | P | | | Y |
| Allocation-Retention-Priority | 1034 | 5.3.32 | Grouped | V | P | | M | Y |
| AN-GW-Address | 1050 | 5.3.49 | Address | V | P | | M | Y |
| APN-Aggregate-Max-Bitrate-DL | 1040 | 5.3.39 | Unsigned32 | V | P | | M | Y |
| APN-Aggregate-Max-Bitrate-UL | 1041 | 5.3.40 | Unsigned32 | V | P | | M | Y |
| Bearer-Control-Mode | 1023 | 5.3.23 | Enumerated | M,V | P | | | Y |
| Bearer-Identifier | 1020 | 5.3.20 | OctetString | M,V | P | | | Y |
| Bearer-Operation | 1021 | 5.3.21 | Enumerated | M,V | P | | | Y |
| Bearer-Usage | 1000 | 5.3.1 | Enumerated | M,V | P | | | Y |
| Charging-Rule-Install | 1001 | 5.3.2 | Grouped | M,V | P | | | Y |
| Charging-Rule-Remove | 1002 | 5.3.3 | Grouped | M,V | P | | | Y |
| Charging-Rule-Definition | 1003 | 5.3.4 | Grouped | M,V | P | | | Y |
| Charging-Rule-Base-Name | 1004 | 5.3.5 | UTF8String | M,V | P | | | Y |
| Charging-Rule-Name | 1005 | 5.3.6 | OctetString | M,V | P | | | Y |
| Charging-Rule-Report | 1018 | 5.3.18 | Grouped | M,V | P | | | Y |
| Charging-Correlation-Indicator | 1073 | 5.3.67 | Enumerated | V | P | | M | Y |
| CoA-IP-Address | 1035 | 5.3.33 | Address | V | P | | M | Y |
| CoA-Information | 1039 | 5.3.37 | Grouped | V | P | | M | Y |
| CSG-Information-Reporting | 1071 | 5.3.64 | Enumerated | V | P | | M | Y |
| Default-EPS-Bearer-QoS | 1049 | 5.3.48 | Grouped | V | P | | M | Y |
| Event-Report-Indication | 1033 | 5.3.30 | Grouped | V | P | | M | Y |
| Event-Trigger | 1006 | 5.3.7 | Enumerated | M,V | P | | | Y |
| Flow-Direction | 1080 | 5.3.65 | Enumerated | V | P | | M | Y |
| Flow-Information | 1058 | 5.3.53 | Grouped | V | P | | M | Y |
| Flow-Label | 1057 | 5.3.52 | OctetString | V | P | | M | Y |
| IP-CAN-Type | 1027 | 5.3.27 | Enumerated | M,V | P | | | Y |
| Guaranteed-Bitrate-DL | 1025 | 5.3.25 | Unsigned32 | M,V | P | | | Y |
| Guaranteed-Bitrate-UL | 1026 | 5.3.26 | Unsigned32 | M,V | P | | | Y |
| HeNB-Local-IP-Address | 2804 | 5.3.95 | Address | V | P | | M | Y |
| Metering-Method | 1007 | 5.3.8 | Enumerated | M,V | P | | | Y |
| Monitoring-Key | 1066 | 5.3.59 | OctetString | V | P | | M | Y |
| Mute-Notification | 2809 | 5.3.98 | Enumerated | V | P | | M | Y |
| Monitoring-Time | 2810 | 5.3.99 | Time | V | P | | M | Y |
| Network-Request-Support | 1024 | 5.3.24 | Enumerated | M,V | P | | | Y |
| Offline | 1008 | 5.3.9 | Enumerated | M,V | P | | | Y |
| Online | 1009 | 5.3.10 | Enumerated | M,V | P | | | Y |
| Packet-Filter-Content | 1059 | 5.3.54 | IPFilterRule | V | P | | M | Y |
| Packet-Filter-Identifier | 1060 | 5.3.55 | OctetString | V | P | | M | Y |
| Packet-Filter-Information | 1061 | 5.3.56 | Grouped | V | P | | M | Y |
| Packet-Filter-Operation | 1062 | 5.3.57 | Enumerated | V | P | | M | Y |
| Packet-Filter-Usage | 1072 | 5.3.66 | Enumerated | V | P | | M | Y |
| PDN-Connection-ID | 1065 | 5.3.58 | OctetString | V | P | | | Y |
| Precedence | 1010 | 5.3.11 | Unsigned32 | M,V | P | | | Y |
| Pre-emption-Capability | 1047 | 5.3.46 | Enumerated | V | P | | M | Y |
| Pre-emption-Vulnerability | 1048 | 5.3.47 | Enumerated | V | P | | M | Y |
| Priority-Level | 1046 | 5.3.45 | Unsigned32 | V | P | | M | Y |
| Redirect-Information | 1085 | 5.3.82 | Grouped | V | P | | M | Y |
| Redirect-Support | 1086 | 5.3.83 | Enumerated | V | P | | M | Y |
| Reporting-Level | 1011 | 5.3.12 | Enumerated | M,V | P | | | Y |
| Routing-Filter | 1078 | 5.3.72 | Grouped | V | P | | M | Y |
| Routing-IP-Address | 1079 | 5.3.73 | Address | V | P | | M | Y |
| Routing-Rule-Definition | 1076 | 5.3.70 | Grouped | V | P | | M | Y |
| Routing-Rule-Identifier | 1077 | 5.3.71 | OctetString | V | P | | M | Y |
| Routing-Rule-Install | 1081 | 5.3.68 | Grouped | V | P | | M | Y |
| Routing-Rule-Remove | 1075 | 5.3.69 | Grouped | V | P | | M | Y |
| PCC-Rule-Status | 1019 | 5.3.19 | Enumerated | M,V | P | | | Y |
| Session-Release-Cause | 1045 | 5.3.44 | Enumerated | M,V | P | | | Y |
| TDF-Information | 1087 | 5.3.78 | Grouped | V | P | | M | Y |
| TDF-Application-Identifier | 1088 | 5.3.77 | OctetString | V | P | | M | Y |
| TDF-Application-Instance-Identifier | 2802 | 5.3.92 | OctetString | V | P | | M | Y |
| TDF-Destination-Host | 1089 | 5.3.80 | DiameterIdentity | V | P | | M | Y |
| TDF-Destination-Realm | 1090 | 5.3.79 | DiameterIdentity | V | P | | M | Y |
| TDF-IP-Address | 1091 | 5.3.81 | Address | V | P | | M | Y |
| QoS-Class-Identifier | 1028 | 5.3.17 | Enumerated | M,V | P | | | Y |
| QoS-Information | 1016 | 5.3.16 | Grouped | M.V | P | | | Y |
| QoS-Negotiation | 1029 | 5.3.28 | Enumerated | M,V | P | | | Y |
| QoS-Upgrade | 1030 | 5.3.29 | Enumerated | M.V | P | | | Y |
| PS-to-CS-Session-Continuity | 1099 | 5.3.84 | Enumerated | V | P | | | Y |
| Resource-Allocation-Notification | 1063 | 5.3.50 | Enumerated | V | P | | M | Y |
| Rule-Failure-Code | 1031 | 5.3.38 | Enumerated | M.V | P | | | Y |
| Security-Parameter-Index | 1056 | 5.3.51 | OctetString | V | P | | M | Y |
| TFT-Filter | 1012 | 5.3.13 | IPFilterRule | M,V | P | | | Y |
| TFT-Packet-Filter-Information | 1013 | 5.3.14 | Grouped | M,V | P | | | Y |
| ToS-Traffic-Class | 1014 | 5.3.15 | OctetString | M,V | P | | | Y |
| Tunnel-Header-Filter | 1036 | 5.3.34 | IPFilterRule | V | P | | M | Y |
| Tunnel-Header-Length | 1037 | 5.3.35 | Unsigned32 | V | P | | M | Y |
| Tunnel-Information | 1038 | 5.3.36 | Grouped | V | P | | M | Y |
| RAT-Type | 1032 | 5.3.31 | Enumerated | V | P | | M | Y |
| Revalidation-Time | 1042 | 5.3.41 | Time | M,V | P | | | Y |
| Rule-Activation-Time | 1043 | 5.3.42 | Time | M,V | P | | | Y |
| UDP-Source-Port | 2806 | 5.3.97 | Unsigned32 | V | P | | M | Y |
| UE-Local-IP-Address | 2805 | 5.3.96 | Address | V | P | | M | Y |
| Usage-Monitoring-Information | 1067 | 5.3.60 | Grouped | V | P | | M | Y |
| Rule-Deactivation-Time | 1044 | 5.3.43 | Time | M,V | P | | | Y |
| Usage-Monitoring-Level | 1068 | 5.3.61 | Enumerated | V | P | | M | Y |
| Usage-Monitoring-Report | 1069 | 5.3.62 | Enumerated | V | P | | M | Y |
| Usage-Monitoring-Support | 1070 | 5.3.63 | Enumerated | V | P | | M | Y |
| # Gxx-specific | | | | | | | | |
| QoS-Rule-Install | 1051 | 5a.3.1 | Grouped | M,V | P | | | Y |
| QoS-Rule-Remove | 1052 | 5a.3.2 | Grouped | M,V | P | | | Y |
| QoS-Rule-Definition | 1053 | 5a.3.3 | Grouped | M,V | P | | | Y |
| QoS-Rule-Name | 1054 | 5a.3.4 | OctetString | M,V | P | | | Y |
| QoS-Rule-Base-Name | 1074 | 5a.3.7 | UTF8String | V | P | | M | Y |
| QoS-Rule-Report | 1055 | 5a.3.5 | Grouped | M,V | P | | | Y |
| Session-Linking-Indicator | 1064 | 5a.3.6 | Enumerated | M,V | P | | | Y |
| # S15-specific | | | | | | | | |
| CS-Service-Qos-Request-Identifier | 2807 | E.6.3.2 | OctetString | M,V | P | | | Y |
| CS-Service-QoS-Request-Operation | 2808 | E.6.3.3 | Enumerated | M.V | P | | | Y |
| # 3GPP 29.214-b80 (11.8.0 2013.03.15) | | | | | | | | |
| Abort-Cause | 500 | 5.3.1 | Enumerated | M,V | P | | | Y |
| Access-Network-Charging-Address | 501 | 5.3.2 | Address | M,V | P | | | Y |
| Access-Network-Charging-Identifier | 502 | 5.3.3 | Grouped | M,V | P | | | Y |
| Access-Network-Charging-Identifier-Value | 503 | 5.3.4 | OctetString | M,V | P | | | Y |
| Acceptable-Service-Info | 526 | 5.3.24 | Grouped | M,V | P | | | Y |
| AF-Application-Identifier | 504 | 5.3.5 | OctetString | M,V | P | | | Y |
| AF-Charging-Identifier | 505 | 5.3.6 | OctetString | M,V | P | | | Y |
| Application-Service-Provider-Identity | 532 | 5.3.29 | UTF8String | V | P | | M | Y |
| Codec-Data | 524 | 5.3.7 | OctetString | M,V | P | | | Y |
| Flow-Description | 507 | 5.3.8 | IPFilterRule | M,V | P | | | Y |
| Flow-Number | 509 | 5.3.9 | Unsigned32 | M,V | P | | | Y |
| Flows | 510 | 5.3.10 | Grouped | M,V | P | | | Y |
| Flow-Status | 511 | 5.3.11 | Enumerated | M,V | P | | | Y |
| Flow-Usage | 512 | 5.3.12 | Enumerated | M,V | P | | | Y |
| Service-URN | 525 | 5.3.23 | OctetString | M,V | P | | | Y |
| Specific-Action | 513 | 5.3.13 | Enumerated | M,V | P | | | Y |
| Max-Requested-Bandwidth-DL | 515 | 5.3.14 | Unsigned32 | M,V | P | | | Y |
| Max-Requested-Bandwidth-UL | 516 | 5.3.15 | Unsigned32 | M,V | P | | | Y |
| Media-Component-Description | 517 | 5.3.16 | Grouped | M,V | P | | | Y |
| Media-Component-Number | 518 | 5.3.17 | Unsigned32 | M,V | P | | | Y |
| Media-Sub-Component | 519 | 5.3.18 | Grouped | M,V | P | | | Y |
| Media-Type | 520 | 5.3.19 | Enumerated | M,V | P | | | Y |
| MPS-Identifier | 528 | 5.3.30 | OctetString | V | P | | M | Y |
| Min-Requested-Bandwidth-DL | 534 | 5.3.32 | Unsigned32 | V | P | | M | Y |
| Min-Requested-Bandwidth-UL | 535 | 5.3.33 | Unsigned32 | V | P | | M | Y |
| RR-Bandwidth | 521 | 5.3.20 | Unsigned32 | M,V | P | | | Y |
| RS-Bandwidth | 522 | 5.3.21 | Unsigned32 | M,V | P | | | Y |
| Service-Info-Status | 527 | 5.3.25 | Enumerated | M,V | P | | | Y |
| SIP-Forking-Indication | 523 | 5.3.22 | Enumerated | M,V | P | | | Y |
| Sponsor-Identity | 531 | 5.3.28 | UTF8String | V | P | | M | Y |
| Sponsored-Connectivity-Data | 530 | 5.3.27 | Grouped | V | P | | M | Y |
| AF-Signalling-Protocol | 529 | 5.3.26 | Enumerated | V | P | | M | Y |
| Required-Access-Info | 536 | 5.3.34 | Enumerated | V | P | | M | Y |
| Rx-Request-Type | 533 | 5.3.31 | Enumerated | V | P | | M | Y |
| IP-Domain-Id | 537 | 5.3.35 | OctetString | V | P | | M | Y |
| # 3GPP 29.229-b20 (11.2.0 2012.12.21) | | | | | | | | |
| Associated-Identities | 632 | 6.3.33 | Grouped | V | | | M | N |
| Associated-Registered-Identities | 647 | 6.3.50 | Grouped | V | | | M | N |
| Call-ID-SIP-Header | 643 | 6.3.49.1 | OctetString | V | | | M | N |
| Charging-Information | 618 | 6.3.19 | Grouped | M,V | | | | N |
| Confidentiality-Key | 625 | 6.3.27 | OctetString | M,V | | | | N |
| Contact | 641 | 6.3.48 | OctetString | V | | | M | N |
| Deregistration-Reason | 615 | 6.3.16 | Grouped | M,V | | | | N |
| Digest-Algorithm | 111 | 6.3.39 | UTF8String | M | | | V | N |
| Digest-HA1 | 121 | 6.3.41 | UTF8String | M | | | V | N |
| Digest-QoP | 110 | 6.3.40 | UTF8String | M | | | V | N |
| Digest-Realm | 104 | 6.3.37 | UTF8String | M | | | V | N |
| Feature-List | 630 | 6.3.31 | Unsigned32 | V | | | M | N |
| Feature-List-ID | 629 | 6.3.30 | Unsigned32 | V | | | M | N |
| From-SIP-Header | 644 | 6.3.49.2 | OctetString | V | | | M | N |
| Identity-with-Emergency-Registration | 651 | 6.3.57 | Grouped | V | | | M | N |
| Integrity-Key | 626 | 6.3.28 | OctetString | M,V | | | | N |
| LIA-Flags | 653 | 6.3.59 | Unsigned32 | V | | | M | N |
| Loose-Route-Indication | 638 | 6.3.45 | Enumerated | V | | | M | N |
| Mandatory-Capability | 604 | 6.3.5 | Unsigned32 | M,V | | | | N |
| Multiple-Registration-Indication | 648 | 6.3.51 | Enumerated | V | | | M | N |
| Optional-Capability | 605 | 6.3.6 | Unsigned32 | M,V | | | | N |
| Originating-Request | 633 | 6.3.34 | Enumerated | M,V | | | | N |
| Path | 640 | 6.3.47 | OctetString | V | | | M | N |
| Primary-Charging-Collection-Function-Name | 621 | 6.3.22 | DiameterURI | M,V | | | | N |
| Primary-Event-Charging-Function-Name | 619 | 6.3.20 | DiameterURI | M,V | | | | N |
| Priviledged-Sender-Indication | 652 | 6.3.58 | Enumerated | V | | | M | N |
| Public-Identity | 601 | 6.3.2 | UTF8String | M,V | | | | N |
| Reason-Code | 616 | 6.3.17 | Enumerated | M,V | | | | N |
| Reason-Info | 617 | 6.3.18 | UTF8String | M,V | | | | N |
| Record-Route | 646 | 6.3.49.4 | OctetString | V | | | M | N |
| Restoration-Info | 649 | 6.3.52 | Grouped | V | | | M | N |
| SCSCF-Restoration-Info | 639 | 6.3.46 | Grouped | V | | | M | N |
| SIP-Auth-Data-Item | 612 | 6.3.13 | Grouped | M,V | | | | N |
| SIP-Authenticate | 609 | 6.3.10 | OctetString | M,V | | | | N |
| SIP-Authentication-Context | 611 | 6.3.12 | OctetString | M,V | | | | N |
| SIP-Authentication-Scheme | 608 | 6.3.9 | UTF8String | M,V | | | | N |
| SIP-Authorization | 610 | 6.3.11 | OctetString | M,V | | | | N |
| SIP-Digest-Authenticate | 635 | 6.3.36 | Grouped | V | | | M | N |
| SIP-Item-Number | 613 | 6.3.14 | Unsigned32 | M,V | | | | N |
| SIP-Number-Auth-Items | 607 | 6.3.8 | Unsigned32 | M,V | | | | N |
| Secondary-Charging-Collection-Function-Name | 622 | 6.3.23 | DiameterURI | M,V | | | | N |
| Secondary-Event-Charging-Function-Name | 620 | 6.3.21 | DiameterURI | M,V | | | | N |
| Server-Assignment-Type | 614 | 6.3.15 | Enumerated | M,V | | | | N |
| Server-Capabilities | 603 | 6.3.4 | Grouped | M,V | | | | N |
| Server-Name | 602 | 6.3.3 | UTF8String | M,V | | | | N |
| Session-Priority | 650 | 6.3.56 | Enumerated | V | | | M | N |
| Subscription-Info | 642 | 6.3.49 | Grouped | V | | | M | N |
| Supported-Applications | 631 | 6.3.32 | Grouped | V | | | M | N |
| Supported-Features | 628 | 6.3.29 | Grouped | V | M | | | N |
| To-SIP-Header | 645 | 6.3.49.3 | OctetString | V | | | M | N |
| UAR-Flags | 637 | 6.3.44 | Unsigned32 | V | | | M | N |
| User-Authorization-Type | 623 | 6.3.24 | Enumerated | M,V | | | | N |
| User-Data | 606 | 6.3.7 | OctetString | M,V | | | | N |
| User-Data-Already-Available | 624 | 6.3.26 | Enumerated | M,V | | | | N |
| Visited-Network-Identifier | 600 | 6.3.1 | OctetString | M,V | | | | N |
| Wildcarded-Public-Identity | 634 | 6.3.35 | UTF8String | V | | | M | N |
| # 3GPP 32.299-b60 (11.6.0 2012.12.21) | | | | | | | | |
| AF-Correlation-Information | 1276 | | Grouped | M,V | P | | | N |
| Access-Network-Information | 1263 | | OctetString | M,V | P | | | N |
| Access-Transfer-Information | 2709 | | Grouped | M,V | P | | | N |
| Access-Transfer-Type | 2710 | | Enumerated | M,V | P | | | N |
| Account-Expiration | 2309 | | Time | M,V | P | | | N |
| Accumulated-Cost | 2052 | | Grouped | M,V | P | | | N |
| Adaptations | 1217 | | Enumerated | M,V | P | | | N |
| Additional-Content-Information | 1207 | | Grouped | M,V | P | | | N |
| Additional-Type-Information | 1205 | | UTF8String | M,V | P | | | N |
| Address-Data | 897 | | UTF8String | M,V | P | | | N |
| Address-Domain | 898 | | Grouped | M,V | P | | | N |
| Address-Type | 899 | | Enumerated | M,V | P | | | N |
| Addressee-Type | 1208 | | Enumerated | M,V | P | | | N |
| Alternate-Charged-Party-Address | 1280 | | UTF8String | V.M | P | | | N |
| AoC-Cost-Information | 2053 | | Grouped | M,V | P | | | N |
| AoC-Format | 2310 | | Enumerated | M,V | P | | | N |
| AoC-Information | 2054 | | Grouped | V.M | P | | | N |
| AoC-Request-Type | 2055 | | Enumerated | V.M | P | | | N |
| AoC-Service | 2311 | | Grouped | M,V | P | | | N |
| AoC-Service-Obligatory-Type | 2312 | | Enumerated | M,V | P | | | N |
| AoC-Service-Type | 2313 | | Enumerated | M,V | P | | | N |
| AoC-Subscription-Information | 2314 | | Grouped | M,V | P | | | N |
| Applic-ID | 1218 | | UTF8String | M,V | P | | | N |
| Application-Server | 836 | | UTF8String | M,V | P | | | N |
| Application-Server-Information | 850 | | Grouped | M,V | P | | | N |
| Application-Provided-Called-Party-Address | 837 | | UTF8String | M,V | P | | | N |
| Associated-Party-Address | 2035 | | UTF8String | M,V | P | | | N |
| Associated-URI | 856 | | UTF8String | M,V | P | | | N |
| Aux-Applic-Info | 1219 | | UTF8String | M,V | P | | | N |
| Base-Time-Interval | 1265 | | Unsigned32 | M,V | P | | | N |
| Bearer-Service | 854 | | OctetString | M,V | P | | | N |
| CG-Address | 846 | | Address | M,V | P | | | Y |
| CSG-Access-Mode | 2317 | | Enumerated | M,V | P | | | N |
| CSG-Membership-Indication | 2318 | | Enumerated | M,V | P | | | N |
| CUG-Information | 2304 | | OctetString | M,V | P | | | N |
| Called-Asserted-Identity | 1250 | | UTF8String | M,V | P | | | N |
| Called-Party-Address | 832 | | UTF8String | M,V | P | | | N |
| Calling-Party-Address | 831 | | UTF8String | M,V | P | | | N |
| Carrier-Select-Routing-Information | 2023 | | UTF8String | M,V | P | | | N |
| Cause-Code | 861 | | Integer32 | M,V | P | | | N |
| Change-Condition | 2037 | | Integer32 | M,V | P | | | N |
| Change-Time | 2038 | | Time | M,V | P | | | N |
| Charge-Reason-Code | 2118 | | Enumerated | M,V | P | | | N |
| Charged-Party | 857 | | UTF8String | M,V | P | | | N |
| Charging-Characteristics-Selection-Mode | 2066 | | Enumerated | M,V | P | | | N |
| Class-Identifier | 1214 | | Enumerated | M,V | P | | | N |
| Client-Address | 2018 | | Address | M,V | P | | | N |
| Content-Class | 1220 | | Enumerated | M,V | P | | | N |
| Content-Disposition | 828 | | UTF8String | M,V | P | | | N |
| Content-Length | 827 | | Unsigned32 | M,V | P | | | N |
| Content-Size | 1206 | | Unsigned32 | M,V | P | | | N |
| Content-Type | 826 | | UTF8String | M,V | P | | | N |
| Current-Tariff | 2056 | | Grouped | M,V | P | | | N |
| DRM-Content | 1221 | | Enumerated | M,V | P | | | N |
| Data-Coding-Scheme | 2001 | | Integer32 | M,V | P | | | N |
| Deferred-Location-Event-Type | 1230 | | UTF8String | M,V | P | | | N |
| Delivery-Report-Requested | 1216 | | Enumerated | M,V | P | | | N |
| Destination-Interface | 2002 | | Grouped | M,V | P | | | N |
| Diagnostics | 2039 | | Integer32 | M,V | P | | | N |
| Domain-Name | 1200 | | UTF8String | M,V | P | | | N |
| Dynamic-Address-Flag | 2051 | | Enumerated | M,V | P | | | N |
| Dynamic-Address-Flag-Extension | 2068 | | Enumerated | M,V | P | | | N |
| Early-Media-Description | 1272 | | Grouped | M,V | P | | | N |
| Envelope | 1266 | | Grouped | M,V | P | | | N |
| Envelope-End-Time | 1267 | | Time | M,V | P | | | N |
| Envelope-Reporting | 1268 | | Enumerated | M,V | P | | | N |
| Envelope-Start-Time | 1269 | | Time | M,V | P | | | N |
| Event | 825 | | UTF8String | M,V | P | | | N |
| Event-Charging-TimeStamp | 1258 | | Time | M,V | P | | | N |
| Event-Type | 823 | | Grouped | M,V | P | | | N |
| Expires | 888 | | Unsigned32 | M,V | P | | | N |
| File-Repair-Supported | 1224 | | Enumerated | M,V | P | | | Y |
| From-Address | 2708 | | UTF8String | M,V | P | | | N |
| GGSN-Address | 847 | | Address | M,V | P | | | N |
| IMS-Application-Reference-Identifier | 2601 | | UTF8String | M,V | P | | | N |
| IMS-Charging-Identifier | 841 | | UTF8String | M,V | P | | | N |
| IMS-Communication-Service-Identifier | 1281 | | UTF8String | M,V | P | | | N |
| IMS-Emergency-Indicator | 2322 | | Enumerated | M,V | P | | | N |
| IMS-Information | 876 | | Grouped | M,V | P | | | N |
| IMSI-Unauthenticated-Flag | 2308 | | Enumerated | M,V | P | | | N |
| IP-Realm-Default-Indication | 2603 | | Enumerated | M,V | P | | | N |
| Incoming-Trunk-Group-Id | 852 | | UTF8String | M,V | P | | | N |
| Incremental-Cost | 2062 | | Grouped | M,V | P | | | N |
| Initial-IMS-Charging-Identifier | 2321 | | UTF8String | M,V | P | | | N |
| Inter-Operator-Identifier | 838 | | Grouped | M,V | P | | | N |
| Interface-Id | 2003 | | UTF8String | M,V | P | | | N |
| Interface-Port | 2004 | | UTF8String | M,V | P | | | N |
| Interface-Text | 2005 | | UTF8String | M,V | P | | | N |
| Interface-Type | 2006 | | Enumerated | M,V | P | | | N |
| LCS-APN | 1231 | | UTF8String | M,V | P | | | N |
| LCS-Client-Dialed-By-MS | 1233 | | UTF8String | M,V | P | | | N |
| LCS-Client-External-ID | 1234 | | UTF8String | M,V | P | | | N |
| LCS-Client-Id | 1232 | | Grouped | M,V | P | | | N |
| LCS-Client-Name | 1235 | | Grouped | M,V | P | | | N |
| LCS-Client-Type | 1241 | | Enumerated | M,V | P | | | N |
| LCS-Data-Coding-Scheme | 1236 | | UTF8String | M,V | P | | | N |
| LCS-Format-Indicator | 1237 | | Enumerated | M,V | P | | | N |
| LCS-Information | 878 | | Grouped | M,V | P | | | N |
| LCS-Name-String | 1238 | | UTF8String | M,V | P | | | N |
| LCS-Requestor-Id | 1239 | | Grouped | M,V | P | | | N |
| LCS-Requestor-Id-String | 1240 | | UTF8String | M,V | P | | | N |
| Local-GW-Inserted-Indication | 2604 | | Enumerated | M,V | P | | | N |
| Local-Sequence-Number | 2063 | | Unsigned32 | M,V | P | | | N |
| Location-Estimate | 1242 | | OctetString | M,V | P | | | N |
| Location-Estimate-Type | 1243 | | Enumerated | M,V | P | | | N |
| Location-Type | 1244 | | Grouped | M,V | P | | | N |
| Low-Balance-Indication | 2020 | | Enumerated | M,V | P | | | N |
| Low-Priority-Indicator | 2602 | | Enumerated | M,V | P | | | N |
| MBMS GW-Address | 2307 | | Address | M,V | P | | | N |
| MBMS-Information | 880 | | Grouped | M,V | P | | | N |
| MBMS-User-Service-Type | 1225 | | Enumerated | M,V | P | | | Y |
| MM-Content-Type | 1203 | | Grouped | M,V | P | | | N |
| MMBox-Storage-Requested | 1248 | | Enumerated | M,V | P | | | N |
| MMS-Information | 877 | | Grouped | M,V | P | | | N |
| MMTel-Information | 2030 | | Grouped | M,V | P | | | N |
| MMTel-SService-Type | 2031 | | Unsigned32 | M,V | P | | | N |
| Media-Initiator-Flag | 882 | | Enumerated | M,V | P | | | N |
| Media-Initiator-Party | 1288 | | UTF8String | M,V | P | | | N |
| Message-Body | 889 | | Grouped | M,V | P | | | N |
| Message-Class | 1213 | | Grouped | M,V | P | | | N |
| Message-ID | 1210 | | UTF8String | M,V | P | | | N |
| Message-Size | 1212 | | Unsigned32 | M,V | P | | | N |
| Message-Type | 1211 | | Enumerated | M,V | P | | | N |
| NNI-Information | 2703 | | Grouped | M,V | P | | | N |
| NNI-Type | 2704 | | Enumerated | M,V | P | | | N |
| Neighbour-Node-Address | 2705 | | Address | M,V | P | | | N |
| Next-Tariff | 2057 | | Grouped | V/M | P | | | N |
| Node-Functionality | 862 | | Enumerated | M,V | P | | | N |
| Node-Id | 2064 | | UTF8String | M,V | P | | | N |
| Number-Of-Diversions | 2034 | | Unsigned32 | M,V | P | | | N |
| Number-Of-Messages-Sent | 2019 | | Unsigned32 | M,V | P | | | N |
| Number-Of-Participants | 885 | | Unsigned32 | M,V | P | | | N |
| Number-Of-Received-Talk-Bursts | 1282 | | Unsigned32 | M,V | P | | | N |
| Number-Of-Talk-Bursts | 1283 | | Unsigned32 | M,V | P | | | N |
| Number-Portability-Routing-Information | 2024 | | UTF8String | M,V | P | | | N |
| Offline-Charging | 1278 | | Grouped | M,V | P | | | N |
| Online-Charging-Flag | 2303 | | Enumerated | M,V | P | | | N |
| Originating-IOI | 839 | | UTF8String | M,V | P | | | N |
| Originator | 864 | | Enumerated | M,V | P | | | N |
| Originator-Address | 886 | | Grouped | M,V | P | | | N |
| Originator-Interface | 2009 | | Grouped | M,V | P | | | N |
| Originator-Received-Address | 2027 | | Grouped | M,V | P | | | N |
| Originator-SCCP-Address | 2008 | | Address | M,V | P | | | N |
| Outgoing-Session-Id | 2320 | | UTF8String | M,V | P | | | N |
| Outgoing-Trunk-Group-Id | 853 | | UTF8String | M,V | P | | | N |
| PDG-Address | 895 | | Address | M,V | P | | | N |
| PDG-Charging-Id | 896 | | Unsigned32 | M,V | P | | | N |
| PDN-Connection-Charging-ID | 2050 | | Unsigned32 | M,V | P | | | N |
| PDP-Address | 1227 | | Address | M,V | P | | | Y |
| PDP-Address-Prefix-Length | 2606 | | Unsigned32 | M,V | P | | | Y |
| PDP-Context-Type | 1247 | | Enumerated | M,V | P | | | N |
| PS-Append-Free-Format-Data | 867 | | Enumerated | M,V | P | | | N |
| PS-Free-Format-Data | 866 | | OctetString | M,V | P | | | N |
| PS-Furnish-Charging-Information | 865 | | Grouped | M,V | P | | | N |
| PS-Information | 874 | | Grouped | M,V | P | | | N |
| Participant-Access-Priority | 1259 | | Enumerated | M,V | P | | | N |
| Participant-Action-Type | 2049 | | Enumerated | M,V | P | | | N |
| Participant-Group | 1260 | | Grouped | M,V | P | | | N |
| Participants-Involved | 887 | | UTF8String | M,V | P | | | N |
| PoC-Change-Condition | 1261 | | Enumerated | M,V | P | | | N |
| PoC-Change-Time | 1262 | | Time | M,V | P | | | N |
| PoC-Controlling-Address | 858 | | UTF8String | M,V | P | | | N |
| PoC-Event-Type | 2025 | | Enumerated | M,V | P | | | N |
| PoC-Group-Name | 859 | | UTF8String | M,V | P | | | N |
| PoC-Information | 879 | | Grouped | M,V | P | | | N |
| PoC-Server-Role | 883 | | Enumerated | M,V | P | | | N |
| PoC-Session-Id | 1229 | | UTF8String | M,V | P | | | N |
| PoC-Session-Initiation-type | 1277 | | Enumerated | M,V | P | | | N |
| PoC-Session-Type | 884 | | Enumerated | M,V | P | | | N |
| PoC-User-Role | 1252 | | Grouped | M,V | P | | | N |
| PoC-User-Role-IDs | 1253 | | UTF8String | M,V | P | | | N |
| PoC-User-Role-info-Units | 1254 | | Enumerated | M,V | P | | | N |
| Positioning-Data | 1245 | | UTF8String | M,V | P | | | N |
| Preferred-AoC-Currency | 2315 | | Unsigned32 | M,V | P | | | N |
| Priority | 1209 | | Enumerated | M,V | P | | | N |
| Quota-Consumption-Time | 881 | | Unsigned32 | M,V | P | | | N |
| Quota-Holding-Time | 871 | | Unsigned32 | M,V | P | | | N |
| Rate-Element | 2058 | | Grouped | M,V | P | | | N |
| Read-Reply-Report-Requested | 1222 | | Enumerated | M,V | P | | | N |
| Real-Time-Tariff-Information | 2305 | | Grouped | M,V | P | | | N |
| Received-Talk-Burst-Time | 1284 | | Unsigned32 | M,V | P | | | N |
| Received-Talk-Burst-Volume | 1285 | | Unsigned32 | M,V | P | | | N |
| Recipient-Address | 1201 | | Grouped | M,V | P | | | N |
| Recipient-Info | 2026 | | Grouped | M,V | P | | | N |
| Recipient-Received-Address | 2028 | | Grouped | M,V | P | | | N |
| Recipient-SCCP-Address | 2010 | | Address | M,V | P | | | N |
| Refund-Information | 2022 | | OctetString | M,V | P | | | N |
| Relationship-Mode | 2706 | | Enumerated | M,V | P | | | N |
| Remaining-Balance | 2021 | | Grouped | M,V | P | | | N |
| Reply-Applic-ID | 1223 | | UTF8String | M,V | P | | | N |
| Reply-Path-Requested | 2011 | | Enumerated | M,V | P | | | N |
| Reporting-Reason | 872 | | Enumerated | M,V | P | | | N |
| Requested-Party-Address | 1251 | | UTF8String | M,V | P | | | N |
| Role-Of-Node | 829 | | Enumerated | M,V | P | | | N |
| SDP-Answer-Timestamp | 1275 | | Time | M,V | P | | | N |
| SDP-Media-Component | 843 | | Grouped | M,V | P | | | N |
| SDP-Media-Description | 845 | | UTF8String | M,V | P | | | N |
| SDP-Media-Name | 844 | | UTF8String | M,V | P | | | N |
| SDP-Offer-Timestamp | 1274 | | Time | M,V | P | | | N |
| SDP-Session-Description | 842 | | UTF8String | M,V | P | | | N |
| SDP-TimeStamps | 1273 | | Grouped | M,V | P | | | N |
| SDP-Type | 2036 | | Enumerated | M,V | P | | | N |
| SGSN-Address | 1228 | | Address | M,V | P | | | N |
| SGW-Address | 2067 | | Address | M,V | P | | | N |
| SGW-Change | 2065 | | Enumerated | M,V | P | | | N |
| SIP-Method | 824 | | UTF8String | M,V | P | | | N |
| SIP-Request-Timestamp | 834 | | Time | M,V | P | | | N |
| SIP-Request-Timestamp-Fraction | 2301 | | Unsigned32 | M,V | P | | | N |
| SIP-Response-Timestamp | 835 | | Time | M,V | P | | | N |
| SIP-Response-Timestamp-Fraction | 2302 | | Unsigned32 | M,V | P | | | N |
| SM-Discharge-Time | 2012 | | Time | M,V | P | | | N |
| SM-Message-Type | 2007 | | Enumerated | M,V | P | | | N |
| SM-Protocol-ID | 2013 | | OctetString | M,V | P | | | N |
| SM-Service-Type | 2029 | | Enumerated | M,V | P | | | N |
| SM-Status | 2014 | | OctetString | M,V | P | | | N |
| SM-User-Data-Header | 2015 | | OctetString | M,V | P | | | N |
| SMS-Information | 2000 | | Grouped | M,V | P | | | N |
| SMS-Node | 2016 | | Enumerated | M,V | P | | | N |
| SMSC-Address | 2017 | | Address | M,V | P | | | N |
| Scale-Factor | 2059 | | Grouped | M,V | P | | | N |
| Served-Party-IP-Address | 848 | | Address | M,V | P | | | N |
| Service-Data-Container | 2040 | | Grouped | M,V | P | | | N |
| Service-Id | 855 | | UTF8String | M,V | P | | | N |
| Service-Information | 873 | | Grouped | M,V | P | | | N |
| Service-Mode | 2032 | | Unsigned32 | M,V | P | | | N |
| Service-Specific-Data | 863 | | UTF8String | M,V | P | | | N |
| Service-Specific-Info | 1249 | | Grouped | M,V | P | | | N |
| Service-Specific-Type | 1257 | | Unsigned32 | M,V | P | | | N |
| Serving-Node-Type | 2047 | | Enumerated | M,V | P | | | N |
| Session-Direction | 2707 | | Enumerated | M,V | P | | | N |
| Start-Time | 2041 | | Time | M,V | P | | | N |
| Status | 2702 | | Enumerated | M,V | P | | | N |
| Stop-Time | 2042 | | Time | M,V | P | | | N |
| Submission-Time | 1202 | | Time | M,V | P | | | N |
| Subscriber-Role | 2033 | | Enumerated | M,V | P | | | N |
| Supplementary-Service | 2048 | | Grouped | M,V | P | | | N |
| Talk-Burst-Exchange | 1255 | | Grouped | M,V | P | | | N |
| Talk-Burst-Time | 1286 | | Unsigned32 | M,V | P | | | N |
| Talk-Burst-Volume | 1287 | | Unsigned32 | M,V | P | | | N |
| Tariff-Information | 2060 | | Grouped | M,V | P | | | N |
| Tariff-XML | 2306 | | UTF8String | M,V | P | | | N |
| Terminating-IOI | 840 | | UTF8String | M,V | P | | | N |
| Time-First-Usage | 2043 | | Time | M,V | P | | | N |
| Time-Last-Usage | 2044 | | Time | M,V | P | | | N |
| Time-Quota-Mechanism | 1270 | | Grouped | M,V | P | | | N |
| Time-Quota-Threshold | 868 | | Unsigned32 | M,V | P | | | N |
| Time-Quota-Type | 1271 | | Enumerated | M,V | P | | | N |
| Time-Stamps | 833 | | Grouped | M,V | P | | | N |
| Time-Usage | 2045 | | Unsigned32 | M,V | P | | | N |
| Token-Text | 1215 | | UTF8String | M,V | P | | | N |
| Traffic-Data-Volumes | 2046 | | Grouped | M,V | P | | | N |
| Transcoder-Inserted-Indication | 2605 | | Enumerated | M,V | P | | | N |
| Transit-IOI-List | 2701 | | UTF8String | M,V | P | | | N |
| Trigger | 1264 | | Grouped | M,V | P | | | N |
| Trigger-Type | 870 | | Enumerated | M,V | P | | | N |
| Trunk-Group-Id | 851 | | Grouped | M,V | P | | | N |
| Type-Number | 1204 | | Enumerated | M,V | P | | | N |
| Unit-Cost | 2061 | | Grouped | M,V | P | | | N |
| Unit-Quota-Threshold | 1226 | | Unsigned32 | M,V | P | | | N |
| User-CSG-Information | 2319 | | Grouped | M,V | P | | | N |
| User-Participating-Type | 1279 | | Enumerated | M,V | P | | | N |
| User-Session-Id | 830 | | UTF8String | M,V | P | | | N |
| Volume-Quota-Threshold | 869 | | Unsigned32 | M,V | P | | | N |
| WAG-Address | 890 | | Address | M,V | P | | | N |
| WAG-PLMN-Id | 891 | | OctetString | M,V | P | | | N |
| WLAN-Information | 875 | | Grouped | M,V | P | | | N |
| WLAN-Radio-Container | 892 | | Grouped | M,V | P | | | N |
| WLAN-Session-Id | 1246 | | UTF8String | M,V | P | | | N |
| WLAN-Technology | 893 | | Unsigned32 | M,V | P | | | N |
| WLAN-UE-Local-IPAddress | 894 | | Address | M,V | P | | | N |
| # 3GPP 29.272-c00 (12.0.0 2013.03.13) | | | | | | | | |
| Subscription-Data | 1400 | 7.3.2 | Grouped | M,V | | | | N |
| Terminal-Information | 1401 | 7.3.3 | Grouped | M,V | | | | N |
| IMEI | 1402 | 7.3.4 | UTF8String | M,V | | | | N |
| Software-Version | 1403 | 7.3.5 | UTF8String | M,V | | | | N |
| QoS-Subscribed | 1404 | 7.3.77 | OctetString | M,V | | | | N |
| ULR-Flags | 1405 | 7.3.7 | Unsigned32 | M,V | | | | N |
| ULA-Flags | 1406 | 7.3.8 | Unsigned32 | M,V | | | | N |
| Visited-PLMN-Id | 1407 | 7.3.9 | OctetString | M,V | | | | N |
| Requested-EUTRAN-Authentication-Info | 1408 | 7.3.11 | Grouped | M,V | | | | N |
| Requested-UTRAN- GERAN-Authentication-Info | 1409 | 7.3.12 | Grouped | M,V | | | | N |
| Number-Of-Requested-Vectors | 1410 | 7.3.14 | Unsigned32 | M,V | | | | N |
| Re-Synchronization-Info | 1411 | 7.3.15 | OctetString | M,V | | | | N |
| Immediate-Response-Preferred | 1412 | 7.3.16 | Unsigned32 | M,V | | | | N |
| Authentication-Info | 1413 | 7.3.17 | Grouped | M,V | | | | N |
| E-UTRAN-Vector | 1414 | 7.3.18 | Grouped | M,V | | | | N |
| UTRAN-Vector | 1415 | 7.3.19 | Grouped | M,V | | | | N |
| GERAN-Vector | 1416 | 7.3.20 | Grouped | M,V | | | | N |
| Network-Access-Mode | 1417 | 7.3.21 | Enumerated | M,V | | | | N |
| HPLMN-ODB | 1418 | 7.3.22 | Unsigned32 | M,V | | | | N |
| Item-Number | 1419 | 7.3.23 | Unsigned32 | M,V | | | | N |
| Cancellation-Type | 1420 | 7.3.24 | Enumerated | M,V | | | | N |
| DSR-Flags | 1421 | 7.3.25 | Unsigned32 | M,V | | | | N |
| DSA-Flags | 1422 | 7.3.26 | Unsigned32 | M,V | | | | N |
| Context-Identifier | 1423 | 7.3.27 | Unsigned32 | M,V | | | | N |
| Subscriber-Status | 1424 | 7.3.29 | Enumerated | M,V | | | | N |
| Operator-Determined-Barring | 1425 | 7.3.30 | Unsigned32 | M,V | | | | N |
| Access-Restriction-Data | 1426 | 7.3.31 | Unsigned32 | M,V | | | | N |
| APN-OI-Replacement | 1427 | 7.3.32 | UTF8String | M,V | | | | N |
| All-APN-Configurations-Included-Indicator | 1428 | 7.3.33 | Enumerated | M,V | | | | N |
| APN-Configuration-Profile | 1429 | 7.3.34 | Grouped | M,V | | | | N |
| APN-Configuration | 1430 | 7.3.35 | Grouped | M,V | | | | N |
| EPS-Subscribed-QoS-Profile | 1431 | 7.3.37 | Grouped | M,V | | | | N |
| VPLMN-Dynamic-Address-Allowed | 1432 | 7.3.38 | Enumerated | M,V | | | | N |
| STN-SR | 1433 | 7.3.39 | OctetString | M,V | | | | N |
| Alert-Reason | 1434 | 7.3.83 | Enumerated | M,V | | | | N |
| AMBR | 1435 | 7.3.41 | Grouped | M,V | | | | N |
| CSG-Subscription-Data | 1436 | 7.3.78 | Grouped | M. V | | | | N |
| CSG-Id | 1437 | 7.3.79 | Unsigned32 | M,V | | | | N |
| PDN-GW-Allocation-Type | 1438 | 7.3.44 | Enumerated | M,V | | | | N |
| Expiration-Date | 1439 | 7.3.80 | Time | M,V | | | | N |
| RAT-Frequency-Selection-Priority-ID | 1440 | 7.3.46 | Unsigned32 | M,V | | | | N |
| IDA-Flags | 1441 | 7.3.47 | Unsigned32 | M,V | | | | N |
| PUA-Flags | 1442 | 7.3.48 | Unsigned32 | M,V | | | | N |
| NOR-Flags | 1443 | 7.3.49 | Unsigned32 | M,V | | | | N |
| User-Id | 1444 | 7.3.50 | UTF8String | V | | | M | N |
| Equipment-Status | 1445 | 7.3.51 | Enumerated | M,V | | | | N |
| Regional-Subscription-Zone-Code | 1446 | 7.3.52 | OctetString | M,V | | | | N |
| RAND | 1447 | 7.3.53 | OctetString | M,V | | | | N |
| XRES | 1448 | 7.3.54 | OctetString | M,V | | | | N |
| AUTN | 1449 | 7.3.55 | OctetString | M,V | | | | N |
| KASME | 1450 | 7.3.56 | OctetString | M,V | | | | N |
| Trace-Collection-Entity | 1452 | 7.3.98 | Address | M,V | | | | N |
| Kc | 1453 | 7.3.59 | OctetString | M,V | | | | N |
| SRES | 1454 | 7.3.60 | OctetString | M,V | | | | N |
| PDN-Type | 1456 | 7.3.62 | Enumerated | M,V | | | | N |
| Roaming-Restricted-Due-To-Unsupported-Feature | 1457 | 7.3.81 | Enumerated | M,V | | | | N |
| Trace-Data | 1458 | 7.3.63 | Grouped | M,V | | | | N |
| Trace-Reference | 1459 | 7.3.64 | OctetString | M,V | | | | N |
| Trace-Depth | 1462 | 7.3.67 | Enumerated | M,V | | | | N |
| Trace-NE-Type-List | 1463 | 7.3.68 | OctetString | M,V | | | | N |
| Trace-Interface-List | 1464 | 7.3.69 | OctetString | M,V | | | | N |
| Trace-Event-List | 1465 | 7.3.70 | OctetString | M,V | | | | N |
| OMC-Id | 1466 | 7.3.71 | OctetString | M,V | | | | N |
| GPRS-Subscription-Data | 1467 | 7.3.72 | Grouped | M,V | | | | N |
| Complete-Data-List-Included-Indicator | 1468 | 7.3.73 | Enumerated | M,V | | | | N |
| PDP-Context | 1469 | 7.3.74 | Grouped | M,V | | | | N |
| PDP-Type | 1470 | 7.3.75 | OctetString | M,V | | | | N |
| 3GPP2-MEID | 1471 | 7.3.6 | OctetString | M,V | | | | N |
| Specific-APN-Info | 1472 | 7.3.82 | Grouped | M,V | | | | N |
| LCS-Info | 1473 | 7.3.84 | Grouped | M,V | | | | N |
| GMLC-Number | 1474 | 7.3.85 | OctetString | M,V | | | | N |
| LCS-PrivacyException | 1475 | 7.3.86 | Grouped | M,V | | | | N |
| SS-Code | 1476 | 7.3.87 | OctetString | M,V | | | | N |
| SS-Status | 1477 | 7.3.88 | Grouped | M,V | | | | N |
| Notification-To-UE-User | 1478 | 7.3.89 | Enumerated | M,V | | | | N |
| External-Client | 1479 | 7.3.90 | Grouped | M,V | | | | N |
| Client-Identity | 1480 | 7.3.91 | OctetString | M,V | | | | N |
| GMLC-Restriction | 1481 | 7.3.92 | Enumerated | M,V | | | | N |
| PLMN-Client | 1482 | 7.3.93 | Enumerated | M,V | | | | N |
| Service-Type | 1483 | 7.3.94 | Grouped | M,V | | | | N |
| ServiceTypeIdentity | 1484 | 7.3.95 | Unsigned32 | M,V | | | | N |
| MO-LR | 1485 | 7.3.96 | Grouped | M,V | | | | N |
| Teleservice-List | 1486 | 7.3.99 | Grouped | M,V | | | | N |
| TS-Code | 1487 | 7.3.100 | OctetString | M,V | | | | N |
| Call-Barring-Infor-List | 1488 | 7.3.101 | Grouped | M,V | | | | N |
| SGSN-Number | 1489 | 7.3.102 | OctetString | M,V | | | | N |
| IDR-Flags | 1490 | 7.3.103 | Unsigned32 | M,V | | | | N |
| ICS-Indicator | 1491 | 7.3.104 | Enumerated | V | | | M | N |
| IMS-Voice-Over-PS-Sessions-Supported | 1492 | 7.3.106 | Enumerated | V | | | M | N |
| Homogeneous-Support-of-IMS-Voice-Over-PS-Sessions | 1493 | 7.3.107 | Enumerated | V | | | M | N |
| Last-UE-Activity-Time | 1494 | 7.3.108 | Time | V | | | M | N |
| EPS-User-State | 1495 | 7.3.110 | Grouped | V | | | M | N |
| EPS-Location-Information | 1496 | 7.3.111 | Grouped | V | | | M | N |
| MME-User-State | 1497 | 7.3.112 | Grouped | V | | | M | N |
| SGSN-User-State | 1498 | 7.3.113 | Grouped | V | | | M | N |
| User-State | 1499 | 7.3.114 | Enumerated | V | | | M | N |
| MME-Location Information | 1600 | 7.3.115 | Grouped | V | | | M | N |
| SGSN-Location-Information | 1601 | 7.3.116 | Grouped | V | | | M | N |
| E-UTRAN-Cell-Global-Identity | 1602 | 7.3.117 | OctetString | V | | | M | N |
| Tracking-Area-Identity | 1603 | 7.3.118 | OctetString | V | | | M | N |
| Cell-Global-Identity | 1604 | 7.3.119 | OctetString | V | | | M | N |
| Routing-Area-Identity | 1605 | 7.3.120 | OctetString | V | | | M | N |
| Location-Area-Identity | 1606 | 7.3.121 | OctetString | V | | | M | N |
| Service-Area-Identity | 1607 | 7.3.122 | OctetString | V | | | M | N |
| Geographical-Information | 1608 | 7.3.123 | OctetString | V | | | M | N |
| Geodetic-Information | 1609 | 7.3.124 | OctetString | V | | | M | N |
| Current-Location-Retrieved | 1610 | 7.3.125 | Enumerated | V | | | M | N |
| Age-Of-Location-Information | 1611 | 7.3.126 | Unsigned32 | V | | | M | N |
| Active-APN | 1612 | 7.3.127 | Grouped | V | | | M | N |
| Error-Diagnostic | 1614 | 7.3.128 | Enumerated | V | | | M | N |
| Ext-PDP-Address | 1621 | 7.3.129 | Address | V | | | M | N |
| UE-SRVCC-Capability | 1615 | 7.3.130 | Enumerated | V | | | M | N |
| MPS-Priority | 1616 | 7.3.131 | Unsigned32 | V | | | M | N |
| VPLMN-LIPA-Allowed | 1617 | 7.3.132 | Enumerated | V | | | M | N |
| LIPA-Permission | 1618 | 7.3.133 | Enumerated | V | | | M | N |
| Subscribed-Periodic-RAU-TAU-Timer | 1619 | 7.3.134 | Unsigned32 | V | | | M | N |
| Ext-PDP-Type | 1620 | 7.3.75A | OctetString | V | | | M | N |
| SIPTO-Permission | 1613 | 7.3.135 | Enumerated | V | | | M | N |
| MDT-Configuration | 1622 | 7.3.136 | Grouped | V | | | M | N |
| Job-Type | 1623 | 7.3.137 | Enumerated | V | | | M | N |
| Area-Scope | 1624 | 7.3.138 | Grouped | V | | | M | N |
| List-Of-Measurements | 1625 | 7.3.139 | Unsigned32 | V | | | M | N |
| Reporting-Trigger | 1626 | 7.3.140 | Unsigned32 | V | | | M | N |
| Report-Interval | 1627 | 7.3.141 | Enumerated | V | | | M | N |
| Report-Amount | 1628 | 7.3.142 | Enumerated | V | | | M | N |
| Event-Threshold-RSRP | 1629 | 7.3.143 | Unsigned32 | V | | | M | N |
| Event-Threshold-RSRQ | 1630 | 7.3.144 | Unsigned32 | V | | | M | N |
| Logging-Interval | 1631 | 7.3.145 | Enumerated | V | | | M | N |
| Logging-Duration | 1632 | 7.3.146 | Enumerated | V | | | M | N |
| Relay-Node-Indicator | 1633 | 7.3.147 | Enumerated | V | | | M | N |
| MDT-User-Consent | 1634 | 7.3.148 | Enumerated | V | | | M | N |
| PUR-Flags | 1635 | 7.3.149 | Unsigned32 | V | | | M | N |
| Subscribed-VSRVCC | 1636 | 7.3.150 | Enumerated | V | | | M | N |
| Equivalent-PLMN-List | 1637 | 7.3.151 | Grouped | V | | | M | N |
| CLR-Flags | 1638 | 7.3.152 | Unsigned32 | V | | | M | N |
| UVR-Flags | 1639 | 7.3.153 | Unsigned32 | M,V | | | | N |
| UVA-Flags | 1640 | 7.3.154 | Unsigned32 | M,V | | | | N |
| VPLMN-CSG-Subscription-Data | 1641 | 7.3.155 | Grouped | M,V | | | | N |
| Time-Zone | 1642 | 7.3.163 | UTF8String | V | | | M | N |
| A-MSISDN | 1643 | 7.3.157 | OctetString | V | | | M | N |
| MME-Number-for-MT-SMS | 1645 | 7.3.159 | OctetString | V | | | M | N |
| SMS-Register-Request | 1648 | 7.3.162 | Enumerated | V | | | M | N |
| Local-Time-Zone | 1649 | 7.3.156 | Grouped | V | | | M | N |
| Daylight-Saving-Time | 1650 | 7.3.164 | Enumerated | V | | | M | N |
| Subscription-Data-Flags | 1654 | 7.3.165 | Unsigned32 | V | | | M | N |
| Measurement-Period-UMTS | 1655 | 7.3.166 | Enumerated | V | | | M | N |
| Measurement-Period-LTE | 1656 | 7.3.167 | Enumerated | V | | | M | N |
| Collection-Period-RRM-LTE | 1657 | 7.3.168 | Enumerated | V | | | M | N |
| Collection-Period-RRM-UMTS | 1658 | 7.3.169 | Enumerated | V | | | M | N |
| Positioning-Method | 1659 | 7.3.170 | OctetString | V | | | M | N |
| Measurement-Quantity | 1660 | 7.3.171 | OctetString | V | | | M | N |
| Event-Threshold-Event-1F | 1661 | 7.3.172 | Integer32 | V | | | M | N |
| Event-Threshold-Event-1I | 1662 | 7.3.173 | Integer32 | V | | | M | N |
| # 3GPP 29.329-b50 (11.5.0 2012.12.21) | | | | | | | | |
| User-Identity | 700 | 6.3.1 | Grouped | M,V | | | | N |
| MSISDN | 701 | 6.3.2 | OctetString | M,V | | | | N |
| # Name conflict with 29.229 User-Data (606), renamed | | | | | | | | |
| User-Data-29.329 | 702 | 6.3.3 | OctetString | M,V | | | | N |
| Data-Reference | 703 | 6.3.4 | Enumerated | M,V | | | | N |
| Service-Indication | 704 | 6.3.5 | OctetString | M,V | | | | N |
| Subs-Req-Type | 705 | 6.3.6 | Enumerated | M,V | | | | N |
| Requested-Domain | 706 | 6.3.7 | Enumerated | M,V | | | | N |
| Current-Location | 707 | 6.3.8 | Enumerated | M,V | | | | N |
| Identity-Set | 708 | 6.3.10 | Enumerated | V | | | M | N |
| Expiry-Time | 709 | 6.3.16 | Time | V | | | M | N |
| Send-Data-Indication | 710 | 6.3.17 | Enumerated | V | | | M | N |
| # in 29.229 | | | | | | | | |
| # Server-Name | 602 | 6.3.9 | UTF8String | M,V | | | | N |
| # Supported-Features | 628 | 6.3.11 | Grouped | V | M | | | N |
| # Feature-List-ID | 629 | 6.3.12 | Unsigned32 | V | | | M | N |
| # Feature-List | 630 | 6.3.13 | Unsigned32 | V | | | M | N |
| # Supported-Applications | 631 | 6.3.14 | Grouped | V | | | M | N |
| # Public-Identity | 601 | 6.3.15 | UTF8String | M,V | | | | N |
| DSAI-Tag | 711 | 6.3.18 | OctetString | M,V | | | | N |
| # in 29.229 | | | | | | | | |
| # Wildcarded-Public-Identity | 634 | 6.3.19 | UTF8String | V | | | M | N |
| Wildcarded-IMPU | 636 | 6.3.20 | UTF8String | V | | | M | N |
| # in 29.229 | | | | | | | | |
| # Session-Priority | 650 | 6.3.21 | Enumerated | V | | | M | N |
| One-Time-Notification | 712 | 6.3.22 | Enumerated | V | | | M | N |
| Requested-Nodes | 713 | 6.3.7A | Unsigned32 | V | | | M | N |
| Serving-Node-Indication | 714 | 6.3.23 | Enumerated | V | | | M | N |
| Repository-Data-ID | 715 | 6.3.24 | Grouped | V | | | M | N |
| Sequence-Number | 716 | 6.3.25 | Unsigned32 | V | | | M | N |
| UDR-Flags | 719 | 6.3.28 | Unsigned32 | V | | | M | N |
| # OMA DDS Charging_Data V1.0 20110201-A | | | | | | | | |
| Application-Server-Id | 2101 | 8.4 | UTF8String | M,V | | | | Y |
| Application-Service-Type | 2102 | 8.4 | UTF8String | M,V | | | | Y |
| Application-Session-Id | 2103 | 8.4 | UTF8String | M,V | | | | Y |
| Content-ID | 2116 | 8.4 | UTF8String | M,V | | | | Y |
| Content-provider-ID | 2117 | 8.4 | UTF8String | M,V | | | | Y |
| DCD-Information | 2115 | 8.5.5 | Grouped | M,V | | | | Y |
| Delivery-Status | 2104 | 8.4 | UTF8String | M,V | | | | Y |
| IM-Information | 2110 | 8.5.6 | Grouped | M,V | | | | Y |
| Number-Of-Messages-Successfully-Exploded | 2111 | 8.4 | Unsigned32 | M,V | | | | Y |
| Number-Of-Messages-Successfully-Sent | 2112 | 8.4 | Unsigned32 | M,V | | | | Y |
| Service-Generic-Information | 1256 | 8.5.10 | Grouped | M,V | | | | Y |
| Total-Number-Of-Messages-Exploded | 2113 | 8.4 | Unsigned32 | M,V | | | | Y |
| Total-Number-Of-Messages-Sent | 2114 | 8.4 | Unsigned32 | M,V | | | | Y |

View File

@@ -1,24 +0,0 @@
## Process this file with automake to produce Makefile.in
pkglib_LTLIBRARIES = dict_legacy_xml.la
dict_legacy_xml_la_SOURCES = \
dict_lxml.tab.y lex.dict_lxml.l dict_lxml.c dict_lxml_xml.c
AM_YFLAGS = -p dict_lxml -d
AM_LFLAGS = -p -Cem -Pdict_lxml
AM_LDFLAGS = \
-module -avoid-version -shared
AM_CPPFLAGS = \
-I$(top_srcdir)/lib/fd/gx \
-I$(top_srcdir)/lib/@FREEDIAMETER_DIR@/include \
@LIBXML2_CFLAGS@
AM_CFLAGS = \
-Wall -Werror
MAINTAINERCLEANFILES = Makefile.in
MOSTLYCLEANFILES = *.stackdump

View File

@@ -1,54 +0,0 @@
/*********************************************************************************************************
* Software License Agreement (BSD License) *
* Author: Sebastien Decugis <sdecugis@freediameter.net> *
* *
* Copyright (c) 2011, WIDE Project and NICT *
* All rights reserved. *
* *
* Redistribution and use of this software in source and binary forms, with or without modification, are *
* permitted provided that the following conditions are met: *
* *
* * Redistributions of source code must retain the above *
* copyright notice, this list of conditions and the *
* following disclaimer. *
* *
* * Redistributions in binary form must reproduce the above *
* copyright notice, this list of conditions and the *
* following disclaimer in the documentation and/or other *
* materials provided with the distribution. *
* *
* * Neither the name of the WIDE Project or NICT nor the *
* names of its contributors may be used to endorse or *
* promote products derived from this software without *
* specific prior written permission of WIDE Project and *
* NICT. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED *
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS *
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR *
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF *
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
*********************************************************************************************************/
/*
* Legacy XML dictionary files support for freeDiameter.
*/
#include "dict_lxml.h"
/* entry point */
static int dict_lxml_entry(char * conffile)
{
TRACE_ENTRY("%p", conffile);
/* Parse the configuration file -- everything happens there */
CHECK_FCT( dict_lxml_handle(conffile) );
/* We're done */
return 0;
}
EXTENSION_ENTRY("dict_legacy_xml", dict_lxml_entry);

View File

@@ -1,48 +0,0 @@
/*********************************************************************************************************
* Software License Agreement (BSD License) *
* Author: Sebastien Decugis <sdecugis@freediameter.net> *
* *
* Copyright (c) 2011, WIDE Project and NICT *
* All rights reserved. *
* *
* Redistribution and use of this software in source and binary forms, with or without modification, are *
* permitted provided that the following conditions are met: *
* *
* * Redistributions of source code must retain the above *
* copyright notice, this list of conditions and the *
* following disclaimer. *
* *
* * Redistributions in binary form must reproduce the above *
* copyright notice, this list of conditions and the *
* following disclaimer in the documentation and/or other *
* materials provided with the distribution. *
* *
* * Neither the name of the WIDE Project or NICT nor the *
* names of its contributors may be used to endorse or *
* promote products derived from this software without *
* specific prior written permission of WIDE Project and *
* NICT. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED *
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS *
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR *
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF *
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
*********************************************************************************************************/
/* Header file for the dict_legacy_xml extension.
*
* See the dict_legacy_xml.conf.sample file for the format of the configuration file.
*/
/* FreeDiameter's common include file */
#include <freeDiameter/extension.h>
/* Parse the configuration file */
int dict_lxml_handle(char * conffile);
/* Parse an XML file and return the number of dictionary objects or -1 on error */
int dict_lxml_parse(char * xmlfilename);

View File

@@ -1,141 +0,0 @@
/*********************************************************************************************************
* Software License Agreement (BSD License) *
* Author: Sebastien Decugis <sdecugis@freediameter.net> *
* *
* Copyright (c) 2013, WIDE Project and NICT *
* All rights reserved. *
* *
* Redistribution and use of this software in source and binary forms, with or without modification, are *
* permitted provided that the following conditions are met: *
* *
* * Redistributions of source code must retain the above *
* copyright notice, this list of conditions and the *
* following disclaimer. *
* *
* * Redistributions in binary form must reproduce the above *
* copyright notice, this list of conditions and the *
* following disclaimer in the documentation and/or other *
* materials provided with the distribution. *
* *
* * Neither the name of the WIDE Project or NICT nor the *
* names of its contributors may be used to endorse or *
* promote products derived from this software without *
* specific prior written permission of WIDE Project and *
* NICT. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED *
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS *
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR *
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF *
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
*********************************************************************************************************/
/* Yacc extension's configuration parser.
* See doc/dict_legacy_xml.conf.sample for configuration file format
*/
/* For development only : */
%debug
%error-verbose
/* The parser receives the configuration file filename as parameter */
%parse-param {char * conffile}
/* Keep track of location */
%locations
%pure-parser
%{
#include "dict_lxml.h"
#include "dict_lxml.tab.h" /* bison is not smart enough to define the YYLTYPE before including this code, so... */
/* Forward declaration */
int yyparse(char * conffile);
static int nb_files = 0;
static int nb_dict = 0;
/* Parse the configuration file */
int dict_lxml_handle(char * conffile)
{
extern FILE * dict_lxmlin;
int ret;
TRACE_ENTRY("%p", conffile);
TRACE_DEBUG (FULL, "Parsing configuration file: %s...", conffile);
dict_lxmlin = fopen(conffile, "r");
if (dict_lxmlin == NULL) {
ret = errno;
fd_log_debug("Unable to open extension configuration file %s for reading: %s", conffile, strerror(ret));
TRACE_DEBUG (INFO, "Error occurred, message logged -- configuration file.");
return ret;
}
ret = yyparse(conffile);
fclose(dict_lxmlin);
if (ret != 0) {
TRACE_DEBUG (INFO, "Unable to parse the configuration file.");
return EINVAL;
} else {
TRACE_DEBUG(FULL, "%d XML dictionary files parsed successfully, %d dictionary objects added.", nb_files, nb_dict);
}
return 0;
}
/* The Lex parser prototype */
int dict_lxmllex(YYSTYPE *lvalp, YYLTYPE *llocp);
/* Function to report the errors */
void yyerror (YYLTYPE *ploc, char * conffile, char const *s)
{
TRACE_DEBUG(INFO, "Error in configuration parsing");
if (ploc->first_line != ploc->last_line)
fd_log_debug("%s:%d.%d-%d.%d : %s", conffile, ploc->first_line, ploc->first_column, ploc->last_line, ploc->last_column, s);
else if (ploc->first_column != ploc->last_column)
fd_log_debug("%s:%d.%d-%d : %s", conffile, ploc->first_line, ploc->first_column, ploc->last_column, s);
else
fd_log_debug("%s:%d.%d : %s", conffile, ploc->first_line, ploc->first_column, s);
}
%}
/* Values returned by lex for token */
%union {
char *string; /* The string is allocated by strdup in lex.*/
}
/* In case of error in the lexical analysis */
%token LEX_ERROR
/* A (de)quoted string (malloc'd in lex parser; it must be freed after use) */
%token <string> QSTRING
/* -------------------------------------- */
%%
/* The grammar definition */
conffile: /* empty grammar is OK */
| conffile xmlfile
;
/* a RULE entry */
xmlfile: QSTRING ';'
{
int ret = dict_lxml_parse($1);
if (ret < 0) {
yyerror (&yylloc, conffile, "An error occurred while parsing a file, aborting...");
YYERROR;
}
nb_files++;
nb_dict += ret;
}
;

File diff suppressed because it is too large Load Diff

View File

@@ -1,98 +0,0 @@
/*********************************************************************************************************
* Software License Agreement (BSD License) *
* Author: Sebastien Decugis <sdecugis@freediameter.net> *
* *
* Copyright (c) 2013, WIDE Project and NICT *
* All rights reserved. *
* *
* Redistribution and use of this software in source and binary forms, with or without modification, are *
* permitted provided that the following conditions are met: *
* *
* * Redistributions of source code must retain the above *
* copyright notice, this list of conditions and the *
* following disclaimer. *
* *
* * Redistributions in binary form must reproduce the above *
* copyright notice, this list of conditions and the *
* following disclaimer in the documentation and/or other *
* materials provided with the distribution. *
* *
* * Neither the name of the WIDE Project or NICT nor the *
* names of its contributors may be used to endorse or *
* promote products derived from this software without *
* specific prior written permission of WIDE Project and *
* NICT. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED *
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS *
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR *
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF *
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
*********************************************************************************************************/
/* Tokenizer
*
*/
%{
#include "dict_lxml.h"
/* Include yacc tokens definitions */
#include "dict_lxml.tab.h"
/* Update the column information */
#define YY_USER_ACTION { \
yylloc->first_column = yylloc->last_column + 1; \
yylloc->last_column = yylloc->first_column + yyleng - 1; \
}
/* Avoid warning with newer flex */
#define YY_NO_INPUT
%}
qstring \"[^\"\n]*\"
%option bison-bridge bison-locations
%option noyywrap
%option nounput
%%
/* Update the line count */
\n {
yylloc->first_line++;
yylloc->last_line++;
yylloc->last_column=0;
}
/* Eat all spaces but not new lines */
([[:space:]]{-}[\n])+ ;
/* Eat all comments */
#.*$ ;
/* Recognize quoted strings */
{qstring} {
/* Match a quoted string. */
CHECK_MALLOC_DO( yylval->string = strdup(yytext+1),
{
TRACE_DEBUG(INFO, "Unable to copy the string '%s': %s", yytext, strerror(errno));
return LEX_ERROR; /* trig an error in yacc parser */
} );
yylval->string[strlen(yytext) - 2] = '\0';
return QSTRING;
}
/* Valid single characters for yyparse */
[;] { return yytext[0]; }
/* Unrecognized sequence, if it did not match any previous pattern */
[^[:space:]\";\n]+ {
fd_log_debug("Unrecognized text on line %d col %d: '%s'.", yylloc->first_line, yylloc->first_column, yytext);
return LEX_ERROR;
}
%%

View File

@@ -1,18 +0,0 @@
## Process this file with automake to produce Makefile.in
pkglib_LTLIBRARIES = dict_mip6i.la
dict_mip6i_la_SOURCES = \
dict_mip6i.c
AM_LDFLAGS = \
-module -avoid-version -shared
AM_CPPFLAGS = \
-I$(top_srcdir)/lib/@FREEDIAMETER_DIR@/include
AM_CFLAGS = \
-Wall -Werror
MAINTAINERCLEANFILES = Makefile.in
MOSTLYCLEANFILES = *.stackdump

File diff suppressed because it is too large Load Diff

View File

@@ -1,18 +0,0 @@
## Process this file with automake to produce Makefile.in
pkglib_LTLIBRARIES = dict_nas_mipv6.la
dict_nas_mipv6_la_SOURCES = \
dict_nas_mipv6.c
AM_LDFLAGS = \
-module -avoid-version -shared
AM_CPPFLAGS = \
-I$(top_srcdir)/lib/@FREEDIAMETER_DIR@/include
AM_CFLAGS = \
-Wall -Werror
MAINTAINERCLEANFILES = Makefile.in
MOSTLYCLEANFILES = *.stackdump

View File

@@ -1,258 +0,0 @@
/*********************************************************************************************************
* Software License Agreement (BSD License) *
* Author: Francois Bard <francois@tera.ics.keio.ac.jp> *
* *
* Copyright (c) 2010, Teraoka Laboratory, Keio University *
* All rights reserved. *
* *
* Redistribution and use of this software in source and binary forms, with or without modification, are *
* permitted provided that the following conditions are met: *
* *
* * Redistributions of source code must retain the above *
* copyright notice, this list of conditions and the *
* following disclaimer. *
* *
* * Redistributions in binary form must reproduce the above *
* copyright notice, this list of conditions and the *
* following disclaimer in the documentation and/or other *
* materials provided with the distribution. *
* *
* * Neither the name of the Teraoka Laboratory nor the *
* names of its contributors may be used to endorse or *
* promote products derived from this software without *
* specific prior written permission of Teraoka Laboratory *
* *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED *
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR *
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS *
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR *
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF *
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
*********************************************************************************************************/
/*
The following table lists the AVPs needed for the NAS to HAAA server interaction.
We try to keep the structure of the grouped AVP by declaring the contained AVPs just before the grouped AVP they depend on.
The number of '+' indicates the depth of the contained AVP.
DEPTH NAME AVP CODE RFC TYPE IMPLEMENTED NOTES
MIP6-Feature-Vector 124 5447 Unsigned64 yes
+ MIP-Home-Agent-Address 334 4004 Address not yet
++ Destination-Host 293 3588 DiameterIdentity no (Base)
++ Destination-Realm 283 3588 DiameterIdentity no (Base)
+ MIP-Home-Agent-Host 348 4004 Grouped not yet
+ MIP6-Home-Link-Prefix 125 5447 OctetString yes
MIP6-Agent-Info 486 5447 Grouped yes
*/
#include <freeDiameter/extension.h>
/* The content of this file follows the same structure as dict_base_proto.c */
#define CHECK_dict_new( _type, _data, _parent, _ref ) \
CHECK_FCT( fd_dict_new( fd_g_config->cnf_dict, (_type), (_data), (_parent), (_ref)) );
#define CHECK_dict_search( _type, _criteria, _what, _result ) \
CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, (_type), (_criteria), (_what), (_result), ENOENT) );
struct local_rules_definition {
char *avp_name;
enum rule_position position;
int min;
int max;
};
#define RULE_ORDER( _position ) ((((_position) == RULE_FIXED_HEAD) || ((_position) == RULE_FIXED_TAIL)) ? 1 : 0 )
#define PARSE_loc_rules( _rulearray, _parent) { \
int __ar; \
for (__ar=0; __ar < sizeof(_rulearray) / sizeof((_rulearray)[0]); __ar++) { \
struct dict_rule_data __data = { NULL, \
(_rulearray)[__ar].position, \
0, \
(_rulearray)[__ar].min, \
(_rulearray)[__ar].max}; \
__data.rule_order = RULE_ORDER(__data.rule_position); \
CHECK_FCT( fd_dict_search( \
fd_g_config->cnf_dict, \
DICT_AVP, \
AVP_BY_NAME, \
(_rulearray)[__ar].avp_name, \
&__data.rule_avp, 0 ) ); \
if ( !__data.rule_avp ) { \
TRACE_DEBUG(INFO, "AVP Not found: '%s'", (_rulearray)[__ar].avp_name ); \
return ENOENT; \
} \
CHECK_FCT_DO( fd_dict_new( fd_g_config->cnf_dict, DICT_RULE, &__data, _parent, NULL), \
{ \
TRACE_DEBUG(INFO, "Error on rule with AVP '%s'", \
(_rulearray)[__ar].avp_name ); \
return EINVAL; \
} ); \
} \
}
#define enumval_def_u32( _val_, _str_ ) \
{ _str_, { .u32 = _val_ }}
#define enumval_def_os( _len_, _val_, _str_ ) \
{ _str_, { .os = { .data = (unsigned char *)_val_, .len = _len_ }}}
/* Defines if there are any */
/* Define Flags for MIP6-Feature-Vector*/
#define MIP6_INTEGRATED 0x0000000000000001
#define LOCAL_HOME_AGENT_ASSIGNMENT 0x0000000000000002
/* Dictionary */
int dict_nas_mipv6_init(char * conffile)
{
struct dict_object * nas_mipv6;
{
struct dict_application_data data = { 5447, "MIPv6 NAS-to-HAAA Interaction" };
CHECK_dict_new( DICT_APPLICATION, &data , NULL, &nas_mipv6);
}
/* AVP section */
{
/* Loading the derived data formats */
struct dict_object * Address_type;
CHECK_dict_search( DICT_TYPE, TYPE_BY_NAME, "Address", &Address_type);
/* MIP6-Feature-Vector */
{
/*
*/
struct dict_avp_data data = {
124, /* Code */
0, /* Vendor */
"MIP6-Feature-Vector", /* Name */
AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
AVP_FLAG_MANDATORY, /* Fixed flag values */
AVP_TYPE_UNSIGNED64 /* base type of data */
};
CHECK_dict_new( DICT_AVP, &data , NULL, NULL);
}
/* MIP-Home-Agent-Address - RFC 4004 */
{
/*
*/
struct dict_avp_data data = {
334, /* Code */
0, /* Vendor */
"MIP-Home-Agent-Address", /* Name */
AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
AVP_FLAG_MANDATORY, /* Fixed flag values */
AVP_TYPE_OCTETSTRING /* base type of data */
};
CHECK_dict_new( DICT_AVP, &data , Address_type, NULL);
}
/* Destination-Host - Base Protocol */
/* Destination-Realm - Base Protocol */
/* MIP-Home-Agent-Host - RFC 4004 */
{
/*
The MIP-Home-Agent-Host AVP (AVP Code 348) is of type Grouped and
contains the identity of the assigned Home Agent. If the MIP-Home-
Agent-Host AVP is present in the AMR, the AAAH MUST copy it into the
HAR.
MIP-Home-Agent-Host ::= < AVP Header: 348 >
{ Destination-Realm }
{ Destination-Host }
* [ AVP ]
*/
struct dict_object * avp;
struct dict_avp_data data = {
348, /* Code */
0, /* Vendor */
"MIP-Home-Agent-Host", /* Name */
AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
AVP_FLAG_MANDATORY, /* Fixed flag values */
AVP_TYPE_GROUPED /* base type of data */
};
struct local_rules_definition rules[] =
{ { "Destination-Realm", RULE_REQUIRED, -1, 1 }
,{ "Destination-Host", RULE_REQUIRED, -1, 1 }
};
CHECK_dict_new( DICT_AVP, &data , NULL, &avp);
PARSE_loc_rules( rules, avp );
}
/* MIP6-Home-Link-Prefix */
{
/*
*/
struct dict_avp_data data = {
125, /* Code */
0, /* Vendor */
"MIP6-Home-Link-Prefix", /* Name */
AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
AVP_FLAG_MANDATORY, /* Fixed flag values */
AVP_TYPE_OCTETSTRING /* base type of data */
};
CHECK_dict_new( DICT_AVP, &data , NULL, NULL);
}
/* MIP6-Agent-Info */
{
/*
*/
struct dict_object * avp;
struct dict_avp_data data = {
486, /* Code */
0, /* Vendor */
"MIP6-Agent-Info", /* Name */
AVP_FLAG_VENDOR | AVP_FLAG_MANDATORY, /* Fixed flags */
AVP_FLAG_MANDATORY, /* Fixed flag values */
AVP_TYPE_GROUPED /* base type of data */
};
struct local_rules_definition rules[] =
{ { "MIP-Home-Agent-Address", RULE_OPTIONAL, -1, 2 }
,{ "MIP-Home-Agent-Host", RULE_OPTIONAL, -1, 1 }
,{ "MIP6-Home-Link-Prefix", RULE_OPTIONAL, -1, 1 }
};
CHECK_dict_new( DICT_AVP, &data , NULL, &avp);
PARSE_loc_rules( rules, avp );
}
}
LOG_D( "Dictionary Extension 'MIPv6 NAS-to-HAAA Interaction' initialized");
return 0;
}
EXTENSION_ENTRY("dict_nas_mipv6", dict_nas_mipv6_init);

View File

@@ -1,18 +0,0 @@
## Process this file with automake to produce Makefile.in
pkglib_LTLIBRARIES = dict_nasreq.la
dict_nasreq_la_SOURCES = \
dict_nasreq.c
AM_LDFLAGS = \
-module -avoid-version -shared
AM_CPPFLAGS = \
-I$(top_srcdir)/lib/@FREEDIAMETER_DIR@/include
AM_CFLAGS = \
-Wall -Werror
MAINTAINERCLEANFILES = Makefile.in
MOSTLYCLEANFILES = *.stackdump

File diff suppressed because it is too large Load Diff

View File

@@ -1,18 +0,0 @@
## Process this file with automake to produce Makefile.in
pkglib_LTLIBRARIES = dict_rfc5777.la
dict_rfc5777_la_SOURCES = \
dict_rfc5777.c
AM_LDFLAGS = \
-module -avoid-version -shared
AM_CPPFLAGS = \
-I$(top_srcdir)/lib/@FREEDIAMETER_DIR@/include
AM_CFLAGS = \
-Wall -Werror
MAINTAINERCLEANFILES = Makefile.in
MOSTLYCLEANFILES = *.stackdump

Some files were not shown because too many files have changed in this diff Show More