Commit 209ae57a authored by Yann Garcia's avatar Yann Garcia
Browse files

Enhance Doxygen tag for golang

parent 934ebcbf
Loading
Loading
Loading
Loading
+9 −16
Changes for go-apps/meep-simu5g-bridge/bridge.go: 9 added lines, 16 removed lines.
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ type BridgeInstance struct {

/**
 * @brief Constructs a bridge instance: validates config, opens TUN, connects TCP, sends HELLO.
 * @param cfg Integration configuration (deployment, bridge, ueMappings).
 * cfg: Integration configuration (deployment, bridge, ueMappings).
 * @return Bridge instance or error from validation, TUN open, or TCP dial.
 */
func NewBridgeInstance(cfg *bridge.IntegrationConfig) (*BridgeInstance, error) {
@@ -116,7 +116,7 @@ func (b *BridgeInstance) connectAndHello() error {

/**
 * @brief Relays TUN uplink and TCP downlink until context cancel.
 * @param ctx Cancellation stops loops cleanly; TCP errors trigger reconnect.
 * ctx: Cancellation stops loops cleanly; TCP errors trigger reconnect.
 * @return ctx.Err() on shutdown, or error if reconnect is aborted.
 */
func (b *BridgeInstance) Run(ctx context.Context) error {
@@ -145,7 +145,7 @@ func (b *BridgeInstance) Run(ctx context.Context) error {

/**
 * @brief Reconnects to S with exponential backoff until success or context cancel.
 * @param ctx Used to abort the retry loop.
 * ctx: Used to abort the retry loop.
 * @return nil on successful reconnect, or ctx.Err().
 */
func (b *BridgeInstance) reconnect(ctx context.Context) error {
@@ -168,7 +168,7 @@ func (b *BridgeInstance) reconnect(ctx context.Context) error {

/**
 * @brief Uplink loop: TUN read → resolve ueId → DATA_UL → TCP write.
 * @param ctx Exit loop when cancelled.
 * ctx: Exit loop when cancelled.
 * @return Read/write error (triggers reconnect in Run), or nil on ctx.Done().
 */
func (b *BridgeInstance) loopTunToSocket(ctx context.Context) error {
@@ -221,9 +221,8 @@ func (b *BridgeInstance) loopTunToSocket(ctx context.Context) error {
}

/**
 * @brief Downlink loop: TCP read → decode frame → DATA_DL IP packet → TUN write.
 * @param ctx Exit loop when cancelled.
 * @return Read/write error or invalid magic (triggers reconnect).
 * @brief Downlink loop: TCP read, decode DATA_DL, write IPv4 to the TUN.
 * Stops when the context is cancelled. Returns a read/write error or invalid magic (reconnect).
 */
func (b *BridgeInstance) loopSocketToTun(ctx context.Context) error {
	hdr := make([]byte, bridge.FrameHeaderSize)
@@ -274,9 +273,7 @@ func (b *BridgeInstance) loopSocketToTun(ctx context.Context) error {
}

/**
 * @brief Extracts IPv4 source address from a raw IPv4 packet buffer.
 * @param pkt Raw L3 packet bytes (minimum 20-byte IPv4 header).
 * @return Source IPv4 or nil if not IPv4 or buffer too short.
 * @brief IPv4 source of a raw L3 packet (needs a 20-byte IPv4 header). Nil if not IPv4.
 */
func ipv4Source(pkt []byte) net.IP {
	if len(pkt) < 20 {
@@ -289,9 +286,7 @@ func ipv4Source(pkt []byte) net.IP {
}

/**
 * @brief Extracts IPv4 destination address from a raw IPv4 packet buffer.
 * @param pkt Raw L3 packet bytes (minimum 20-byte IPv4 header).
 * @return Destination IPv4 or nil if not IPv4 or buffer too short.
 * @brief IPv4 destination of a raw L3 packet (needs a 20-byte IPv4 header). Nil if not IPv4.
 */
func ipv4Dest(pkt []byte) net.IP {
	if len(pkt) < 20 {
@@ -304,9 +299,7 @@ func ipv4Dest(pkt []byte) net.IP {
}

/**
 * @brief Returns the IPv4 protocol field (1=ICMP, 6=TCP, 17=UDP).
 * @param pkt Raw L3 packet bytes.
 * @return Protocol number, or 0 if not IPv4.
 * @brief IPv4 protocol field of a raw L3 packet (1=ICMP, 6=TCP, 17=UDP). Zero if not IPv4.
 */
func ipv4Proto(pkt []byte) int {
	if len(pkt) < 10 {
+0 −1
Changes for go-apps/meep-simu5g-bridge/doc.go: 0 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -13,6 +13,5 @@
 * See go-packages/meep-simu5g-bridge for shared protocol and configuration.
 *
 * @defgroup simu5g_bridge_app meep-simu5g-bridge (application)
 * @{
 */
package main
+4 −4
Changes for go-apps/meep-simu5g-bridge/tun_linux.go: 4 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@ type tunDevice struct {

/**
 * @brief Reads one raw IP packet from the TUN fd.
 * @param p Destination buffer.
 * p: Destination buffer.
 * @return Number of bytes read, or syscall error.
 */
func (t *tunDevice) Read(p []byte) (int, error) {
@@ -69,7 +69,7 @@ func (t *tunDevice) Read(p []byte) (int, error) {

/**
 * @brief Writes one raw IP packet to the TUN fd.
 * @param p Packet bytes.
 * p: Packet bytes.
 * @return Number of bytes written, or syscall error.
 */
func (t *tunDevice) Write(p []byte) (int, error) {
@@ -89,7 +89,7 @@ func (t *tunDevice) Close() error {

/**
 * @brief Opens /dev/net/tun and binds to the named interface (e.g. simu5g-br0).
 * @param name Interface name (IFNAMSIZ-1 max); empty defaults to simu5g-br0.
 * name: Interface name (IFNAMSIZ-1 max); empty defaults to simu5g-br0.
 * @return io.ReadWriteCloser for raw IP packets.
 */
func openTun(name string) (io.ReadWriteCloser, error) {
@@ -126,7 +126,7 @@ func openTun(name string) (io.ReadWriteCloser, error) {

/**
 * @brief NUL-terminated string from fixed-size ioctl name buffer.
 * @param b Byte slice from ifreq.name.
 * b: Byte slice from ifreq.name.
 * @return Go string up to first zero byte.
 */
func cString(b []byte) string {
+1 −1
Changes for go-apps/meep-simu5g-bridge/tun_stub.go: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ import (

/**
 * @brief Stub openTun for non-Linux builds.
 * @param name Ignored.
 * name: Ignored.
 * @return Always error.
 */
// func openTun(name string) (io.ReadWriteCloser, error) {
+2 −2
Changes for go-packages/meep-nw-simu-catalog/Doxyfile: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@ CREATE_SUBDIRS = NO
INPUT                  = .
FILE_PATTERNS          = *.go *.dox
RECURSIVE              = NO
EXCLUDE_PATTERNS       = */doxygen/*
EXCLUDE_PATTERNS       = */doxygen/* *_test.go

EXTENSION_MAPPING      = go=C++
EXTRACT_ALL            = YES
@@ -60,7 +60,7 @@ WARNINGS = YES
WARN_IF_UNDOCUMENTED   = YES
WARN_IF_DOC_ERROR      = YES
WARN_NO_PARAMDOC       = NO
QUIET                  = NO
QUIET                  = YES
WARN_LOGFILE           = doxygen/doxygen_warnings.log

ALIASES                += "go{1}=\\c \1"
Loading